feat: AI 回复说明替学生定了什么并问一个问题,“帮我写清楚”能看到题目和之前的对话
Deploy / deploy (build, debian, 22) (push) Canceled after 0s

- 生成回复分“做了什么 / 我替你定的 / 想一想”三项;只问问题时直接回答、不给代码
- 没有代码的回复发 code: null,不再清空网页;上下文保留最近一份带代码的回复
- 教练带上题目要求、最近的提问和 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:36:06 +08:00
1 parent 9fee688d95
commit 43c18cdb88
7 files changed
+155 -41

No files matched your search

+9 -2
View File
@@ -5,6 +5,7 @@ import {
canAccessTask,
codeAsMarkdown,
getOrCreateActiveConversation,
guidanceContext,
insertMessage,
} from "./services/prompt"
import {
@@ -151,7 +152,9 @@ async function handlePrompt(ws: WS, data: any) {
// 有了回复,这条提问才留下来;在后台打 L1–L6 层级
inBackground(classifyMessage(userMessageId))
ws.data.pendingUserMessageId = null
send(ws, { type: "complete", code, message_id: messageId })
// 只回答问题、没给代码的回复不是新版本;发 null,免得工作台把网页清空
const hasCode = !!(code.html || code.css || code.js)
send(ws, { type: "complete", code: hasCode ? code : null, message_id: messageId })
} finally {
dropPendingUserMessage(ws)
}
@@ -172,7 +175,11 @@ async function handleGuidance(ws: WS, data: any) {
try {
let full: string
try {
full = await streamToClient(ws, streamGuidance(ws.data.guidanceHistory, ws.data.abort.signal))
const context = guidanceContext(ws.data.conversationId, ws.data.taskId)
full = await streamToClient(
ws,
streamGuidance(ws.data.guidanceHistory, context, ws.data.abort.signal),
)
} catch (e) {
// 这条提问没有回复,留在上下文里会出现连续两条用户消息
ws.data.guidanceHistory.pop()