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) {
console.error("优化引用数据失败:", error);
return quoteData;
headers["X-PEP-Token"] = token;
}
};

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

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

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

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

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

@ -5,6 +5,7 @@ const AUTH_STORAGE_KEYS = {
legacyUserInfo: "userInfo",
legacySessionUser: "user",
legacyUserId: "userId",
pepToken: "pepToken",
};
//[安全解析JSON]
@ -148,7 +149,11 @@ export const getCompatibleToken = () => {
: readStorage(window.localStorage, AUTH_STORAGE_KEYS.cEndToken).trim();
if (standaloneCEndToken) return standaloneCEndToken;
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 请求头。
@ -289,6 +294,8 @@ export const clearCompatibleAuthInfo = () => {
window.localStorage.removeItem(AUTH_STORAGE_KEYS.cEndToken);
window.localStorage.removeItem(AUTH_STORAGE_KEYS.legacyUserInfo);
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("from");
};

Loading…
Cancel
Save