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
+33
View File
@@ -0,0 +1,33 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { createScheduleService } from './schedule-service.mjs';
test('listUserNotifications accepts mysql JSON columns returned as objects', async () => {
const service = createScheduleService({
async query(sql) {
assert.match(sql, /FROM h5_user_notifications/);
return [
[
{
id: 'notification-1',
user_id: 'user-1',
channel: 'wechat',
notification_type: 'balance_low',
title: '余额不足提醒',
body: '你的账户余额已低于 20.00 元,请及时充值。',
data_json: { thresholdCents: 2000 },
status: 'unread',
read_at: null,
created_at: 1782313300000,
updated_at: 1782313300000,
},
],
];
},
});
const notifications = await service.listUserNotifications({ userId: 'user-1' });
assert.equal(notifications.length, 1);
assert.deepEqual(notifications[0].data, { thresholdCents: 2000 });
});