Files
next-tjwater-frontend/src/features/workbench/hooks/use-workbench-sync-notice.ts
T
jiang ec23d44b02 feat(agent): support Responses steering and project-aware tools
Use the dedicated TJWATER_AGENT_URL and Responses stream protocol. Keep running
turns active while users steer or queue follow-ups and edit pending delivery.
Refresh the model catalog before generation and preserve approval mode selection.

Integrate scoped investigation messaging/presentation, geographic place selection,
current Agent composer styles and supporting workbench contracts.

Validation: 77 focused Vitest checks, 21 browser cases, lint, typecheck and
production build. Preserve direct Server/Agent routing and project authentication.
2026-10-19 18:46:58 +08:00

31 lines
918 B
TypeScript

import { useEffect } from "react";
import { dismissMapNotice, showMapNotice } from "@/features/map/core";
const RECONNECT_NOTICE_DELAY_MS = 15_000;
const RECONNECT_NOTICE_ID = "workbench-sync-reconnecting";
export function useWorkbenchSyncNotice(reconnecting: boolean) {
useEffect(() => {
if (!reconnecting) {
dismissMapNotice(RECONNECT_NOTICE_ID);
return;
}
// Scheduled SSE renewal and brief outages normally recover within this window.
const timer = window.setTimeout(() => {
showMapNotice({
id: RECONNECT_NOTICE_ID,
tone: "warning",
title: "业务同步正在重连",
message: "当前数据可能陈旧,连接恢复后将自动更新。",
duration: Infinity
});
}, RECONNECT_NOTICE_DELAY_MS);
return () => {
window.clearTimeout(timer);
dismissMapNotice(RECONNECT_NOTICE_ID);
};
}, [reconnecting]);
}