| 123456789101112131415161718192021222324 |
- const { callLLMWithMessages } = require('/data/ai/audio/server/dist/services/llm/index');
- const messages = [
- { role: 'system', content: 'You are a test.' },
- { role: 'user', content: 'Reply with the single word: HA_OK' },
- ];
- (async () => {
- const t0 = Date.now();
- try {
- const r = await callLLMWithMessages(messages, 'fake-model-xxx-no-such-model', 30);
- console.log('UNEXPECTED_OK', r.substring(0, 80));
- } catch (e) {
- console.log('ERROR_NAME:', e.name);
- console.log('ERROR_MSG:', (e.message || '').substring(0, 400));
- if (e.attempts) {
- console.log('PROVIDERS_TRIED:', e.attempts.length);
- for (const a of e.attempts) {
- console.log(' ', a.provider + '/' + a.model, '|', a.errorType, '|', a.attempts, '次 |', (a.error || '').substring(0, 80));
- }
- } else {
- console.log('NO_ATTEMPTS_FIELD (说明没走 HA 调度)');
- }
- }
- console.log('ELAPSED_MS:', Date.now() - t0);
- })();
|