fix: render consultation replies and typed tool activity
This commit is contained in:
1 parent
a628860144
commit
97837cef90
19 files changed
+432
-35
No files matched your search
@@ -176,6 +176,20 @@ describe('teacher discussion model envelope', () => {
|
||||
.toEqual({ reply: '柯基、冒险和菜园都是好点子。', quickReplies: [] });
|
||||
});
|
||||
|
||||
it.each([
|
||||
'[项目说明](https://example.com/readme)\n\n先看已有设计。',
|
||||
'[1, 2, 3]',
|
||||
'[{"reply":"普通数组示例"}]',
|
||||
'```json\nnot valid json\n```',
|
||||
'{"scripts":{"dev":"vite"},"name":"flybot"}',
|
||||
'项目配置可以这样写:\n\n```json\n{"name":"flybot","scripts":{"dev":"vite"}}\n```',
|
||||
'```json\n[{"id":1,"label":"入口"}]\n```',
|
||||
'{"example":{"reply":"这是数据字段,不是回答协议"}}',
|
||||
'```js\nconst example = {"reply":"代码示例"};\n```',
|
||||
])('preserves Markdown links and JSON examples as readable content: %s', raw => {
|
||||
expect(parseTeacherDiscussionReply(raw)).toEqual({ reply: raw, quickReplies: [] });
|
||||
});
|
||||
|
||||
it('distinguishes an absent tool from an explicit null and supports a tool-only envelope', () => {
|
||||
expect(parseTeacherDiscussionReply('{"reply":"这轮只解释一下。"}'))
|
||||
.toEqual({ reply: '这轮只解释一下。', quickReplies: [] });
|
||||
@@ -213,8 +227,7 @@ describe('teacher discussion model envelope', () => {
|
||||
'{"reply":"还没有说完',
|
||||
'{"tool":{"reply":"不能拿嵌套结构充当正文"},',
|
||||
'```json\n{"tool":{"secret":"raw-data"}}',
|
||||
'```json\nnot valid json\n```',
|
||||
'[{"reply":"不是合法 envelope"}]',
|
||||
'```makelore-teacher-discussion\nnot valid json\n```',
|
||||
'{"reply":13,"tool":{"kind":"html"}}',
|
||||
'```json\n{"reply":"结束"}\n```\n```json\n{"reply":"第二个"}\n```',
|
||||
])('never exposes malformed JSON as the student reply: %s', raw => {
|
||||
|
||||
Reference in new issue
Block a user