fix: handle null config values
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 1s

This commit is contained in:
WangDL 2026-05-22 22:40:02 +08:00
parent 4077150295
commit 663d419d91

View File

@ -59,7 +59,7 @@ export class AdminAiChatService {
const hermesUrl = await this.config.get('hermes.api_url', 'http://10.2.0.7:8642');
const resp = await fetch(`${hermesUrl}/v1/chat/completions`, {
method: 'POST', headers,
body: JSON.stringify({ model: 'hermes-agent', messages, temperature: parseFloat(await this.config.get('ai.temperature', '0.7')), max_tokens: parseInt(await this.config.get('ai.max_tokens', '4096')) }),
body: JSON.stringify({ model: 'hermes-agent', messages, temperature: parseFloat((await this.config.get('ai.temperature')) || '0.7'), max_tokens: parseInt((await this.config.get('ai.max_tokens')) || '4096') }),
signal: AbortSignal.timeout(120_000),
});
if (!resp.ok) throw new Error(`Hermes API error ${resp.status}`);