feat: chatbot model setting + tool-calling toggle, simplify admin AI config (v0.59.0)
Chatbot (general assistant + per-recipe Q&A) now resolves its default model from its own site setting (DEFAULT_CHAT_PROVIDER/MODEL) instead of sharing the generic "text" use case with recipe generation, so admins can point it at a different model. Added AI_TOOL_CALLING_ENABLED: turns off the chatbot's createRecipe/ addToShoppingList tools (and the forced-retry pass) for models that don't reliably support tool calling — it falls back to plain text answers. Simplified the admin AI Configuration page: it showed provider keys and routing settings twice (a read-only card, then an identical edit form). Merged into one editable section; the resolved fallback provider is now a one-line note instead of its own card. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,9 @@ export type SiteSettingKey =
|
||||
| "DEFAULT_VISION_MODEL"
|
||||
| "DEFAULT_MEAL_PLAN_PROVIDER"
|
||||
| "DEFAULT_MEAL_PLAN_MODEL"
|
||||
| "DEFAULT_CHAT_PROVIDER"
|
||||
| "DEFAULT_CHAT_MODEL"
|
||||
| "AI_TOOL_CALLING_ENABLED"
|
||||
| "GITEA_URL"
|
||||
| "GITEA_TOKEN"
|
||||
| "GITEA_REPO";
|
||||
@@ -62,6 +65,9 @@ export async function getAllSiteSettings(): Promise<Record<string, { value: stri
|
||||
"DEFAULT_VISION_MODEL",
|
||||
"DEFAULT_MEAL_PLAN_PROVIDER",
|
||||
"DEFAULT_MEAL_PLAN_MODEL",
|
||||
"DEFAULT_CHAT_PROVIDER",
|
||||
"DEFAULT_CHAT_MODEL",
|
||||
"AI_TOOL_CALLING_ENABLED",
|
||||
"GITEA_URL",
|
||||
"GITEA_TOKEN",
|
||||
"GITEA_REPO",
|
||||
@@ -93,6 +99,13 @@ export async function isSignupsDisabled(): Promise<boolean> {
|
||||
return (await getSiteSetting("SIGNUPS_DISABLED")) === "true";
|
||||
}
|
||||
|
||||
/** Defaults to enabled — the chatbot's createRecipe/addToShoppingList tools
|
||||
* only get turned off explicitly, e.g. for a local model that can't reliably
|
||||
* call tools. */
|
||||
export async function isAiToolCallingEnabled(): Promise<boolean> {
|
||||
return (await getSiteSetting("AI_TOOL_CALLING_ENABLED")) !== "false";
|
||||
}
|
||||
|
||||
export async function setSiteSetting(
|
||||
key: SiteSettingKey,
|
||||
value: string | null,
|
||||
|
||||
Reference in New Issue
Block a user