diff --git a/apps/web/client/app.ts b/apps/web/client/app.ts index c33e408f..c4190fbd 100644 --- a/apps/web/client/app.ts +++ b/apps/web/client/app.ts @@ -867,7 +867,10 @@ function toast(text: string) { } function setGlobalNotice(text: string) { element('#global-notice-text').textContent = text; - element('#global-notice').hidden = !text; + const notice = element('#global-notice'), changed = notice.hidden !== !text; + notice.hidden = !text; + // The top bar's status steps aside while the notice says the same thing. + if (changed) renderShell(); } function setMobileView(view: 'compose' | 'runs', focus = false) { const changed = document.body.dataset.mobileView !== view; @@ -3220,7 +3223,7 @@ function renderShell() { libraryHref: chatWorkspace?.id ? `library.html?${new URLSearchParams({ workbenchChat: chatWorkspace.id })}` : chatWorkspace?.editingProblem ? `library.html?${new URLSearchParams({ workbenchEdit: chatWorkspace.editingProblem })}` : 'library.html', history: { docked: historyDocked(), expanded: !historyCollapsed() }, - connection: { tone: ready ? 'ready' : 'offline', label: !state.connected ? connectionRequest ? t('连接中') : t('连接中断') : ready ? t('环境就绪') : t('环境未就绪') }, + connection: { tone: ready ? 'ready' : 'offline', inNotice: !element('#global-notice').hidden, label: !state.connected ? connectionRequest ? t('连接中') : t('连接中断') : ready ? t('环境就绪') : t('环境未就绪') }, settingsDisabled: !session || state.submitting, account: session?.account && accountLogin(session.account), onAccount: openAccount, onHistory: toggleHistory, onHome: () => { void openNaturalResearch(); }, onDraft: openDraft, onSettings: () => openSettings(), onPalette: () => palette.open(), onGlossary: () => openGlossary(), onLocale: changeLocale, onLive: () => { diff --git a/apps/web/client/chatSession.ts b/apps/web/client/chatSession.ts index 04bc57c3..fe4dae2c 100644 --- a/apps/web/client/chatSession.ts +++ b/apps/web/client/chatSession.ts @@ -1433,7 +1433,8 @@ export class ChatSession { ? t('当前运行镜像未安装原生团队后端。') : this.options.session()?.runtime.ready ? t('当前服务暂不支持自然语言解题,可切换到 Lean 输入。') - : t('运行环境暂未就绪,原题会保留;恢复后可继续发送。') + // The notice at the top already names the runtime problem and offers a retry. + : undefined : newProblem && !this.capabilities ? t("正在连接…") // A running proof that takes no guidance says so, so a message here is not mistaken for an instruction to the Agent. : this.conversation && this.run?.status === 'running' && !showGuidance && !canDecide && !this.options.isSample(this.run) diff --git a/apps/web/client/ui/Topbar.tsx b/apps/web/client/ui/Topbar.tsx index ad71f22d..3c1862ee 100644 --- a/apps/web/client/ui/Topbar.tsx +++ b/apps/web/client/ui/Topbar.tsx @@ -9,7 +9,7 @@ export type TopbarLive = { label: string; detail: string; tone: string; count: n export type TopbarProps = { model: string; /** Desktop docks the history beside the run; narrow screens open it as a dialog. */ history: { docked: boolean; expanded: boolean }; - connection: { tone: 'ready' | 'offline'; label: string }; settingsDisabled: boolean; + connection: { tone: 'ready' | 'offline'; label: string; /** The notice under the top bar already says it. */ inNotice?: boolean }; settingsDisabled: boolean; live?: TopbarLive; mac: boolean; account?: string; libraryHref?: string; onHistory(): void; onHome(): void; onDraft(): void; onSettings(): void; onPalette(): void; onLive(): void; onAccount(): void; onGlossary(): void; onLocale(): void; @@ -17,7 +17,7 @@ export type TopbarProps = { const tx = (zh: string, en: string) => locale === 'en' ? en : zh; function Topbar(props: TopbarProps) { - const { live } = props; + const { live } = props, connectionShown = props.connection.tone !== 'ready' && !props.connection.inNotice; const menu = useRef(null), [open, setOpen] = useState(false); const close = (focus = false) => { setOpen(false); @@ -53,12 +53,12 @@ function Topbar(props: TopbarProps) { aria-label={props.history.expanded ? t('收起研究记录') : t('展开研究记录')} title={t('研究记录')} onClick={props.onHistory}>{tx('历史', 'History')} : } -