feat(chat): 修复 Strategy/Workspace 统一聊天布局与历史路由归属
This commit is contained in:
1 parent
dbf62e5889
commit
519e4c0c01
7 files changed
+107
-70
No files matched your search
@@ -64,7 +64,7 @@ import {
|
||||
import {
|
||||
useDeleteThread,
|
||||
useRenameThread,
|
||||
useThreadsPage,
|
||||
useThreads,
|
||||
useToggleThreadFavorite,
|
||||
useToggleThreadPin,
|
||||
} from "@/core/threads/hooks";
|
||||
@@ -351,8 +351,8 @@ export function AgentChatSidebar({ activeAgentId }: { activeAgentId?: string })
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前智能体的「最近对话」面板(参考首页 GeneralQaSidebar 的「最近的对话」区块)。
|
||||
* 按 agent_id 在服务端过滤;支持重命名/置顶/收藏/分享/导出/删除。
|
||||
* 「最近的对话」面板(参考首页 GeneralQaSidebar 的「最近的对话」区块)。
|
||||
* 跨智能体的近期会话,点击打开;支持重命名/置顶/收藏/分享/导出/删除。
|
||||
*/
|
||||
function RecentChatsPane({ activeAgentId }: { activeAgentId?: string }) {
|
||||
const { t } = useI18n();
|
||||
@@ -361,12 +361,7 @@ function RecentChatsPane({ activeAgentId }: { activeAgentId?: string }) {
|
||||
const pathOf = usePathOfThread();
|
||||
|
||||
const { thread_id: threadIdFromPath } = useParams<{ thread_id: string }>();
|
||||
const { data: threadPage } = useThreadsPage({
|
||||
page: 1,
|
||||
pageSize: 50,
|
||||
metadata: { agent_id: activeAgentId ?? "" },
|
||||
});
|
||||
const threads = threadPage?.threads ?? [];
|
||||
const { data: threads = [] } = useThreads();
|
||||
const { mutate: deleteThread } = useDeleteThread();
|
||||
const { mutate: renameThread } = useRenameThread();
|
||||
const { toggle: togglePin } = useToggleThreadPin();
|
||||
@@ -378,8 +373,8 @@ function RecentChatsPane({ activeAgentId }: { activeAgentId?: string }) {
|
||||
const [renameValue, setRenameValue] = useState("");
|
||||
const [shareThreadId, setShareThreadId] = useState<string | null>(null);
|
||||
|
||||
// 服务端先按当前智能体过滤;客户端再排除调度/会商/报告结构&写作配置向导等
|
||||
// 系统会话。智能体创建(bootstrap)会话保留展示(带机器人图标、点击回创建页);置顶优先。
|
||||
// 排除调度/会商/报告结构&写作配置向导等系统会话,与首页一致;
|
||||
// 智能体创建(bootstrap)会话保留展示(带机器人图标、点击回创建页);置顶优先。
|
||||
const visibleThreads = useMemo(
|
||||
() => sortThreadsPinnedFirst(threads.filter((thread) => !isHiddenFromRecentChats(thread))),
|
||||
[threads],
|
||||
@@ -484,11 +479,7 @@ function RecentChatsPane({ activeAgentId }: { activeAgentId?: string }) {
|
||||
) : (
|
||||
filteredThreads.map((thread) => {
|
||||
const isBoot = isBootstrapThread(thread);
|
||||
// 正常记录依据自身保存的 agent_id 跳转;早期记录可能尚未写入
|
||||
// agent_id,此时保留当前智能体上下文,避免从智能体页误落到通用问答。
|
||||
const href = isBoot
|
||||
? bootstrapResumePath(thread.thread_id)
|
||||
: pathOf(thread, { agent_id: activeAgentId });
|
||||
const href = isBoot ? bootstrapResumePath(thread.thread_id) : pathOf(thread);
|
||||
const isActive = href === pathname;
|
||||
const pinned = isThreadPinned(thread);
|
||||
const favorited = isThreadFavorite(thread);
|
||||
|
||||
Reference in new issue
Block a user