feat: add Opus/Sonnet model selector to "Genera preventivo" page

Adds a "Modello AI" toggle (Opus default, Sonnet option) styled like the
existing Soggetto toggle. The server action validates the keyword and maps
it to the real model id; the agent receives the resolved id and uses it in
the Anthropic messages.create call. The proposals DB record stores the
actual model used.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-25 15:34:04 +02:00
parent e10d1f70cb
commit 0b8a7b3809
3 changed files with 49 additions and 5 deletions
+2 -1
View File
@@ -11,6 +11,7 @@ type AgentInput = {
client?: Pick<Client, "id" | "name" | "brand_name" | "brief">;
transcripts: Pick<ClientTranscript, "title" | "content" | "call_date">[];
offer: OfferEditorData;
model?: string;
};
function buildSystemPrompt(): string {
@@ -128,7 +129,7 @@ export async function generateProposalContent(
const client = new Anthropic({ apiKey });
const message = await client.messages.create({
model: MODEL,
model: input.model ?? MODEL,
max_tokens: 8192,
system: buildSystemPrompt(),
messages: [{ role: "user", content: buildUserPrompt(input) }],