fix(webui): add spring feedback at the history boundary (#6322)
* fix(webui): add spring feedback at the history boundary Refs NAN-287. * fix(webui): refine history boundary states and retry feedback * fix(webui): share history loading states with subagents
This commit is contained in:
1 parent
a1bca7dc50
commit
816c9221a0
27 files changed
+910
-209
No files matched your search
@@ -105,7 +105,7 @@ function SubagentPreview() {
|
||||
return <div className="space-y-4">
|
||||
<StatePicker label="子任务会话状态" value={mode} options={["ready", "running", "loading", "error"]} onChange={setMode} />
|
||||
<div className="max-h-96 overflow-y-auto rounded-control border py-4">
|
||||
<SubagentThreadView messages={messages} loading={mode === "loading"} failed={mode === "error"} isStreaming={mode === "running"}
|
||||
<SubagentThreadView messages={messages} loading={mode === "loading"} error={mode === "error" ? "示例历史加载失败。" : null} isStreaming={mode === "running"}
|
||||
activeTurnId={mode === "running" ? "gallery-child-turn" : null} runStartedAt={startedAt / 1000}
|
||||
onRetry={() => { setRetries((value) => value + 1); setMode("ready"); }} />
|
||||
</div>
|
||||
@@ -124,6 +124,6 @@ export const contentExamples: ComponentExample[] = [
|
||||
description: "查看任务列表,编辑、停用和删除任务,并切换加载和错误状态。", options: "jobs、loading、loadFailed 和 now 来自调用方;onAction 与 onEdit 返回更新后的任务快照;界面负责弹窗衔接、焦点恢复和操作反馈。",
|
||||
code: '<SessionInfoPopoverView title={title} jobs={jobs} loading={loading} loadFailed={failed} now={now} onAction={act} onEdit={edit} onOpenCalendar={openCalendar} />' },
|
||||
{ title: "SubagentThreadView · 子任务消息", files: ["webui/src/components/thread/SubagentThreadView.tsx"], Preview: SubagentPreview,
|
||||
description: "查看子任务消息、推理活动、加载和失败状态,试用重试回调。", options: "messages 已由运行时投影;loading 和 failed 控制提示;isStreaming 与 activeTurnId 决定当前活动。界面不获取任务历史。",
|
||||
code: '<SubagentThreadView messages={messages} loading={loading} failed={failed} isStreaming={running} runStartedAt={startedAt} onRetry={retry} />' },
|
||||
description: "查看子任务消息、推理活动、加载和失败状态,试用重试回调。", options: "messages 已由运行时投影;loading 和 error 复用历史加载组件;isStreaming 与 activeTurnId 决定当前活动。界面不获取任务历史。",
|
||||
code: '<SubagentThreadView messages={messages} loading={loading} error={error} isStreaming={running} runStartedAt={startedAt} onRetry={retry} />' },
|
||||
];
|
||||
@@ -173,13 +173,13 @@ function ViewportPreview() {
|
||||
}
|
||||
|
||||
function HistoryPreview() {
|
||||
const [mode, setMode] = useState<"loading" | "error" | "pulling">("error");
|
||||
const [mode, setMode] = useState<"loading" | "error" | "exhausted">("loading");
|
||||
const [retries, setRetries] = useState(0);
|
||||
return <div className="space-y-4">
|
||||
<StatePicker label="历史加载状态" value={mode} options={["loading", "error", "pulling"]} onChange={setMode} />
|
||||
<StatePicker label="历史状态" value={mode} options={["loading", "exhausted", "error"]} onChange={setMode} />
|
||||
<div className="relative h-20 rounded-control border">
|
||||
<ThreadHistoryStatus loading={mode === "loading"} error={mode === "error" ? "Example history unavailable" : null}
|
||||
pullDistance={mode === "pulling" ? 32 : 0} onRetry={() => { setRetries((value) => value + 1); setMode("loading"); }} />
|
||||
exhausted={mode === "exhausted"} onRetry={() => { setRetries((value) => value + 1); setMode("loading"); }} />
|
||||
</div>
|
||||
<p role="status" className="text-sm text-muted-foreground">重试次数:{retries}</p>
|
||||
</div>;
|
||||
@@ -298,8 +298,8 @@ export const conversationExamples: ComponentExample[] = [
|
||||
{ title: "ThreadViewport · 会话滚动", files: ["thread/ThreadViewport", "thread/PromptRail"], Preview: ViewportPreview,
|
||||
description: "真实长会话滚动区,包含问题标记、导航跳转和返回底部。", options: "固定预览容器高度;messages 驱动历史显示,ref.jumpToUserPrompt 执行定位;emptyState 提供空会话内容。",
|
||||
code: '<div className="flex h-96 flex-col"><ThreadViewport ref={viewport} messages={messages} isStreaming={false} /></div>' },
|
||||
{ title: "ThreadHistoryStatus · 历史加载", files: ["thread/ThreadHistoryStatus"], Preview: HistoryPreview,
|
||||
description: "切换加载、失败和下拉状态,并试用重试按钮。", options: "loading 控制加载指示,error 控制错误提示,pullDistance 控制下拉位置,onRetry 由调用方提供。",
|
||||
{ title: "ThreadHistoryStatus · 历史状态", files: ["thread/ThreadHistoryStatus"], Preview: HistoryPreview,
|
||||
description: "显示加载、历史起点与失败重试状态。", options: "loading 表示正在请求,exhausted 表示没有更早消息,error 提供报错信息,onRetry 重试加载。",
|
||||
code: '<ThreadHistoryStatus loading={loading} error={error} onRetry={retry} />' },
|
||||
{ title: "RecoveryNotice · 任务恢复", files: ["thread/RecoveryNotice"], Preview: RecoveryPreview,
|
||||
description: "切换中断、恢复、失败和无法继续状态,试用继续与关闭。", options: "state 为已有恢复快照;onContinue 与 onDismiss 返回 Promise。示例回调只更新当前预览。",
|
||||
|
||||
Reference in new issue
Block a user