feat: add fixed questions and improve authentication

This commit is contained in:
吉鑫升 committed 2026-08-21 17:58:39 +08:00
1 parent 8af4fed89d
commit 4c9f75f31e
42 files changed
+4008 -200

No files matched your search

@@ -453,6 +453,11 @@ export function useStep1Intent(options: UseStep1IntentOptions): UseStep1IntentRe
(typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID()) ||
`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
// ask_clarification 是本轮的严格暂停点。某些模型在工具调用已经产出
// 选项卡后还会继续吐一段“请做选择”等正文;从第一张卡出现起忽略后续
// 文本 delta,但继续消费流以收齐同轮的其它澄清卡和终态帧。
let clarificationSeen = false;
const res = await streamIntent({
threadId: intentThreadId,
message: trimmed,
@@ -463,6 +468,7 @@ export function useStep1Intent(options: UseStep1IntentOptions): UseStep1IntentRe
files: fileRefs,
signal: aborter.signal,
onTextDelta: (delta) => {
if (clarificationSeen) return;
setInteractiveMessages((prev) =>
prev.map((m) =>
m.id === agentMsgId
@@ -505,6 +511,7 @@ export function useStep1Intent(options: UseStep1IntentOptions): UseStep1IntentRe
);
},
onClarification: (clarification, index) => {
clarificationSeen = true;
// 实时把每条澄清问题灌进气泡 —— 用户能边流边看到「协助过程」逐个出现,
// 而不是等终态帧(终态帧只带第 1 个问题)。同时往步骤链补一条
// 「追问 N:<问题>」,与「强化步骤链」诉求对齐。