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
@@ -25,6 +25,36 @@ test('normalizeSort accepts recommend, hot, or new', () => {
assert.equal(plazaInternals.normalizeSort('recommended'), 'recommend');
});
test('defaultPlazaCoverUrl derives a thumbnail png from publication url', () => {
assert.equal(
plazaInternals.defaultPlazaCoverUrl('/u/john/pages/demo'),
'/u/john/pages/demo.thumbnail.png',
);
assert.equal(
plazaInternals.defaultPlazaCoverUrl('/u/john/pages/demo?embed=plaza'),
'/u/john/pages/demo.thumbnail.png?embed=plaza',
);
assert.equal(
plazaInternals.defaultPlazaCoverUrl('/u/john/pages/demo/'),
'/u/john/pages/demo/index.thumbnail.png',
);
});
test('resolvePlazaCoverUrl prefers explicit cover urls and falls back to publication thumbnail', () => {
assert.equal(
plazaInternals.resolvePlazaCoverUrl(' https://cdn.example.com/cover.png ', '/u/john/pages/demo'),
'https://cdn.example.com/cover.png',
);
assert.equal(
plazaInternals.resolvePlazaCoverUrl('/u/john/pages/demo.thumbnail.png', 'https://example.com/u/john/pages/demo'),
'https://example.com/u/john/pages/demo.thumbnail.png',
);
assert.equal(
plazaInternals.resolvePlazaCoverUrl('', '/u/john/pages/demo'),
'/u/john/pages/demo.thumbnail.png',
);
});
test('mapPlazaError maps documented API codes', () => {
assert.equal(mapPlazaError({ code: 'ALREADY_PUBLISHED' }), 409);
assert.equal(mapPlazaError({ code: 'PUBLICATION_NOT_ONLINE' }), 422);