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:
co-authored by
Claude Sonnet 4.6
parent
3869be3ccc
commit
60acbac464
@@ -13,7 +13,6 @@ import { cn } from "@/lib/utils";
|
||||
import {
|
||||
fetchConversations,
|
||||
fetchConversation,
|
||||
createConversation,
|
||||
fetchTickets,
|
||||
streamChat,
|
||||
type TicketData,
|
||||
@@ -176,22 +175,16 @@ export function GeminiChat() {
|
||||
let convId = activeConvId;
|
||||
|
||||
if (!convId) {
|
||||
// Create new conversation via API
|
||||
try {
|
||||
const title = text.length > 50 ? text.slice(0, 50) + "…" : text;
|
||||
const created = await createConversation(title);
|
||||
convId = created.id;
|
||||
const newConv: Conversation = {
|
||||
id: convId,
|
||||
title: created.title,
|
||||
messages: [userMsg],
|
||||
};
|
||||
setConversations((prev) => [newConv, ...prev]);
|
||||
setActiveConvId(convId);
|
||||
} catch {
|
||||
setIsLoading(false);
|
||||
return;
|
||||
}
|
||||
// Generate a UUID client-side; backend streamChat auto-creates the conversation
|
||||
convId = crypto.randomUUID();
|
||||
const title = text.length > 50 ? text.slice(0, 50) + "…" : text;
|
||||
const newConv: Conversation = {
|
||||
id: convId,
|
||||
title,
|
||||
messages: [userMsg],
|
||||
};
|
||||
setConversations((prev) => [newConv, ...prev]);
|
||||
setActiveConvId(convId);
|
||||
} else {
|
||||
setConversations((prev) =>
|
||||
prev.map((c) =>
|
||||
|
||||
+1
-1
@@ -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 ────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
const nextConfig = {
|
||||
output: 'export',
|
||||
typescript: {
|
||||
ignoreBuildErrors: true,
|
||||
ignoreBuildErrors: false,
|
||||
},
|
||||
images: {
|
||||
unoptimized: true,
|
||||
|
||||
Reference in New Issue
Block a user