changes
This commit is contained in:
@@ -466,16 +466,25 @@ export default function ChatLayout() {
|
||||
});
|
||||
const titleData = await titleRes.json();
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('[Title] API response:', titleData);
|
||||
|
||||
if (titleData.title) {
|
||||
chatTitle = titleData.title;
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('[Title] Setting chat title to:', chatTitle);
|
||||
|
||||
// Update title in database
|
||||
await fetch(`/api/chats/${savedChatId}`, {
|
||||
const patchRes = await fetch(`/api/chats/${savedChatId}`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ title: chatTitle }),
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('[Title] PATCH response status:', patchRes.status);
|
||||
|
||||
// Update title in local state
|
||||
setChats((prev) =>
|
||||
prev.map((c) => (c.id === savedChatId ? { ...c, title: chatTitle } : c))
|
||||
|
||||
Reference in New Issue
Block a user