From 1662d22f2a38d568131183d370bc819e51b4e399 Mon Sep 17 00:00:00 2001
From: Senor-Liu <71912659+Senor-Liu@users.noreply.github.com>
Date: Fri, 21 Aug 2026 15:05:01 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BE=A7=E6=A0=8F=E6=8E=A5=E5=88=B0?=
=?UTF-8?q?=E4=BB=BB=E5=8A=A1=E9=9B=86/=E4=BC=9A=E8=AF=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../superAgent/actions/agentResources.js | 19 +++
.../src/sections/superAgent/actions/api.js | 25 ++--
.../components/SidebarFolderRow.jsx | 12 +-
.../components/SuperAgentSidebar.jsx | 10 +-
.../src/sections/superAgent/constants.js | 4 +-
.../sections/superAgent/container/index.jsx | 9 +-
.../superAgent/hooks/useSuperAgentChat.js | 70 +++++++----
.../superAgent/hooks/useSuperAgentSidebar.js | 62 +++++-----
.../src/sections/superAgent/utils/session.js | 94 ++++++++++++---
web/tests/superAgentSidebarContract.test.mjs | 109 ++++++++++++++++++
10 files changed, 312 insertions(+), 102 deletions(-)
create mode 100644 web/tests/superAgentSidebarContract.test.mjs
diff --git a/web/client/src/sections/superAgent/actions/agentResources.js b/web/client/src/sections/superAgent/actions/agentResources.js
index baf0ac5..169f4bf 100644
--- a/web/client/src/sections/superAgent/actions/agentResources.js
+++ b/web/client/src/sections/superAgent/actions/agentResources.js
@@ -18,6 +18,21 @@ import { parseAgentPage } from "../utils/agentApiParse";
const jsonAction = (options) => requestAgentJson(options);
+const listAllPages = async (listPage, extraQuery = {}) => {
+ const items = [];
+ let cursor;
+ do {
+ const page = await listPage({
+ ...extraQuery,
+ limit: extraQuery.limit || 100,
+ ...(cursor ? { cursor } : {}),
+ });
+ items.push(...(page.items || []));
+ cursor = page.nextCursor || "";
+ } while (cursor);
+ return items;
+};
+
export const listTasksets = (query = {}) =>
jsonAction({
method: "GET",
@@ -52,6 +67,8 @@ export const deleteTaskset = (tasksetId) =>
fallbackMessage: "删除任务集失败",
});
+export const listAllTasksets = (query = {}) => listAllPages(listTasksets, query);
+
export const listConversations = (query = {}) =>
jsonAction({
method: "GET",
@@ -60,6 +77,8 @@ export const listConversations = (query = {}) =>
fallbackMessage: "获取会话失败",
}).then(parseAgentPage);
+export const listAllConversations = (query = {}) => listAllPages(listConversations, query);
+
export const createConversation = (body, options = {}) =>
jsonAction({
method: "POST",
diff --git a/web/client/src/sections/superAgent/actions/api.js b/web/client/src/sections/superAgent/actions/api.js
index 7ab2c92..3407838 100644
--- a/web/client/src/sections/superAgent/actions/api.js
+++ b/web/client/src/sections/superAgent/actions/api.js
@@ -112,13 +112,13 @@ export const getSuperAgentSidebar = createDirectJsonAction({
export const createSuperAgentFolder = createDirectJsonAction({
method: "POST",
path: superAgentServiceApiTable.tasksets,
- fallbackMessage: "创建文件夹失败",
+ fallbackMessage: "创建任务集失败",
});
export const deleteSuperAgentFolder = createDirectJsonAction({
method: "DELETE",
path: superAgentServiceApiTable.tasksetDetail,
- fallbackMessage: "删除文件夹失败",
+ fallbackMessage: "删除任务集失败",
});
export const respondSuperAgentCheckpoint = (options = {}) => async () => {
@@ -174,21 +174,24 @@ const requestSuperAgentJson = async (options) => requestAgentJson(options);
export const updateSuperAgentFolder = async ({ folderId, userId, body }) =>
requestSuperAgentJson({
- method: "PATCH",
+ method: "PUT",
path: superAgentServiceApiTable.tasksetDetail,
- params: { folderId },
- query: { userId },
- body,
- fallbackMessage: "更新文件夹失败",
+ params: { tasksetId: folderId },
+ body: body?.name ? { name: body.name } : body,
+ fallbackMessage: "更新任务集失败",
});
export const patchSuperAgentSession = async ({ sessionId, userId, body }) =>
requestSuperAgentJson({
- method: "PATCH",
+ method: "PUT",
path: superAgentServiceApiTable.conversationDetail,
- params: { sessionId },
- query: { userId },
- body,
+ params: { conversationId: sessionId },
+ body: {
+ ...(body?.name || body?.title ? { name: body.name || body.title } : {}),
+ ...(body?.taskset_id || body?.tasksetId || body?.folder_id
+ ? { taskset_id: body.taskset_id || body.tasksetId || body.folder_id }
+ : {}),
+ },
fallbackMessage: "更新会话失败",
});
diff --git a/web/client/src/sections/superAgent/components/SidebarFolderRow.jsx b/web/client/src/sections/superAgent/components/SidebarFolderRow.jsx
index 16ceb86..b5c80b2 100644
--- a/web/client/src/sections/superAgent/components/SidebarFolderRow.jsx
+++ b/web/client/src/sections/superAgent/components/SidebarFolderRow.jsx
@@ -94,12 +94,12 @@ const SidebarFolderRow = ({
key: "delete",
label: (
onDelete?.(folder)}
>
- 删除文件夹
+ 删除任务集
),
icon: ,
@@ -141,7 +141,7 @@ const SidebarFolderRow = ({
icon={}
aria-label="在文件夹内新建会话"
disabled={disableCreateSession}
- title="在文件夹内新建会话"
+ title="在任务集内新建任务"
onClick={() => onCreateSession?.(realm, apiFolderId)}
/>
{folderMenuItems.length ? (
@@ -202,14 +202,14 @@ const SidebarFolderRow = ({
) : null}
setRenameOpen(false)}
onOk={async () => {
if (isVirtualDefault) {
- message.warning("默认文件夹不可重命名");
+ message.warning("默认任务集不可重命名");
setRenameOpen(false);
return;
}
@@ -221,7 +221,7 @@ const SidebarFolderRow = ({
value={renameValue}
maxLength={40}
onChange={(event) => setRenameValue(event.target.value)}
- placeholder="请输入文件夹名称"
+ placeholder="请输入任务集名称"
/>
diff --git a/web/client/src/sections/superAgent/components/SuperAgentSidebar.jsx b/web/client/src/sections/superAgent/components/SuperAgentSidebar.jsx
index 31cad64..495bd60 100644
--- a/web/client/src/sections/superAgent/components/SuperAgentSidebar.jsx
+++ b/web/client/src/sections/superAgent/components/SuperAgentSidebar.jsx
@@ -1,6 +1,6 @@
/**
* 文件作用:superAgent 左侧导航与会话树
- * - 任务合集:文件夹 + 拖拽;folder_id=null 归入虚拟「默认文件夹」
+ * - 任务合集:任务集 + 拖拽;任务必须归属某个任务集
* - 普通对话:扁平列表(后端 conversation 文件夹接口保留,前端暂不启用)
*/
"use strict";
@@ -38,7 +38,7 @@ const menuTipMap = {
task: {
title: "开启新任务(Task)",
content:
- "启动超级智能体,支持复杂文件生成、自动对账与Agent协同。任务将沉淀于下方「任务合集」的默认文件夹中。",
+ "启动超级智能体,支持复杂文件生成、自动对账与Agent协同。任务将沉淀于下方「任务合集」中。",
},
};
@@ -265,7 +265,7 @@ const SuperAgentSidebar = ({
{taskRealm.label || "任务合集"}
-
+