feat: harden intelligence runtime and llm providers
This commit is contained in:
@@ -13,19 +13,19 @@ describe('OllamaProvider', () => {
|
||||
const provider = new OllamaProvider({});
|
||||
assert.equal(provider.name, 'ollama');
|
||||
assert.equal(provider.model, 'llama3.1:8b');
|
||||
assert.equal(provider.baseUrl, 'http://localhost:11434');
|
||||
assert.equal(provider.baseUrl, 'http://localhost:11434/v1');
|
||||
assert.equal(provider.isConfigured, true);
|
||||
});
|
||||
|
||||
it('should accept custom model and base URL', () => {
|
||||
const provider = new OllamaProvider({ model: 'qwen2.5:14b', baseUrl: 'http://192.168.1.10:11434' });
|
||||
assert.equal(provider.model, 'qwen2.5:14b');
|
||||
assert.equal(provider.baseUrl, 'http://192.168.1.10:11434');
|
||||
assert.equal(provider.baseUrl, 'http://192.168.1.10:11434/v1');
|
||||
});
|
||||
|
||||
it('should strip trailing slashes from base URL', () => {
|
||||
const provider = new OllamaProvider({ baseUrl: 'http://localhost:11434/' });
|
||||
assert.equal(provider.baseUrl, 'http://localhost:11434');
|
||||
assert.equal(provider.baseUrl, 'http://localhost:11434/v1');
|
||||
});
|
||||
|
||||
it('should throw on API error', async () => {
|
||||
@@ -38,7 +38,7 @@ describe('OllamaProvider', () => {
|
||||
await assert.rejects(
|
||||
() => provider.complete('system', 'user'),
|
||||
(err) => {
|
||||
assert.match(err.message, /Ollama API 404/);
|
||||
assert.match(err.message, /ollama API 404/);
|
||||
return true;
|
||||
}
|
||||
);
|
||||
@@ -164,7 +164,7 @@ describe('createLLMProvider — ollama', () => {
|
||||
it('should pass baseUrl from config', () => {
|
||||
const provider = createLLMProvider({ provider: 'ollama', apiKey: null, model: 'mistral:7b', baseUrl: 'http://gpu-box:11434' });
|
||||
assert.ok(provider instanceof OllamaProvider);
|
||||
assert.equal(provider.baseUrl, 'http://gpu-box:11434');
|
||||
assert.equal(provider.baseUrl, 'http://gpu-box:11434/v1');
|
||||
assert.equal(provider.model, 'mistral:7b');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user