From 7d0b8b33afff5a6c4acce7df98f919af8d585a8c Mon Sep 17 00:00:00 2001 From: lizhixuan Date: Sat, 10 May 2025 10:52:08 +0800 Subject: [PATCH] refactor(messageThunk): remove console.log statements for cleaner code --- src/renderer/src/store/thunk/messageThunk.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/renderer/src/store/thunk/messageThunk.ts b/src/renderer/src/store/thunk/messageThunk.ts index bfb68de0c0..5dd8d5984d 100644 --- a/src/renderer/src/store/thunk/messageThunk.ts +++ b/src/renderer/src/store/thunk/messageThunk.ts @@ -91,7 +91,7 @@ const updateExistingMessageAndBlocksInDB = async ( const newMessages = [...topic.messages] // Apply the updates passed in updatedMessage Object.assign(newMessages[messageIndex], updatedMessage) - console.log('updateExistingMessageAndBlocksInDB', updatedMessage) + // console.log('updateExistingMessageAndBlocksInDB', updatedMessage) await db.topics.update(updatedMessage.topicId, { messages: newMessages }) } else { console.error(`[updateExistingMsg] Message ${updatedMessage.id} not found in topic ${updatedMessage.topicId}`) @@ -155,7 +155,6 @@ const saveUpdatesToDB = async ( messageUpdates: Partial, // 需要更新的消息字段 blocksToUpdate: MessageBlock[] // 需要更新/创建的块 ) => { - console.log('messageUpdates', messageUpdates) try { const messageDataToSave: Partial & Pick = { id: messageId, @@ -283,12 +282,7 @@ const fetchAndProcessAssistantResponseImpl = async ( const currentState = getState() const updatedMessage = currentState.messages.entities[assistantMsgId] if (updatedMessage) { - await saveUpdatesToDB( - assistantMsgId, - topicId, - { blocks: updatedMessage.blocks, status: updatedMessage.status }, - [newBlock] - ) + await saveUpdatesToDB(assistantMsgId, topicId, { blocks: updatedMessage.blocks }, [newBlock]) } else { console.error(`[handleBlockTransition] Failed to get updated message ${assistantMsgId} from state for DB save.`) } @@ -640,7 +634,6 @@ const fetchAndProcessAssistantResponseImpl = async ( updates: messageUpdates }) ) - console.log('onComplete: saveUpdatesToDB', messageUpdates) saveUpdatesToDB(assistantMsgId, topicId, messageUpdates, []) EventEmitter.emit(EVENT_NAMES.MESSAGE_COMPLETE, { id: assistantMsgId, topicId, status }) @@ -1109,7 +1102,7 @@ export const initiateTranslationThunk = export const updateTranslationBlockThunk = (blockId: string, accumulatedText: string, isComplete: boolean = false) => async (dispatch: AppDispatch) => { - console.log(`[updateTranslationBlockThunk] 更新翻译块 ${blockId}, isComplete: ${isComplete}`) + // console.log(`[updateTranslationBlockThunk] 更新翻译块 ${blockId}, isComplete: ${isComplete}`) try { const status = isComplete ? MessageBlockStatus.SUCCESS : MessageBlockStatus.STREAMING const changes: Partial = { @@ -1122,7 +1115,7 @@ export const updateTranslationBlockThunk = // 更新数据库 await db.message_blocks.update(blockId, changes) - console.log(`[updateTranslationBlockThunk] Successfully updated translation block ${blockId}.`) + // console.log(`[updateTranslationBlockThunk] Successfully updated translation block ${blockId}.`) } catch (error) { console.error(`[updateTranslationBlockThunk] Failed to update translation block ${blockId}:`, error) }