Add smart ACK provider for WeChat MP replies

Replace fixed ackText with a rule-based AckProvider that picks
response templates by message type and intent (translate, summary,
rewrite, poster, ppt, mindmap, code, search, schedule). Pure sync,
zero I/O, auto-falls back to config.ackText on any error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
john
2026-06-26 15:19:03 +08:00
parent 9ed4fd48d7
commit 9b4a25799f
162 changed files with 17276 additions and 2054 deletions
+30
View File
@@ -0,0 +1,30 @@
import { shouldUseScheduleAssistant } from '../../schedule-intent.mjs';
const INTENT_RULES = [
{ task: 'translate', pattern: /翻译|译成|translate/i },
{ task: 'summary', pattern: /总结|概括|摘要|提炼|归纳/ },
{ task: 'rewrite', pattern: /改写|润色|优化文|帮我写|写一[篇封份个]/ },
{ task: 'poster', pattern: /海报|宣传图|banner/i },
{ task: 'ppt', pattern: /ppt|PPT|幻灯片/ },
{ task: 'mindmap', pattern: /思维导图|脑图/ },
{ task: 'code', pattern: /代码|写个函数|写个方法|debug|报错|bug/i },
{ task: 'search', pattern: /查一下|搜索|帮我找|查找/ },
];
export function resolveIntent(msgType, text) {
if (msgType === 'image') return { task: 'image_analysis' };
if (msgType === 'voice') return { task: 'voice_analysis' };
if (msgType === 'location') return { task: 'location' };
if (msgType === 'link') return { task: 'link' };
const t = String(text ?? '').trim();
if (!t) return { task: 'unknown' };
if (shouldUseScheduleAssistant(t)) return { task: 'schedule' };
for (const rule of INTENT_RULES) {
if (rule.pattern.test(t)) return { task: rule.task };
}
return { task: 'unknown' };
}