加载框样式
This commit is contained in:
1 parent
545ec178b8
commit
7d32b41e90
1 file changed
+58
-1
@@ -296,6 +296,10 @@ export default function RoundtablePlanningPage() {
|
||||
const [taskRestoreResolved, setTaskRestoreResolved] = useState<boolean>(
|
||||
!prefillRef.current?.taskId,
|
||||
);
|
||||
// 深链/预填自动会话:进入页面后要先建意图线程、(带 taskId 时)回显历史草稿,这段时间
|
||||
// 页面只有一句欢迎语、问答还没真正开始,线程创建慢时像卡住。下面这个标志用来在超时后
|
||||
// 强制撤掉「启动加载遮罩」,避免万一初始化卡死把界面永久锁住。
|
||||
const [bootLoadingExpired, setBootLoadingExpired] = useState<boolean>(false);
|
||||
|
||||
const { models: availableModels, isLoading: modelsLoading } = useModels();
|
||||
|
||||
@@ -1143,6 +1147,35 @@ export default function RoundtablePlanningPage() {
|
||||
};
|
||||
}, []);
|
||||
|
||||
// ── 启动加载遮罩(深链/预填自动会话)──────────────────────────────
|
||||
// 是否是「自动会话」:深链 -A、taskId、businessCode/chainId 任一存在即自动进入问答,
|
||||
// 用户没有手动操作,进入页面到问答之间必须给出明确加载反馈。
|
||||
const isAutoSession = Boolean(
|
||||
prefillRef.current?.autoStart ||
|
||||
prefillRef.current?.taskId ||
|
||||
prefillRef.current?.businessCode ||
|
||||
prefillRef.current?.chainId,
|
||||
);
|
||||
// 「问答已开始」:自动发出的首条用户消息已入列 / 正在流式 / 已得到意图结果,任一为真即认为
|
||||
// 已经动起来,可以撤掉遮罩交给 Step1Panel 自身的流式占位。
|
||||
const conversationStarted =
|
||||
step1.isIntentSending ||
|
||||
step1.intentReady != null ||
|
||||
step1.interactiveMessages.some((m) => m.sender === "user");
|
||||
// 遮罩展示条件:自动会话 + 仍在 Step1 + 问答还没开始 + 没有初始化报错 + 没到安全超时。
|
||||
const showBootLoading =
|
||||
isAutoSession &&
|
||||
currentStep === 1 &&
|
||||
!conversationStarted &&
|
||||
!step1.intentInitError &&
|
||||
!bootLoadingExpired;
|
||||
// 安全超时:无论如何最多遮 30s,避免初始化卡死锁住界面(用户仍可手动操作底层页面)。
|
||||
useEffect(() => {
|
||||
if (!showBootLoading) return;
|
||||
const timer = window.setTimeout(() => setBootLoadingExpired(true), 30_000);
|
||||
return () => window.clearTimeout(timer);
|
||||
}, [showBootLoading]);
|
||||
|
||||
/** 组装无界回传载荷:总控共识 + 各智能体最终交付(剔除总控席位)。 */
|
||||
const buildWujieConsensusPayload = useCallback(
|
||||
() => ({
|
||||
@@ -1780,10 +1813,34 @@ export default function RoundtablePlanningPage() {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"roundtable-planning theme-transition flex h-full min-h-0 flex-col bg-[#fef6f6] font-sans text-slate-800 selection:bg-red-200",
|
||||
"roundtable-planning theme-transition relative flex h-full min-h-0 flex-col bg-[#fef6f6] font-sans text-slate-800 selection:bg-red-200",
|
||||
isDark && "roundtable-planning--dark",
|
||||
)}
|
||||
>
|
||||
{/* 启动加载遮罩:深链/预填自动会话从进入页面到问答真正开始(建意图线程 / 回显历史草稿)
|
||||
期间全屏覆盖,避免线程创建慢时页面像卡住。问答一旦开始或超时即撤掉。 */}
|
||||
{showBootLoading && (
|
||||
<div
|
||||
className="absolute inset-0 z-50 flex items-center justify-center bg-white"
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
>
|
||||
<div className="flex flex-col items-center gap-7 px-8">
|
||||
<div className="flex flex-col items-center gap-2 text-center">
|
||||
<p className="text-lg font-semibold tracking-wide text-slate-800">
|
||||
正在准备多智能体会商
|
||||
</p>
|
||||
<p className="text-sm text-slate-400">正在初始化任务理解智能体,请稍候…</p>
|
||||
</div>
|
||||
<span className="inline-flex items-center gap-1.5">
|
||||
<span className="h-2 w-2 animate-bounce rounded-full bg-red-400 [animation-delay:-0.3s]" />
|
||||
<span className="h-2 w-2 animate-bounce rounded-full bg-red-400 [animation-delay:-0.15s]" />
|
||||
<span className="h-2 w-2 animate-bounce rounded-full bg-red-400" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<RecommendAgentsDialog
|
||||
open={isRecommendDialogOpen}
|
||||
intent={step1.intentReady}
|
||||
|
||||
Reference in new issue
Block a user