|
|
@@ -162,9 +162,25 @@ console.log('\n【5】result.cipa → 企业微信二维码块(<image-scope>
|
|
|
const text = seen_message_text(shown);
|
|
|
check('cipa=true → 追加 <image-scope> 块', /<image-scope>[\s\S]*?<\/image-scope>/.test(text), text.slice(-120));
|
|
|
check('块里有非空的图片地址', /<image-scope>\s*\S[^\n]*\s*<\/image-scope>/.test(text));
|
|
|
- check('图片块在整条内容的**最末尾**(正文之后)', text.trimEnd().endsWith('</image-scope>'));
|
|
|
check('正文本身没被污染(正文仍在最前面)', text.trimStart().startsWith('这是回答正文。'), text.slice(0, 40));
|
|
|
|
|
|
+ // 位置:正文 → 二维码 → 参考资料(用户 2026-09-20 指定「二维码放在参考资料之前」)
|
|
|
+ const withSources = await runTurn([
|
|
|
+ ...BASE_EVENTS,
|
|
|
+ // 参考资料块要求来源**有链接**(见 buildRefLinksContent 的 filter)
|
|
|
+ ['source', { id: 's1', title: '测试政策', type: 'policy', source: { url: 'https://example.com/p1' } }],
|
|
|
+ ['result', { response: '这是回答正文。', cipa: true }],
|
|
|
+ ['done', { status: 'completed' }],
|
|
|
+ ]);
|
|
|
+ const ordered = seen_message_text(withSources);
|
|
|
+ const qrAt = ordered.indexOf('<image-scope>');
|
|
|
+ const refAt = ordered.indexOf('<ref_links');
|
|
|
+ const bodyAt = ordered.indexOf('这是回答正文。');
|
|
|
+ check('这一轮确实有参考资料块(否则位置断言无意义)', refAt > -1, ordered.slice(-160));
|
|
|
+ check('二维码在**参考资料之前**', qrAt > -1 && refAt > -1 && qrAt < refAt, { qrAt, refAt });
|
|
|
+ check('二维码在正文之后', bodyAt > -1 && qrAt > bodyAt, { bodyAt, qrAt });
|
|
|
+ check('参考资料仍排在整条内容的最末尾', ordered.trimEnd().endsWith('</ref_links>'));
|
|
|
+
|
|
|
const off = await runTurn([
|
|
|
...BASE_EVENTS,
|
|
|
['result', { response: '这是回答正文。', cipa: false }],
|