Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix: 诊断预填按正文语义判断草稿是否为空
Dash32e0507a490e
diff --git a/apps/desktop/src/renderer/components/chat/__tests__/ErrorLocalization.test.tsx b/apps/desktop/src/renderer/components/chat/__tests__/ErrorLocalization.test.tsxindex 0f19b6c287..469621c44c 100644--- a/apps/desktop/src/renderer/components/chat/__tests__/ErrorLocalization.test.tsx+++ b/apps/desktop/src/renderer/components/chat/__tests__/ErrorLocalization.test.tsx@@ -63,7 +63,9 @@ it('appends the diagnosis prompt to an unsent new-task draft instead of replacinexpect(getNewMakerDraft().workingDir).toBe('/tmp/my-project');expect(getNewMakerDraft().extraDirs).toEqual(['/tmp/extra']);clearDraft(NEW_MAKER_DRAFT_KEY);- // 空草稿则复位工作区目标,残留的目录授权不带进诊断任务。+ // 用户清空输入框后 Tiptap 仍留一个空段落:按空草稿处理,复位工作区目标,残留的目录授权不带进诊断任务。+ patchDraft({ workingDir: '/tmp/my-project', extraDirs: ['/tmp/extra'] });+ saveDraft(NEW_MAKER_DRAFT_KEY, { text: { type: 'doc', content: [{ type: 'paragraph' }] }, attachments: [] });prefillErrorDiagnosisDraft('请帮我诊断这个错误');expect(getNewMakerDraft().extraDirs).toEqual([]);expect(getNewMakerDraft().workingDir).toBeNull();diff --git a/apps/desktop/src/renderer/lib/errorDiagnosisPrompt.ts b/apps/desktop/src/renderer/lib/errorDiagnosisPrompt.tsindex 2c34998f92..e1f6ae9920 100644--- a/apps/desktop/src/renderer/lib/errorDiagnosisPrompt.ts+++ b/apps/desktop/src/renderer/lib/errorDiagnosisPrompt.ts@@ -7,7 +7,12 @@import type { TFunction } from 'i18next';import { redactSensitiveText } from '@cindy/maker-shared/error-redaction';import { NEW_MAKER_DRAFT_KEY } from '@/features/cc-agent/newMakerDraftKeys';-import { getDraft, plainTextToTiptapDoc, saveDraft } from '@/lib/composerDraftStore';+import {+ draftHasContent,+ getDraft,+ plainTextToTiptapDoc,+ saveDraft,+} from '@/lib/composerDraftStore';import { resetDraftWorkspaceTargets } from '@/state/newMakerDraft';export interface ErrorDiagnosisSource {@@ -40,12 +45,8 @@ export function prefillErrorDiagnosisDraft(prompt: string): void {const existing = getDraft(NEW_MAKER_DRAFT_KEY);const added = plainTextToTiptapDoc(prompt);const existingContent = existing?.text?.content ?? [];- const hasUnsent =- existingContent.length > 0 ||- (existing?.attachments.length ?? 0) > 0 ||- (existing?.browserComments?.length ?? 0) > 0 ||- (existing?.quotes?.length ?? 0) > 0;- if (existing && hasUnsent) {+ // 与侧边栏「未发送」标记同一判据:清空后残留的空段落不算内容。+ if (existing && draftHasContent(existing)) {// 用户自己的未发送草稿:工作区目标(项目、远程电脑、额外授权目录)也属于它,原样保留。saveDraft(NEW_MAKER_DRAFT_KEY, {...existing,