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 {
|
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);
|
|
||||||
convId = created.id;
|
|
||||||
const newConv: Conversation = {
|
const newConv: Conversation = {
|
||||||
id: convId,
|
id: convId,
|
||||||
title: created.title,
|
title,
|
||||||
messages: [userMsg],
|
messages: [userMsg],
|
||||||
};
|
};
|
||||||
setConversations((prev) => [newConv, ...prev]);
|
setConversations((prev) => [newConv, ...prev]);
|
||||||
setActiveConvId(convId);
|
setActiveConvId(convId);
|
||||||
} catch {
|
|
||||||
setIsLoading(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
setConversations((prev) =>
|
setConversations((prev) =>
|
||||||
prev.map((c) =>
|
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 ────────────────────────────────────────────────────────────
|
// ── Conversations ────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
output: 'export',
|
output: 'export',
|
||||||
typescript: {
|
typescript: {
|
||||||
ignoreBuildErrors: true,
|
ignoreBuildErrors: false,
|
||||||
},
|
},
|
||||||
images: {
|
images: {
|
||||||
unoptimized: true,
|
unoptimized: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user