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:
Arnaud
2026-07-20 21:14:04 +02:00
parent f6975e98a9
commit 623e5bcd34
10 changed files with 120 additions and 113 deletions
+2 -1
View File
@@ -3,12 +3,13 @@ import { decrypt } from "@/lib/encrypt";
import { getSiteSetting, type SiteSettingKey } from "@/lib/site-settings";
import type { AiConfig, AiProvider } from "./factory";
export type ModelUseCase = "text" | "vision" | "mealPlan";
export type ModelUseCase = "text" | "vision" | "mealPlan" | "chat";
const USE_CASE_SITE_DEFAULTS: Record<ModelUseCase, { provider: SiteSettingKey; model: SiteSettingKey }> = {
text: { provider: "DEFAULT_TEXT_PROVIDER", model: "DEFAULT_TEXT_MODEL" },
vision: { provider: "DEFAULT_VISION_PROVIDER", model: "DEFAULT_VISION_MODEL" },
mealPlan: { provider: "DEFAULT_MEAL_PLAN_PROVIDER", model: "DEFAULT_MEAL_PLAN_MODEL" },
chat: { provider: "DEFAULT_CHAT_PROVIDER", model: "DEFAULT_CHAT_MODEL" },
};
const PROVIDER_API_KEY_SETTING: Record<AiProvider, SiteSettingKey | null> = {