feat: add clear error message when llama-server not running
This commit is contained in:
@@ -81,4 +81,16 @@ describe('LlamaCppClient', () => {
|
||||
usage: { inputTokens: 5, outputTokens: 2 },
|
||||
});
|
||||
});
|
||||
|
||||
it('throws clear error when server not running', async () => {
|
||||
mockFetch.mockRejectedValue(new TypeError('fetch failed'));
|
||||
|
||||
const client = new LlamaCppClient({
|
||||
endpoint: 'http://localhost:8080',
|
||||
});
|
||||
|
||||
await expect(client.chat({
|
||||
messages: [{ role: 'user', content: 'Hello' }],
|
||||
})).rejects.toThrow('llama-server not running at http://localhost:8080');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user