添加对话记录保存详细日志,诊断conversation_id传递问题
添加日志位置: 1. chat/index.tsx: 发送消息、接收会话ID变更、初始化读取localStorage 2. use-chat-message.ts: 发送消息、接收新会话ID、处理新会话 3. use-conversation.ts: setCurrConversationId保存到localStorage 帮助诊断为什么对话记录没有固定(每次都创建新会话) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -113,6 +113,13 @@ export default function useConversation() {
|
||||
isSetToLocalStorage = true,
|
||||
newConversationName = ''
|
||||
) => {
|
||||
console.log('💾 [useConversation] setCurrConversationId:', {
|
||||
id,
|
||||
appId,
|
||||
isSetToLocalStorage,
|
||||
willSaveToStorage: isSetToLocalStorage && id !== '-1'
|
||||
});
|
||||
|
||||
doSetCurrConversationId(id);
|
||||
|
||||
if (isSetToLocalStorage && id !== '-1') {
|
||||
@@ -128,8 +135,14 @@ export default function useConversation() {
|
||||
|
||||
globalThis.localStorage?.setItem(storageConversationIdKey, JSON.stringify(conversationIdInfo));
|
||||
|
||||
console.log('✅ [useConversation] 已保存到localStorage:', {
|
||||
appUrlKey,
|
||||
conversationId: id,
|
||||
allKeys: Object.keys(conversationIdInfo)
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error('保存会话ID到本地存储失败:', error);
|
||||
console.error('❌ [useConversation] 保存会话ID到本地存储失败:', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user