mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-22 12:26:43 +02:00
fix(llm): user-friendly error messages when no LLM tier available
Track skip reasons per tier in the orchestrator (no-consent,
no-backend, not-available, not-ready, runtime-error) and expose
them via NoTierAvailableError.getUserMessage() with actionable
German text pointing the user to the right settings page.
Before: "No tier could run task 'companion.chat' (attempted: cloud)"
After: "Cloud (Gemini): Cloud-Einwilligung fehlt. Aktiviere sie
unter Einstellungen → KI."
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c642e1be78
commit
2b96953ad1
3 changed files with 72 additions and 4 deletions
|
|
@ -11,7 +11,7 @@
|
|||
* routes through text-completion).
|
||||
*/
|
||||
|
||||
import { llmOrchestrator } from '@mana/shared-llm';
|
||||
import { llmOrchestrator, NoTierAvailableError } from '@mana/shared-llm';
|
||||
import { isLocalLlmSupported, getLocalLlmStatus, loadLocalLlm } from '@mana/local-llm';
|
||||
import { companionChatTask } from '$lib/llm-tasks/companion-chat';
|
||||
import { generateContextDocument } from '$lib/data/projections/context-document';
|
||||
|
|
@ -54,8 +54,11 @@ async function callLlm(messages: LlmMessage[], onToken?: (token: string) => void
|
|||
});
|
||||
return result.value.content;
|
||||
} catch (err) {
|
||||
if (err instanceof NoTierAvailableError) {
|
||||
return err.getUserMessage();
|
||||
}
|
||||
const msg = err instanceof Error ? err.message : String(err);
|
||||
return `LLM nicht verfuegbar: ${msg}`;
|
||||
return `LLM nicht verfügbar: ${msg}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue