Skip to content

Commit 3a5f903

Browse files
bennyliiDeepSeek V4 Pro
andcommitted
修复 Kimi 对话结束后未销毁对话的问题
forwarder.ts 中 realChatId.startsWith('kimi-') 的守卫误杀了服务端 返回的合法 chat ID,导致 deleteConversation 从未执行。 移除该守卫,getConversationId() 已正确处理空值情况。 同时清理 kimi.ts 中 getConversationId() 的死代码(conversationId 始终为空字符串,fallback 路径永远不会触发)。 Co-Authored-By: DeepSeek V4 Pro <noreply@deepseek.com>
1 parent 3ce9a4b commit 3a5f903

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

src/main/proxy/adapters/kimi.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -426,15 +426,9 @@ export class KimiStreamHandler {
426426
}
427427

428428
getConversationId(): string | null {
429-
// Return realChatId if available, otherwise return null (not empty string)
430-
// to prevent saving invalid session IDs
431429
if (this.realChatId) {
432430
return this.realChatId
433431
}
434-
// Only return conversationId if it's a valid ID (not empty and not a temporary ID)
435-
if (this.conversationId && this.conversationId.length > 0 && !this.conversationId.startsWith('kimi-')) {
436-
return this.conversationId
437-
}
438432
return null
439433
}
440434

src/main/proxy/forwarder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ CRITICAL RULES:
828828
const originalEnd = transformedStream.end.bind(transformedStream)
829829
transformedStream.end = function(chunk?: any, encoding?: any, callback?: any) {
830830
const realChatId = handler.getConversationId()
831-
if (realChatId && realChatId.startsWith('kimi-') === false) {
831+
if (realChatId) {
832832
adapter.deleteConversation(realChatId).catch(err => {
833833
console.error('[Kimi] Failed to delete conversation:', err)
834834
})
@@ -854,7 +854,7 @@ CRITICAL RULES:
854854

855855
if (shouldDeleteSession()) {
856856
const realChatId = handler.getConversationId()
857-
if (realChatId && realChatId.startsWith('kimi-') === false) {
857+
if (realChatId) {
858858
await adapter.deleteConversation(realChatId)
859859
}
860860
}

0 commit comments

Comments
 (0)