Browse Source

merge: 合并最新代码

master
Senor-Liu 1 month ago
parent
commit
05f6055a84
  1. 9
      web/client/src/app.jsx
  2. 2
      web/client/src/layout/components/header.jsx
  3. 2
      web/client/src/layout/index.jsx
  4. 2
      web/client/src/sections/aichat/router.js
  5. 2
      web/client/src/sections/articleSelect/actions/request.jsx
  6. 2
      web/client/src/sections/articleSelect/container/index.jsx
  7. 2
      web/client/src/sections/financeInvoice/components/FinanceInvoiceWorkspace.jsx
  8. 2
      web/client/src/sections/newAiChat/router.js
  9. 14
      web/client/src/sections/pepAuth/container/pepAuth.jsx
  10. 2
      web/client/src/sections/schemeList/container/schemeList.jsx
  11. 70
      web/client/src/sections/superAgent/container/index.jsx
  12. 6
      web/client/src/sections/superAgent/hooks/useSuperAgentChat.js
  13. 25
      web/client/src/sections/superAgent/hooks/useSuperAgentStream.js
  14. 2
      web/client/src/sections/superAgent/router.js
  15. 2
      web/client/src/sections/tender/container/tender.jsx
  16. 6
      web/client/src/utils/index.js

9
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");
}
};

2
web/client/src/layout/components/header.jsx

@ -30,7 +30,7 @@ export default function header () {
items: [{
label: <div onClick={() => {
clearCompatibleAuthInfo();
navigate("/aichat");
navigate("/chat");
}}>
退出登录
</div>,

2
web/client/src/layout/index.jsx

@ -95,7 +95,7 @@ export default function index(props) {
<Routes>
{outerRoutes}
<Route path="/" element={<Layout routerNav={routerNav} />}>
<Route index element={<Navigate to="/aichat" replace />} />
<Route index element={<Navigate to="/chat" replace />} />
{innerRoutes}
</Route>
</Routes>

2
web/client/src/sections/aichat/router.js

@ -4,7 +4,7 @@ export default {
type: 'outer',
route: {
key: 'aichat',
path: "/aichatv1",
path: "/chatv1",
component: AiChat
}
};

2
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
}

2
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

2
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");
};
/**

2
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,
},

14
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);
}
}

2
web/client/src/sections/schemeList/container/schemeList.jsx

@ -120,7 +120,7 @@ export default function SchemeList() {
<Header className={styles.header} style={{ background: '#fff', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Button onClick={() => {
navigate('/aichat');
navigate('/chat');
}} style={{ marginRight: 16 }}><LeftOutlined /></Button>
<h1>方案清单</h1>
</div>

70
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 () => {

6
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 = () => {

25
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",

2
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,
},

2
web/client/src/sections/tender/container/tender.jsx

@ -136,7 +136,7 @@ export default function Tender() {
<Header className={styles.header} style={{ background: '#fff', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Button onClick={() => {
navigate('/aichat');
navigate('/chat');
}} style={{ marginRight: 16 }}><LeftOutlined /></Button>
<h1>我的标书</h1>
</div>

6
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;
}

Loading…
Cancel
Save