From 05f6055a846657ff88ef1c3ec9b659bea3a7e03d Mon Sep 17 00:00:00 2001 From: Senor-Liu <71912659+Senor-Liu@users.noreply.github.com> Date: Fri, 21 Aug 2026 09:19:31 +0800 Subject: [PATCH] =?UTF-8?q?merge:=20=E5=90=88=E5=B9=B6=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/app.jsx | 9 +-- web/client/src/layout/components/header.jsx | 2 +- web/client/src/layout/index.jsx | 2 +- web/client/src/sections/aichat/router.js | 2 +- .../articleSelect/actions/request.jsx | 2 +- .../articleSelect/container/index.jsx | 2 +- .../components/FinanceInvoiceWorkspace.jsx | 2 +- web/client/src/sections/newAiChat/router.js | 2 +- .../sections/pepAuth/container/pepAuth.jsx | 14 ++-- .../schemeList/container/schemeList.jsx | 2 +- .../sections/superAgent/container/index.jsx | 70 +++++++++++-------- .../superAgent/hooks/useSuperAgentChat.js | 6 ++ .../superAgent/hooks/useSuperAgentStream.js | 25 +++---- web/client/src/sections/superAgent/router.js | 2 +- .../src/sections/tender/container/tender.jsx | 2 +- web/client/src/utils/index.js | 6 +- 16 files changed, 77 insertions(+), 73 deletions(-) diff --git a/web/client/src/app.jsx b/web/client/src/app.jsx index 890a96c..a7d60b8 100644 --- a/web/client/src/app.jsx +++ b/web/client/src/app.jsx @@ -207,17 +207,12 @@ const App = () => { const initAuth = async () => { const { search, pathname } = window.location; const urlParams = new URLSearchParams(search); - const clientId = urlParams.get("clientid") || "pep-feixiaoshang"; const authRoutes = ["/tender", "/schemeList", "/automatedReports"]; - if ( - authRoutes.includes(pathname) || - (pathname === "/aichat" && clientId === "pep-feixiaoshang") - ) { + if (authRoutes.includes(pathname)) { if (import.meta.env.DEV) return; // 开发环境跳过认证 if (urlParams.get("dev") === "true") return; // url参数dev为true时跳过认证 - const query = search ? `${search}&redirect=${encodeURIComponent(pathname)}` : `?redirect=${encodeURIComponent(pathname)}`; - window.location.replace(`/pepAuth${query}`); + window.location.replace("/chat"); } }; diff --git a/web/client/src/layout/components/header.jsx b/web/client/src/layout/components/header.jsx index 4385c1a..7d6b3a5 100644 --- a/web/client/src/layout/components/header.jsx +++ b/web/client/src/layout/components/header.jsx @@ -30,7 +30,7 @@ export default function header () { items: [{ label:
{ clearCompatibleAuthInfo(); - navigate("/aichat"); + navigate("/chat"); }}> 退出登录
, diff --git a/web/client/src/layout/index.jsx b/web/client/src/layout/index.jsx index 9717eeb..76fdd95 100644 --- a/web/client/src/layout/index.jsx +++ b/web/client/src/layout/index.jsx @@ -95,7 +95,7 @@ export default function index(props) { {outerRoutes} }> - } /> + } /> {innerRoutes} diff --git a/web/client/src/sections/aichat/router.js b/web/client/src/sections/aichat/router.js index 20a461b..5e79e6f 100644 --- a/web/client/src/sections/aichat/router.js +++ b/web/client/src/sections/aichat/router.js @@ -4,7 +4,7 @@ export default { type: 'outer', route: { key: 'aichat', - path: "/aichatv1", + path: "/chatv1", component: AiChat } }; diff --git a/web/client/src/sections/articleSelect/actions/request.jsx b/web/client/src/sections/articleSelect/actions/request.jsx index a2adc6a..4b9fda3 100644 --- a/web/client/src/sections/articleSelect/actions/request.jsx +++ b/web/client/src/sections/articleSelect/actions/request.jsx @@ -11,7 +11,7 @@ export const apiRequest = new request({ if (err) { if (err?.status === 401) { clearCompatibleAuthInfo() - window.location.replace('/aichat'); + window.location.replace('/chat'); } return err } diff --git a/web/client/src/sections/articleSelect/container/index.jsx b/web/client/src/sections/articleSelect/container/index.jsx index cac2dd4..4d73f80 100644 --- a/web/client/src/sections/articleSelect/container/index.jsx +++ b/web/client/src/sections/articleSelect/container/index.jsx @@ -15,7 +15,7 @@ export default function MatchContainer() { interceptor: (res, err) => { // 拦截器,用于处理请求结果,两参数互斥出现 if (err) { if (err?.status === 401) { - window.location.replace('/aichat'); + window.location.replace('/chat'); sessionStorage.clear() } return err diff --git a/web/client/src/sections/financeInvoice/components/FinanceInvoiceWorkspace.jsx b/web/client/src/sections/financeInvoice/components/FinanceInvoiceWorkspace.jsx index e58882b..9d4f864 100644 --- a/web/client/src/sections/financeInvoice/components/FinanceInvoiceWorkspace.jsx +++ b/web/client/src/sections/financeInvoice/components/FinanceInvoiceWorkspace.jsx @@ -87,7 +87,7 @@ const formatQueryHistoryTitle = (item) => { const handleFinanceInvoiceAuthExpired = () => { clearCompatibleAuthInfo(); - window.location.replace("/aichat"); + window.location.replace("/chat"); }; /** diff --git a/web/client/src/sections/newAiChat/router.js b/web/client/src/sections/newAiChat/router.js index 667d5a0..17382fc 100644 --- a/web/client/src/sections/newAiChat/router.js +++ b/web/client/src/sections/newAiChat/router.js @@ -4,7 +4,7 @@ export default { type: "outer", route: { key: "chat", - path: "/chat", + path: "/chatv2", component: NewAiChat, nav: false, }, diff --git a/web/client/src/sections/pepAuth/container/pepAuth.jsx b/web/client/src/sections/pepAuth/container/pepAuth.jsx index 59479ea..ef0da45 100644 --- a/web/client/src/sections/pepAuth/container/pepAuth.jsx +++ b/web/client/src/sections/pepAuth/container/pepAuth.jsx @@ -15,9 +15,9 @@ export default function PepAuth() { const urlParams = new URLSearchParams(search); const token = urlParams.get('token'); if (!token) { - message.warning('请登录项企后跳转飞小尚'); + message.warning('登录状态无效,请返回聊天页面'); setTimeout(() => { - window.location.href = 'https://pep.anxinyun.cn' + window.location.replace('/chat'); }, 2000); return; } @@ -27,18 +27,18 @@ export default function PepAuth() { const pepUserId = userRes.payload.data?.pepUserId || userRes.payload.data?.pepId || userRes.payload.data?.id; localStorage.setItem('userId', String(pepUserId || '')); localStorage.setItem('userInfo', JSON.stringify(userRes.payload.data)); - window.location.replace(urlParams.get('redirect') || '/aichat'); + window.location.replace(urlParams.get('redirect') || '/chat'); } else { - message.warning('鉴权失败!请重新登录项企后跳转飞小尚'); + message.warning('鉴权失败,请返回聊天页面'); setTimeout(() => { - window.location.href = 'https://pep.anxinyun.cn'; + window.location.replace('/chat'); }, 2000); } } catch (error) { console.error(error); - message.warning('鉴权失败!请重新登录项企后跳转飞小尚'); + message.warning('鉴权失败,请返回聊天页面'); setTimeout(() => { - window.location.href = 'https://pep.anxinyun.cn'; + window.location.replace('/chat'); }, 2000); } } diff --git a/web/client/src/sections/schemeList/container/schemeList.jsx b/web/client/src/sections/schemeList/container/schemeList.jsx index ae02a36..aa09cfe 100644 --- a/web/client/src/sections/schemeList/container/schemeList.jsx +++ b/web/client/src/sections/schemeList/container/schemeList.jsx @@ -120,7 +120,7 @@ export default function SchemeList() {

方案清单

diff --git a/web/client/src/sections/superAgent/container/index.jsx b/web/client/src/sections/superAgent/container/index.jsx index 7c6737c..d0efeac 100644 --- a/web/client/src/sections/superAgent/container/index.jsx +++ b/web/client/src/sections/superAgent/container/index.jsx @@ -864,29 +864,27 @@ const SuperAgent = () => { runtimeTask.sessionStatus || "" ).toLowerCase(); - const runtimeTaskType = String( + const hasLocalRunSignal = stream.isLocalRunActive === true; + const runtimeTaskType = String( runtimeTask?.task_type || runtimeTask?.taskType || "" ).toLowerCase(); const runtimeTaskTotal = Number(runtimeTask?.total || 0); const hasPersistedActiveThread = streamReadyForActiveSession && stream.isPersistedThreadActive === true; - const hasRuntimeExecutionSignal = - !hasPendingInterruptSignal && - ( - stream.isBusinessRunning || - stream.isLocalRunActive || - ["running", "resuming"].includes(String(stream.runPhase || "").toLowerCase()) - ); - const displayTaskStatus = - hasRuntimeExecutionSignal && taskStatus === "suspended" - ? "running" - : taskStatus; - const displayRuntimeSessionStatus = - hasRuntimeExecutionSignal && runtimeSessionStatus === "suspended" - ? "running" - : runtimeSessionStatus; - const hasSuspendedRuntimeStatus = - displayTaskStatus === "suspended" || displayRuntimeSessionStatus === "suspended"; + const displayTaskStatus = + hasLocalRunSignal && ["failed", "error"].includes(taskStatus) + ? "running" + : taskStatus; + const displayRuntimeSessionStatus = + hasLocalRunSignal && ["failed", "error"].includes(runtimeSessionStatus) + ? "running" + : runtimeSessionStatus; + const isFailedTask = + ["failed", "error"].includes(displayTaskStatus) || + ["failed", "error"].includes(displayRuntimeSessionStatus) || + (stream.runPhase === "failed" && !hasPendingInterruptSignal && !hasLocalRunSignal); + const hasSuspendedRuntimeStatus = + displayTaskStatus === "suspended" || displayRuntimeSessionStatus === "suspended"; const displayActiveStreamTask = activeStreamTask ? { ...activeStreamTask, @@ -902,7 +900,7 @@ const SuperAgent = () => { hasPendingInterruptSignal && (taskStatus === "suspended" || runtimeSessionStatus === "suspended"); const hasPersistedRunningThread = - hasPersistedActiveThread && !hasSuspendedRuntimeStatus; + hasPersistedActiveThread && !hasSuspendedRuntimeStatus && !isFailedTask; const isTerminalRuntimeSession = [ "failed", "completed", @@ -933,10 +931,6 @@ const SuperAgent = () => { (displayRuntimeSessionStatus ? displayRuntimeSessionStatus === "running" : ["running", "resuming"].includes(stream.runPhase)); - const isFailedTask = - ["failed", "error"].includes(displayTaskStatus) || - ["failed", "error"].includes(displayRuntimeSessionStatus) || - (stream.runPhase === "failed" && !hasPendingInterruptSignal); const hasTerminalTaskStatus = [ "completed", "done", @@ -949,6 +943,7 @@ const SuperAgent = () => { "suspended", ].includes(displayTaskStatus) && !isSuspendedByInterrupt; const isTerminalTask = + isFailedTask || (hasSuspendedRuntimeStatus && !isSuspendedByInterrupt) || (!hasPersistedActiveThread && !isBodyGenerationRuntimeActive && hasTerminalTaskStatus) || isTerminalRuntimeSession || @@ -994,11 +989,12 @@ const SuperAgent = () => { ["running", "awaiting_interrupt", "resuming"].includes(stream.runPhase) && (!isTerminalTask || stream.isLocalRunActive); const isStreamRunning = - hasPersistedRunningThread || - isBodyGenerationRuntimeActive || - hasActiveStreamRunPhase || - (hasStreamExecutionSignal && - (!isTerminalTask || hasRunningTaskStatus || hasActiveToolCallSignal)); + !isFailedTask && + (hasPersistedRunningThread || + isBodyGenerationRuntimeActive || + hasActiveStreamRunPhase || + (hasStreamExecutionSignal && + (!isTerminalTask || hasRunningTaskStatus || hasActiveToolCallSignal))); const projectedStreamMessages = stream.messages; const streamConversationMessages = streamReadyForActiveSession ? buildStreamConversationMessages( @@ -1517,12 +1513,17 @@ const SuperAgent = () => { } }; - const respondCheckpointToAgent = ({ response, interruptId, namespace, respondBody = {} }) => { + const respondCheckpointToAgent = async ({ + response, + interruptId, + namespace, + respondBody = {}, + }) => { const matchingInterrupt = activeStreamInterrupts.find((item) => { const payload = item?.value || item?.payload || {}; return payload.checkpoint_id === respondBody.checkpoint_id; }); - return stream.respondInterrupt(response || { + const result = await stream.respondInterrupt(response || { type: respondBody.action || "respond", edits: respondBody.edits, display_content: respondBody.display_content, @@ -1530,6 +1531,15 @@ const SuperAgent = () => { interruptId: interruptId || matchingInterrupt?.id, namespace: namespace || matchingInterrupt?.namespace, }); + try { + await stream.refreshState(); + } catch (error) { + superAgentError("container.interrupt", "state.refresh_failed", { + sessionId: activeSessionId, + error, + }); + } + return result; }; const handleStopAndCancel = async () => { diff --git a/web/client/src/sections/superAgent/hooks/useSuperAgentChat.js b/web/client/src/sections/superAgent/hooks/useSuperAgentChat.js index bb4361d..3870ca8 100644 --- a/web/client/src/sections/superAgent/hooks/useSuperAgentChat.js +++ b/web/client/src/sections/superAgent/hooks/useSuperAgentChat.js @@ -1470,11 +1470,17 @@ const useSuperAgentChat = ({ const openAgentSquare = () => { setRouteType("agents"); setWorkspaceOpen(false); + setActiveSessionId(""); + setActiveTaskId(""); + clearActiveSessionId(); }; const openResourceLibrary = () => { setRouteType("assets"); setWorkspaceOpen(false); + setActiveSessionId(""); + setActiveTaskId(""); + clearActiveSessionId(); }; const handleTenderQuickStart = () => { diff --git a/web/client/src/sections/superAgent/hooks/useSuperAgentStream.js b/web/client/src/sections/superAgent/hooks/useSuperAgentStream.js index c1ae5ec..5496501 100644 --- a/web/client/src/sections/superAgent/hooks/useSuperAgentStream.js +++ b/web/client/src/sections/superAgent/hooks/useSuperAgentStream.js @@ -1162,25 +1162,18 @@ const useSuperAgentStream = ({ !hasPersistedInterrupts && ["waiting_interrupt", "awaiting_interrupt"].includes(runPhase); const isPersistedThreadActive = - isPersistedTaskActive || hasPersistedNextNodes || hasPersistedInterrupts; + hasPersistedInterrupts || + isPersistedTaskActive || + hasPersistedNextNodes; const isPersistedExecutionActive = isPersistedThreadActive && - ![ - "suspended", - "waiting_user", - "awaiting_interrupt", - "waiting_interrupt", - ].includes(persistedTaskStatus) && + !["suspended", "waiting_user", "awaiting_interrupt", "waiting_interrupt"].includes( + persistedTaskStatus + ) && !hasPersistedInterrupts; - const hasRuntimeExecutionSignal = - localRunActiveRef.current || - isLocalRunActive || - isBusinessRunning || - ["running", "resuming"].includes(runPhase); - const isPersistedSuspended = - persistedTaskStatus === "suspended" && - !hasPersistedInterrupts && - !hasRuntimeExecutionSignal; + const isPersistedSuspended = + persistedTaskStatus === "suspended" && + !hasPersistedInterrupts; const isTerminalRunPhase = [ "completed", "aborted", diff --git a/web/client/src/sections/superAgent/router.js b/web/client/src/sections/superAgent/router.js index e0c2ead..2d4d610 100644 --- a/web/client/src/sections/superAgent/router.js +++ b/web/client/src/sections/superAgent/router.js @@ -18,7 +18,7 @@ export default { type: "outer", route: { key: "superAgent", - path: "/aichat", + path: "/chat", component: SuperAgent, nav: false, }, diff --git a/web/client/src/sections/tender/container/tender.jsx b/web/client/src/sections/tender/container/tender.jsx index dd4564f..8181ba1 100644 --- a/web/client/src/sections/tender/container/tender.jsx +++ b/web/client/src/sections/tender/container/tender.jsx @@ -136,7 +136,7 @@ export default function Tender() {

我的标书

diff --git a/web/client/src/utils/index.js b/web/client/src/utils/index.js index 7dbb412..92c940f 100644 --- a/web/client/src/utils/index.js +++ b/web/client/src/utils/index.js @@ -34,7 +34,7 @@ const apiRequest = new request({ if (err) { if (err?.status === 401) { clearCompatibleAuthInfo(); - window.location.replace("/aichat"); + window.location.replace("/chat"); } return err; } @@ -48,7 +48,7 @@ const fgptRequest = new request({ if (err) { if (err?.status === 401) { clearCompatibleAuthInfo(); - window.location.replace("/aichat"); + window.location.replace("/chat"); } return err; } @@ -75,7 +75,7 @@ const schemeListRequest = new request({ if (err) { if (err?.status === 401) { clearCompatibleAuthInfo(); - window.location.replace("/aichat"); + window.location.replace("/chat"); } return err; }