feat(chat): 修复 Strategy/Workspace 统一聊天布局与历史路由归属

This commit is contained in:
董宏凯 committed 2026-09-01 14:51:16 +08:00
1 parent dbf62e5889
commit 519e4c0c01
7 files changed
+107 -70

No files matched your search

+21 -6
View File
@@ -1,7 +1,8 @@
import { Navigate, Route, Routes } from "react-router-dom";
import { Toaster } from "sonner";
import { SidebarProvider } from "@/components/ui/sidebar";
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar";
import { WorkspaceSidebar } from "@/components/workspace/workspace-sidebar";
import { getAccountDisplayName, getStoredAuth } from "@/core/auth";
import { isSentimentAgentVisible } from "@/core/sentiment-agent/config";
import { RouteBaseProvider } from "@/core/route-base";
@@ -79,6 +80,24 @@ import AdminScheduledTasksPage from "./AdminScheduledTasksPage";
import AdminUserActivityPage from "./AdminUserActivityPage";
import { ChatRuntime } from "./WorkspaceRoutes";
/**
* Strategy's legacy `/chats/:thread_id` route shares ChatPage's header.
* Unlike WorkspaceRoutes it did not render a WorkspaceSidebar, leaving the
* header's expand/collapse control with no visible panel to operate.
*/
function StrategyChatThreadLayout() {
return (
<div className="flex size-full min-h-0 overflow-hidden">
<WorkspaceSidebar compactChrome />
<SidebarInset className="min-w-0">
<ChatRuntime>
<ChatPage />
</ChatRuntime>
</SidebarInset>
</div>
);
}
export default function StrategyRoutes() {
const storedAuth = getStoredAuth();
const canManageBusinessMappings = !storedAuth || storedAuth.system_role === "admin";
@@ -342,11 +361,7 @@ export default function StrategyRoutes() {
<Route path="chats" element={<ChatsPage />} />
<Route
path="chats/:thread_id"
element={
<ChatRuntime>
<ChatPage />
</ChatRuntime>
}
element={<StrategyChatThreadLayout />}
/>
<Route path="agents" element={<AgentsPage />} />