Browse Source

merge: 合并代码

master
Senor-Liu 1 month ago
parent
commit
15b01db1f5
  1. 1
      web/client/src/sections/superAgent/actions/api.js
  2. 2
      web/client/src/sections/superAgent/container/index.jsx
  3. 1
      web/client/src/sections/superAgent/hooks/useSuperAgentStream.js
  4. 9
      web/client/src/utils/authCompat.js

1
web/client/src/sections/superAgent/actions/api.js

@ -321,6 +321,7 @@ const optimizeQuoteData = async (quoteData = {}) => {
} catch (error) { } catch (error) {
console.error("优化引用数据失败:", error); console.error("优化引用数据失败:", error);
return quoteData; return quoteData;
headers["X-PEP-Token"] = token;
} }
}; };

2
web/client/src/sections/superAgent/container/index.jsx

@ -863,6 +863,7 @@ const SuperAgent = () => {
"" ""
).toLowerCase(); ).toLowerCase();
const hasLocalRunSignal = stream.isLocalRunActive === true; const hasLocalRunSignal = stream.isLocalRunActive === true;
const hasStreamError = stream.isExecutionFailed === true || Boolean(stream.error);
const runtimeTaskType = String( const runtimeTaskType = String(
runtimeTask?.task_type || runtimeTask?.taskType || "" runtimeTask?.task_type || runtimeTask?.taskType || ""
).toLowerCase(); ).toLowerCase();
@ -878,6 +879,7 @@ const SuperAgent = () => {
? "running" ? "running"
: runtimeSessionStatus; : runtimeSessionStatus;
const isFailedTask = const isFailedTask =
hasStreamError ||
["failed", "error"].includes(displayTaskStatus) || ["failed", "error"].includes(displayTaskStatus) ||
["failed", "error"].includes(displayRuntimeSessionStatus) || ["failed", "error"].includes(displayRuntimeSessionStatus) ||
(stream.runPhase === "failed" && !hasPendingInterruptSignal && !hasLocalRunSignal); (stream.runPhase === "failed" && !hasPendingInterruptSignal && !hasLocalRunSignal);

1
web/client/src/sections/superAgent/hooks/useSuperAgentStream.js

@ -452,6 +452,7 @@ const useSuperAgentStream = ({
const defaultHeaders = useMemo( const defaultHeaders = useMemo(
() => ({ () => ({
Accept: "application/json, text/event-stream", Accept: "application/json, text/event-stream",
...(loginToken ? { "X-PEP-Token": loginToken } : {}),
}), }),
[loginToken] [loginToken]
); );

9
web/client/src/utils/authCompat.js

@ -5,6 +5,7 @@ const AUTH_STORAGE_KEYS = {
legacyUserInfo: "userInfo", legacyUserInfo: "userInfo",
legacySessionUser: "user", legacySessionUser: "user",
legacyUserId: "userId", legacyUserId: "userId",
pepToken: "pepToken",
}; };
//[安全解析JSON] //[安全解析JSON]
@ -148,7 +149,11 @@ export const getCompatibleToken = () => {
: readStorage(window.localStorage, AUTH_STORAGE_KEYS.cEndToken).trim(); : readStorage(window.localStorage, AUTH_STORAGE_KEYS.cEndToken).trim();
if (standaloneCEndToken) return standaloneCEndToken; if (standaloneCEndToken) return standaloneCEndToken;
const legacyUserInfo = getLegacyAuthUserInfo(); const legacyUserInfo = getLegacyAuthUserInfo();
return String(legacyUserInfo?.token ?? "").trim(); const legacyToken = String(legacyUserInfo?.token ?? "").trim();
if (legacyToken) return legacyToken;
return typeof window === "undefined"
? ""
: readStorage(window.localStorage, AUTH_STORAGE_KEYS.pepToken).trim();
}; };
// @peace/react_client 的 request 仅从 sessionStorage.user.token 注入 token 请求头。 // @peace/react_client 的 request 仅从 sessionStorage.user.token 注入 token 请求头。
@ -289,6 +294,8 @@ export const clearCompatibleAuthInfo = () => {
window.localStorage.removeItem(AUTH_STORAGE_KEYS.cEndToken); window.localStorage.removeItem(AUTH_STORAGE_KEYS.cEndToken);
window.localStorage.removeItem(AUTH_STORAGE_KEYS.legacyUserInfo); window.localStorage.removeItem(AUTH_STORAGE_KEYS.legacyUserInfo);
window.localStorage.removeItem(AUTH_STORAGE_KEYS.legacyUserId); window.localStorage.removeItem(AUTH_STORAGE_KEYS.legacyUserId);
window.localStorage.removeItem(AUTH_STORAGE_KEYS.pepToken);
window.document.cookie = `${AUTH_STORAGE_KEYS.pepToken}=; path=/; max-age=0`;
window.localStorage.removeItem("aiTenderLoginIdentity"); window.localStorage.removeItem("aiTenderLoginIdentity");
window.localStorage.removeItem("from"); window.localStorage.removeItem("from");
}; };

Loading…
Cancel
Save