sync update from LAN repo (source ji @ 85078a31)

This commit is contained in:
gozeros committed 2026-10-21 15:09:16 +08:00
1 parent 5d6627af50
commit e602d88695
864 files changed
+99150 -6346

No files matched your search

+292 -17
View File
@@ -30,8 +30,9 @@ import { Toaster } from "sonner";
import { SubtasksProvider } from "@/core/tasks/context";
import { ArtifactsProvider } from "@/components/workspace/artifacts";
import { DocumentRewritePresentationProvider } from "@/core/document-rewrite/context";
import { useUploadPolicy } from "@/core/uploads";
import { RouteBaseProvider } from "@/core/route-base";
import { RouteBaseProvider, useRouteBase } from "@/core/route-base";
import { agentRefOfThread } from "@/core/threads/utils";
import ChatsPage from "./ChatsPage";
@@ -39,23 +40,30 @@ import ChatPage from "./ChatPage";
import ArtifactLibraryPage from "./ArtifactLibraryPage";
import IframeChatPage from "./IframeChatPage";
import AgentsPage from "./AgentsPage";
import AgentsOrbitPage from "./AgentsOrbitPage";
import AgentsPlazaPage from "./AgentsPlazaPage";
import AgentChatPage from "./AgentChatPage";
import SentimentAgentChatPage from "./SentimentAgentChatPage";
import NewAgentPage from "./NewAgentPage";
import AdminAgentsPage from "./AdminAgentsPage";
import AdminScheduledTasksPage from "./AdminScheduledTasksPage";
import AdminSkillsPage from "./AdminSkillsPage";
import AdminUserLeaderboardPage from "./AdminUserLeaderboardPage";
import AdminUserLeaderboardSettingsPage from "./AdminUserLeaderboardSettingsPage";
import MenuManagementPage from "./MenuManagementPage";
import FixedQuestionsPage from "./FixedQuestionsPage";
import ScheduledTaskRunDetailPage from "./ScheduledTaskRunDetailPage";
import ScheduledTasksPage from "./ScheduledTasksPage";
import LlmWikiKnowledgePage from "./LlmWikiKnowledgePage";
import AssistantKnowledgePage from "./AssistantKnowledgePage";
import KnowledgeRetrievalDebugPage from "./KnowledgeRetrievalDebugPage";
import WeKnoraWikiManagementPage from "@/strategy-components/components/resource-management/llmwiki/WeKnoraWikiManagementPage";
import WeKnoraWikiPageView from "@/strategy-components/components/resource-management/llmwiki/WeKnoraWikiPageView";
import WeKnoraPackageTransfersPage from "@/strategy-components/components/resource-management/llmwiki/WeKnoraPackageTransfersPage";
import WeKnoraRetrievalDebugPage from "@/strategy-components/components/resource-management/llmwiki/WeKnoraRetrievalDebugPage";
import MarkdownDocxEditorPage from "./MarkdownDocxEditorPage";
import LlmMetricsPage from "./LlmMetricsPage";
import CheckpointMigrationPage from "./CheckpointMigrationPage";
import MemoryPage from "./MemoryPage";
import PromptPrefixSettingsPage from "./PromptPrefixSettingsPage";
import PrivateSquareSettingsPage from "./PrivateSquareSettingsPage";
import ModelConcurrencySettingsPage from "./ModelConcurrencySettingsPage";
@@ -130,7 +138,6 @@ function shouldShowCompactTopActions(pathname: string): boolean {
return (
pathname === "/page/workspace/agents" ||
pathname === "/page/workspace/skills" ||
pathname === "/page/workspace/memory" ||
pathname === "/page/workspace/library" ||
pathname === "/page/workspace/knowledge" ||
pathname.startsWith("/page/workspace/knowledge/")
@@ -172,6 +179,7 @@ export function WorkspaceLayout({
insetOverflowHidden = false,
pageSidebarDark = false,
forceWorkspaceSidebarCollapsed = false,
wxCommonAgents = false,
}: {
children: ReactNode;
pageSidebarCollapsed: boolean;
@@ -187,11 +195,15 @@ export function WorkspaceLayout({
pageSidebarDark?: boolean;
/** Deployment-level compact mode: keep only the icon menu rail. */
forceWorkspaceSidebarCollapsed?: boolean;
/** Enables wx's shared Agent Gallery category selection. */
wxCommonAgents?: boolean;
}) {
// 全量模式下通用问答(/page/workspace/chats*)的历史侧栏默认展开;其余紧凑页
// (如智能体对话,为聊天区更宽而默认收起)维持原默认。
const pathname = useLocation().pathname;
const isGeneralQa = pathname.startsWith("/page/workspace/chats");
const isGeneralQa =
pathname.startsWith("/page/workspace/chats") ||
pathname.startsWith("/page/workspace/wx/");
const showCompactTopActions =
headerHidden &&
!compactActionsHidden &&
@@ -243,6 +255,7 @@ export function WorkspaceLayout({
<WorkspaceSidebar
compactChrome={compactWorkspaceSidebar}
forceCollapsed={forceWorkspaceSidebarCollapsed}
wxCommonAgents={wxCommonAgents}
/>
)}
<SidebarInset
@@ -264,11 +277,14 @@ export function WorkspaceLayout({
}
export function ChatRuntime({ children }: { children: ReactNode }) {
const { data: uploadPolicy } = useUploadPolicy();
return (
<SubtasksProvider>
<DocumentRewritePresentationProvider>
<ArtifactsProvider>
<PromptInputProvider>{children}</PromptInputProvider>
<PromptInputProvider uploadPolicy={uploadPolicy}>
{children}
</PromptInputProvider>
</ArtifactsProvider>
</DocumentRewritePresentationProvider>
</SubtasksProvider>
@@ -412,6 +428,7 @@ function ChatThreadEntryRoute({
function AgentAwareChatThreadContent() {
const { thread_id: threadId } = useParams<{ thread_id: string }>();
const location = useLocation();
const routeBase = useRouteBase();
const [agentId, setAgentId] = useState<string | null>(null);
const [resolved, setResolved] = useState(false);
@@ -458,16 +475,145 @@ function AgentAwareChatThreadContent() {
if (threadId && agentId) {
return (
<Navigate
replace
to={`/page/workspace/agents/${encodeURIComponent(agentId)}/chats/${threadId}${location.search}`}
/>
<Navigate
replace
to={`${routeBase}/agents/${encodeURIComponent(agentId)}/chats/${threadId}${location.search}`}
/>
);
}
return <ChatPage />;
}
const WX_CHAT_ROUTE_BASE = "/page/workspace/wx";
type WorkspaceRouteLayoutProps = {
pageSidebarCollapsed: boolean;
pageSidebarHidden: boolean;
workspaceSidebarHidden: boolean;
headerHidden: boolean;
compactWorkspaceSidebar: boolean;
compactActionsHidden: boolean;
pageSidebarDark: boolean;
forceWorkspaceSidebarCollapsed: boolean;
};
/**
* Dedicated full-layout chat page for the wx workflow. It shares the normal
* chat composition but keeps its own route namespace and category-filtered
* common-agents sidebar.
*/
function WxChatLayout({
layoutProps,
children,
}: {
layoutProps: WorkspaceRouteLayoutProps;
children: ReactNode;
}) {
return (
<RouteBaseProvider value={WX_CHAT_ROUTE_BASE}>
<WorkspaceLayout
{...layoutProps}
defaultHistorySidebarOpen
wxCommonAgents
>
{children}
</WorkspaceLayout>
</RouteBaseProvider>
);
}
function WxNewChatEntryRoute({
layoutProps,
}: {
layoutProps: WorkspaceRouteLayoutProps;
}) {
return (
<WxChatLayout layoutProps={layoutProps}>
<ChatRuntime>
<NewChatContent />
</ChatRuntime>
</WxChatLayout>
);
}
function WxChatThreadEntryRoute({
layoutProps,
}: {
layoutProps: WorkspaceRouteLayoutProps;
}) {
return (
<WxChatLayout layoutProps={layoutProps}>
<ChatRuntime>
<AgentAwareChatThreadContent />
</ChatRuntime>
</WxChatLayout>
);
}
function WxAgentChatEntryRoute({
layoutProps,
}: {
layoutProps: WorkspaceRouteLayoutProps;
}) {
const { agent_id: agentId } = useParams<{ agent_id: string }>();
return (
<WxChatLayout layoutProps={layoutProps}>
<ChatRuntime>
<AgentChatPage key={agentId} />
</ChatRuntime>
</WxChatLayout>
);
}
function WxSentimentAgentChatEntryRoute({
layoutProps,
}: {
layoutProps: WorkspaceRouteLayoutProps;
}) {
return (
<WxChatLayout layoutProps={layoutProps}>
<SentimentAgentChatPage />
</WxChatLayout>
);
}
function WxChatsIndexEntryRoute({
layoutProps,
}: {
layoutProps: WorkspaceRouteLayoutProps;
}) {
return (
<WxChatLayout layoutProps={layoutProps}>
<ChatsPage compactChrome />
</WxChatLayout>
);
}
function WxAgentsEntryRoute({
layoutProps,
}: {
layoutProps: WorkspaceRouteLayoutProps;
}) {
return (
<WxChatLayout layoutProps={layoutProps}>
<AgentsPage restrictWxTypes />
</WxChatLayout>
);
}
function WxSkillsEntryRoute({
layoutProps,
}: {
layoutProps: WorkspaceRouteLayoutProps;
}) {
return (
<WxChatLayout layoutProps={layoutProps}>
<SkillsPage restrictWxTypes />
</WxChatLayout>
);
}
/**
* `chats_iframe` is reserved for the Brainy postMessage protocol. `from=iframe`
* and `chatMode=iframe` opt into this page; ordinary iframe/Wujie embedding
@@ -548,6 +694,58 @@ export default function WorkspaceRoutes({
<RouteBaseProvider value="/page/workspace">
<Routes>
<Route index element={<Navigate to="chats/new" replace />} />
<Route path="wx" element={<Navigate to="chats/new" replace />} />
<Route
path="wx/chats"
element={<WxChatsIndexEntryRoute layoutProps={layoutProps} />}
/>
<Route
path="wx/chats/new"
element={<WxNewChatEntryRoute layoutProps={layoutProps} />}
/>
<Route
path="wx/chats/:thread_id"
element={<WxChatThreadEntryRoute layoutProps={layoutProps} />}
/>
<Route
path="wx/agents"
element={<WxAgentsEntryRoute layoutProps={layoutProps} />}
/>
<Route
path="wx/skills"
element={<WxSkillsEntryRoute layoutProps={layoutProps} />}
/>
<Route
path="wx/agents/sentiment-analysis/chats"
element={
isSentimentAgentVisible() ? (
<Navigate
to="/page/workspace/wx/agents/sentiment-analysis/chats/new"
replace
/>
) : (
<Navigate to="/page/workspace/wx/chats/new" replace />
)
}
/>
<Route
path="wx/agents/sentiment-analysis/chats/:thread_id"
element={
isSentimentAgentVisible() ? (
<WxSentimentAgentChatEntryRoute layoutProps={layoutProps} />
) : (
<Navigate to="/page/workspace/wx/chats/new" replace />
)
}
/>
<Route
path="wx/agents/:agent_id/chats/:thread_id"
element={<WxAgentChatEntryRoute layoutProps={layoutProps} />}
/>
<Route
path="projects/*"
element={<Navigate to="/page/strategy/qa/projects" replace />}
/>
<Route
path="chats"
element={
@@ -620,6 +818,25 @@ export default function WorkspaceRoutes({
</WorkspaceLayout>
}
/>
{/* 智能体星轨视图:/agents 的另一种展示形式(手写 CSS 圆环星轨布局)。
字面量路由,置于 agents/:agent_id/* 参数路由之前。 */}
<Route
path="agents/orbit"
element={
<WorkspaceLayout {...layoutProps}>
<AgentsOrbitPage />
</WorkspaceLayout>
}
/>
{/* 智能体广场视图:/agents 的环形展台布局(底部类型球 + 左右智能体)。 */}
<Route
path="agents/plaza"
element={
<WorkspaceLayout {...layoutProps} insetOverflowHidden>
<AgentsPlazaPage />
</WorkspaceLayout>
}
/>
{/* 舆情分析虚拟智能体:静态段优先于 :agent_id 命中,走 Gateway 转发
外部 AG-UI 网关的专用对话页(不在后端 /api/agents 落库)。 */}
<Route
@@ -684,14 +901,6 @@ export default function WorkspaceRoutes({
</WorkspaceLayout>
}
/>
<Route
path="memory"
element={
<WorkspaceLayout {...layoutProps}>
<MemoryPage />
</WorkspaceLayout>
}
/>
<Route
path="ai-writing/*"
element={
@@ -854,6 +1063,14 @@ export default function WorkspaceRoutes({
</WorkspaceLayout>
}
/>
<Route
path="knowledge/retrieval-debug"
element={
<WorkspaceLayout {...layoutProps}>
<KnowledgeRetrievalDebugPage />
</WorkspaceLayout>
}
/>
<Route
path="knowledge/:noteId/wiki/view"
element={
@@ -878,6 +1095,14 @@ export default function WorkspaceRoutes({
</WorkspaceLayout>
}
/>
<Route
path="knowledge/:noteId/retrieval-debug"
element={
<WorkspaceLayout {...layoutProps}>
<WeKnoraRetrievalDebugPage />
</WorkspaceLayout>
}
/>
<Route
path="knowledge/markdown-editor"
element={
@@ -978,6 +1203,56 @@ export default function WorkspaceRoutes({
)
}
/>
{/* 用户排行榜(管理员)工作区挂载:简洁模式下 /page/strategy/* 没有任何左侧
导航(无 PageSidebar),「设置和更多」改走这两个工作区地址即可带上
WorkspaceSidebar;/page/strategy/admin/user-leaderboard 旧地址保留给
全量模式侧边栏菜单(sidebar-menu.ts mgmt-user-leaderboard)。 */}
<Route
path="admin/user-leaderboard"
element={
getStoredAuth()?.system_role === "admin" ? (
<WorkspaceLayout {...layoutProps}>
<AdminUserLeaderboardPage />
</WorkspaceLayout>
) : (
<Navigate to="/page/workspace/chats/new" replace />
)
}
/>
<Route
path="admin/user-leaderboard/settings"
element={
getStoredAuth()?.system_role === "admin" ? (
<WorkspaceLayout {...layoutProps}>
<AdminUserLeaderboardSettingsPage />
</WorkspaceLayout>
) : (
<Navigate to="/page/workspace/chats/new" replace />
)
}
/>
{/* 菜单管理工作区挂载:管理员维护默认菜单,普通用户维护个人菜单。 */}
<Route
path="admin/menu-management"
element={
<WorkspaceLayout {...layoutProps}>
<MenuManagementPage />
</WorkspaceLayout>
}
/>
{/* 问题配置(管理员)工作区挂载:同上。 */}
<Route
path="admin/fixed-questions"
element={
getStoredAuth()?.system_role === "admin" ? (
<WorkspaceLayout {...layoutProps}>
<FixedQuestionsPage />
</WorkspaceLayout>
) : (
<Navigate to="/page/workspace/chats/new" replace />
)
}
/>
<Route
path="admin/tags"
element={