From cb56a016227b7404d6bccccb563df58e122ab7bd Mon Sep 17 00:00:00 2001 From: kuaifan Date: Wed, 21 Jan 2026 04:06:40 +0000 Subject: [PATCH] fix(ai): fix URL parsing for ai-apply/ai-dismiss links The regex pattern (\w+) didn't match 'ai-apply' or 'ai-dismiss' because \w doesn't include hyphens, causing all AI suggestion buttons to fail. Fix by handling AI links before the regex match using startsWith(). Remove dead switch cases that were never reached. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- .../manage/components/DialogMarkdown.vue | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/resources/assets/js/pages/manage/components/DialogMarkdown.vue b/resources/assets/js/pages/manage/components/DialogMarkdown.vue index f42aa8453..5a00d56f1 100644 --- a/resources/assets/js/pages/manage/components/DialogMarkdown.vue +++ b/resources/assets/js/pages/manage/components/DialogMarkdown.vue @@ -94,8 +94,19 @@ export default { * 处理 dootask:// 协议链接 * 格式: dootask://type/id 或 dootask://type/id1/id2 * 文件链接支持: dootask://file/123 (数字ID) 或 dootask://file/OSwxLHY3ZlN2R245 (base64编码) + * AI 建议链接: dootask://ai-apply/{type}/{task_id}/{msg_id} 或 dootask://ai-dismiss/... */ handleDooTaskLink(href) { + // 优先处理 AI 建议链接(格式与其他类型不同) + if (href.startsWith('dootask://ai-apply/')) { + this.handleAiApply(href); + return; + } + if (href.startsWith('dootask://ai-dismiss/')) { + this.handleAiDismiss(href); + return; + } + const match = href.match(/^dootask:\/\/(\w+)\/([^/]+)(?:\/(\d+))?$/); if (!match) { return; @@ -146,14 +157,6 @@ export default { $A.modalError(msg); }); break; - - case 'ai-apply': - this.handleAiApply(href); - break; - - case 'ai-dismiss': - this.handleAiDismiss(href); - break; } },