Fix chat type persistence and board flow
This commit is contained in:
@@ -1070,15 +1070,25 @@ export async function updateChatConversationContext(
|
||||
return null;
|
||||
}
|
||||
|
||||
const currentChatTypeId = String(current.chat_type_id ?? '').trim() || null;
|
||||
const requestedChatTypeId = payload.chatTypeId?.trim() || null;
|
||||
const nextChatTypeId = currentChatTypeId || requestedChatTypeId || null;
|
||||
const requestedContextLabel = payload.contextLabel?.trim() || null;
|
||||
const requestedContextDescription = payload.contextDescription?.trim() || null;
|
||||
|
||||
await db(CHAT_CONVERSATION_TABLE)
|
||||
.where({ session_id: sessionId.trim() })
|
||||
.update({
|
||||
title: payload.title?.trim() || current.title || '새 대화',
|
||||
client_id: normalizedClientId || current.client_id || null,
|
||||
chat_type_id: payload.chatTypeId?.trim() || null,
|
||||
last_chat_type_id: payload.lastChatTypeId?.trim() || null,
|
||||
context_label: payload.contextLabel?.trim() || null,
|
||||
context_description: payload.contextDescription?.trim() || null,
|
||||
chat_type_id: nextChatTypeId,
|
||||
last_chat_type_id: nextChatTypeId || payload.lastChatTypeId?.trim() || current.last_chat_type_id || null,
|
||||
context_label:
|
||||
currentChatTypeId != null ? current.context_label || null : requestedContextLabel || current.context_label || null,
|
||||
context_description:
|
||||
currentChatTypeId != null
|
||||
? current.context_description || null
|
||||
: requestedContextDescription || current.context_description || null,
|
||||
notify_offline:
|
||||
normalizedClientId == null && payload.notifyOffline != null
|
||||
? payload.notifyOffline
|
||||
@@ -1613,14 +1623,21 @@ export async function appendChatConversationMessage(
|
||||
.update({
|
||||
client_id: normalizeClientId(conversation.clientId) || currentConversation?.client_id || null,
|
||||
title: nextTitle,
|
||||
chat_type_id: conversation.chatTypeId?.trim() || currentConversation?.chat_type_id || null,
|
||||
chat_type_id: currentConversation?.chat_type_id || conversation.chatTypeId?.trim() || null,
|
||||
last_chat_type_id:
|
||||
conversation.chatTypeId?.trim() ||
|
||||
currentConversation?.last_chat_type_id ||
|
||||
currentConversation?.chat_type_id ||
|
||||
currentConversation?.last_chat_type_id ||
|
||||
conversation.chatTypeId?.trim() ||
|
||||
conversation.lastChatTypeId?.trim() ||
|
||||
null,
|
||||
context_label: conversation.contextLabel?.trim() || currentConversation?.context_label || null,
|
||||
context_description: conversation.contextDescription?.trim() || currentConversation?.context_description || null,
|
||||
context_label:
|
||||
currentConversation?.chat_type_id || currentConversation?.context_label
|
||||
? currentConversation?.context_label || null
|
||||
: conversation.contextLabel?.trim() || null,
|
||||
context_description:
|
||||
currentConversation?.chat_type_id || currentConversation?.context_description
|
||||
? currentConversation?.context_description || null
|
||||
: conversation.contextDescription?.trim() || null,
|
||||
notify_offline:
|
||||
conversation.notifyOffline == null ? Boolean(currentConversation?.notify_offline) : conversation.notifyOffline,
|
||||
updated_at: db.fn.now(),
|
||||
|
||||
Reference in New Issue
Block a user