feat: 挑战的题目要求发给 AI 当对照清单,学生没提到的不替他做,在“想一想”里问
Deploy / deploy (build, debian, 22) (push) Canceled after 0s

学生不用再整段贴题目;AI 只做学生说了的,从没提到的要求里挑一项问他打算怎么做。
整段贴了题目的照做。自由创作的题目是学生自己写的,不发。输入框提示改成“用你自己的话说说”。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-27 21:40:04 +08:00
1 parent 43c18cdb88
commit 5bdacc438d
6 files changed
+55 -9

No files matched your search

+21
View File
@@ -192,6 +192,27 @@ describe("WebSocket 代码生成", () => {
c.ws.close()
})
test("挑战的题目要求作为对照清单发给 AI,自由创作不发", async () => {
const { task, token } = await setup()
run(`UPDATE task_task SET content = $c WHERE id = $id`, { c: "做一个计时器,有开始和暂停按钮", id: task })
const c = (await connect(`/ws/prompt/${task}/?token=${token}`))!
await c.next("init")
c.ws.send(JSON.stringify({ type: "message", content: "做个页面" }))
await c.next("complete")
expect(lastRequest.messages[0].content).toContain("它是对照清单")
expect(lastRequest.messages[0].content).toContain("题目要求:做一个计时器,有开始和暂停按钮")
c.ws.close()
const creation = makeTask("我的作品", "creation", 2)
run(`UPDATE task_task SET content = '我想做一个相册' WHERE id = $id`, { id: creation })
const d = (await connect(`/ws/prompt/${creation}/?token=${token}`))!
await d.next("init")
d.ws.send(JSON.stringify({ type: "message", content: "做个页面" }))
await d.next("complete")
expect(lastRequest.messages[0].content).not.toContain("题目要求")
d.ws.close()
})
test("token 无效或任务不存在时握手失败", async () => {
const { task, token } = await setup()
expect(await connect(`/ws/prompt/${task}/?token=bad`)).toBeNull()