Fix 3 P0 issues from code review

FCR-1: Set ignoreBuildErrors to false in next.config.mjs
FCR-2: Default API_URL to production backend so static builds work correctly;
       .env.local overrides to localhost for local dev
FCR-3: Remove createConversation call in handleSend; generate UUID client-side
       and let backend streamChat auto-create the conversation to avoid duplicate writes

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gongzhiyong
2026-04-08 16:21:33 +08:00
co-authored by Claude Sonnet 4.6
parent 3869be3ccc
commit 60acbac464
3 changed files with 12 additions and 19 deletions
+10 -17
View File
@@ -13,7 +13,6 @@ import { cn } from "@/lib/utils";
import { import {
fetchConversations, fetchConversations,
fetchConversation, fetchConversation,
createConversation,
fetchTickets, fetchTickets,
streamChat, streamChat,
type TicketData, type TicketData,
@@ -176,22 +175,16 @@ export function GeminiChat() {
let convId = activeConvId; let convId = activeConvId;
if (!convId) { if (!convId) {
// Create new conversation via API // Generate a UUID client-side; backend streamChat auto-creates the conversation
try { convId = crypto.randomUUID();
const title = text.length > 50 ? text.slice(0, 50) + "…" : text; const title = text.length > 50 ? text.slice(0, 50) + "…" : text;
const created = await createConversation(title); const newConv: Conversation = {
convId = created.id; id: convId,
const newConv: Conversation = { title,
id: convId, messages: [userMsg],
title: created.title, };
messages: [userMsg], setConversations((prev) => [newConv, ...prev]);
}; setActiveConvId(convId);
setConversations((prev) => [newConv, ...prev]);
setActiveConvId(convId);
} catch {
setIsLoading(false);
return;
}
} else { } else {
setConversations((prev) => setConversations((prev) =>
prev.map((c) => prev.map((c) =>
+1 -1
View File
@@ -1,4 +1,4 @@
const API_URL = process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8000"; const API_URL = process.env.NEXT_PUBLIC_API_URL ?? "https://soc-backend.azurewebsites.net";
// ── Conversations ──────────────────────────────────────────────────────────── // ── Conversations ────────────────────────────────────────────────────────────
+1 -1
View File
@@ -2,7 +2,7 @@
const nextConfig = { const nextConfig = {
output: 'export', output: 'export',
typescript: { typescript: {
ignoreBuildErrors: true, ignoreBuildErrors: false,
}, },
images: { images: {
unoptimized: true, unoptimized: true,