Files
waggle-os/packages/cli/tests/model-endpoint.test.ts
shumeiko.it a70bc14c63 fix(cli): talk to local Ollama models without a proxy
The CLI sent every request to a LiteLLM proxy on :4000, which the
community edition no longer starts (it needs Python), so the CLI could
not answer with any model out of the box. ollama/<tag> models now go to
Ollama's OpenAI-compatible API directly; other models still use the
configured proxy.
2026-11-01 11:15:37 +01:00

26 lines
988 B
TypeScript

import { describe, expect, it } from 'vitest';
import { modelEndpoint } from '../src/model-endpoint.js';
describe('modelEndpoint', () => {
it('sends local models straight to Ollama under their own tag', () => {
expect(modelEndpoint('ollama/llama3.1:8b', { env: {} })).toEqual({
url: 'http://127.0.0.1:11434/v1',
apiKey: 'ollama',
model: 'llama3.1:8b',
});
expect(modelEndpoint('ollama/qwen3:8b', { env: { OLLAMA_HOST: '10.0.0.5:11500/' } }).url)
.toBe('http://10.0.0.5:11500/v1');
});
it('sends other models through the configured proxy', () => {
expect(modelEndpoint('claude-sonnet-4-6', { env: {} })).toEqual({
url: 'http://localhost:4000/v1',
apiKey: 'sk-waggle-dev',
model: 'claude-sonnet-4-6',
});
expect(
modelEndpoint('gpt-4o', { litellmUrl: 'http://proxy:9000/v1', env: { LITELLM_MASTER_KEY: 'master' } }),
).toEqual({ url: 'http://proxy:9000/v1', apiKey: 'master', model: 'gpt-4o' });
});
});