sync update from LAN repo (source dhk-1 @ 3b1ec5b4)

This commit is contained in:
gozeros committed 2026-11-05 10:56:34 +08:00
1 parent da6521b6cb
commit 264e2200d6
995 files changed
+148105 -13399

No files matched your search

+128 -3
View File
@@ -1,12 +1,19 @@
import { lazy, type ReactNode } from "react";
import { lazy, type ReactNode, useEffect } from "react";
import { useLayoutMode } from "@/core/system-settings/hooks";
import { isEmbedActive, isHideChromeActive } from "@/core/embed/embed-session";
import { Navigate, Route, Routes, useParams } from "react-router-dom";
import { Toaster } from "sonner";
import { Navigate, Route, Routes, useLocation, useNavigate, useParams } from "react-router-dom";
import { Toaster, toast } from "sonner";
import { SidebarInset, SidebarProvider, SidebarTrigger } from "@/components/ui/sidebar";
import { WorkspaceSidebar } from "@/components/workspace/workspace-sidebar";
import { getAccountDisplayName, getStoredAuth } from "@/core/auth";
import { readTaskContext } from "@/core/auth/task-purpose";
import {
persistCopTaskDetail,
prefetchTaskDeeplink,
resolveTaskDeeplinkTarget,
stubCopTaskDetail,
} from "@/core/auth/task-deeplink";
import { isSentimentAgentVisible } from "@/core/sentiment-agent/config";
import { RouteBaseProvider } from "@/core/route-base";
import "@/roundtable-planning/styles/roundtable-planning.css";
@@ -142,6 +149,7 @@ const FixedQuestionsPage = lazy(() => import("./FixedQuestionsPage"));
const SensitiveWordsPage = lazy(() => import("./SensitiveWordsPage"));
const SkillAddressesPage = lazy(() => import("./SkillAddressesPage"));
const TaskButtonsPage = lazy(() => import("./TaskButtonsPage"));
const HtmlTemplatesPage = lazy(() => import("./HtmlTemplatesPage"));
const PositionRolesPage = lazy(() => import("./PositionRolesPage"));
const RoundtableDiagnosticsPage = lazy(() => import("./RoundtableDiagnosticsPage"));
const LightAppNewNotePage = lazy(() => import("./LightAppNewNotePage"));
@@ -162,6 +170,7 @@ const UsersPage = lazy(() => import("./UsersPage"));
const LlmMetricsPage = lazy(() => import("./LlmMetricsPage"));
const AdminScheduledTasksPage = lazy(() => import("./AdminScheduledTasksPage"));
const AdminUserActivityPage = lazy(() => import("./AdminUserActivityPage"));
const AdminAuditRetentionPage = lazy(() => import("./AdminAuditRetentionPage"));
const StrategyProjectsPage = lazy(
() => import("@/strategy-selection/StrategyProjectsPage"),
);
@@ -209,6 +218,97 @@ function StrategyProjectWorkbenchRoute() {
return <StrategySelectionPage key={projectId} projectId={projectId} />;
}
/**
* A custom business mapping's single-agent landing page.
*
* It intentionally has no task-workspace or agent-gallery left rail. The
* deep-link target adds `hideChrome=1`, so PageLayout also suppresses the
* global header and navigation sidebar for this clean entry surface.
*/
function CustomDeeplinkAgentChatRoute() {
const { agent_id: agentId = "" } = useParams<{ agent_id: string }>();
const context = readTaskContext();
const chatBasePath = `/page/strategy/custom-deeplink/${encodeURIComponent(agentId)}/chats`;
return (
<ChatRuntime>
<AgentChatPage
chatBasePath={chatBasePath}
taskBind
taskGoPath={context?.goPath}
hideTaskStartButton
/>
</ChatRuntime>
);
}
/**
* 已登录用户的自定义业务深链入口。
*
* 入口示例:
* ``#/page/strategy/custom-deeplink-entry?goPath=区域研判&hideChrome=1``。
* 它不经过 LoginPage,因此不会清理或重新建立当前登录会话;解析成功后复用与登录
* 深链一致的任务上下文、智能体/业务链配置与无全局 chrome 的落地页。
*/
function CustomDeeplinkEntryRoute() {
const { search } = useLocation();
const navigate = useNavigate();
const query = new URLSearchParams(search);
const taskId = query.get("taskId")?.trim() ?? "";
const goPath = query.get("goPath")?.trim() ?? "";
useEffect(() => {
let cancelled = false;
async function openDeeplink() {
if (!goPath) {
toast.error("缺少 goPath,无法打开自定义业务入口");
navigate("/page/strategy/qa/general", { replace: true });
return;
}
try {
let resolvedTaskId = taskId;
let detail = stubCopTaskDetail(taskId);
if (taskId) {
const prefetch = prefetchTaskDeeplink(taskId, goPath);
resolvedTaskId = (await prefetch.realTaskId) || taskId;
detail = (await prefetch.taskDetail) ?? stubCopTaskDetail(resolvedTaskId);
persistCopTaskDetail(detail);
}
if (cancelled) return;
const target = await resolveTaskDeeplinkTarget(
goPath,
detail,
resolvedTaskId,
taskId || undefined,
);
if (cancelled) return;
if (!target) {
toast.error("未找到该自定义类型的智能体或业务链配置");
navigate("/page/strategy/qa/general", { replace: true });
return;
}
navigate(target.path, { replace: true, state: target.state });
} catch (error) {
console.warn("[custom-deeplink-entry] resolve failed", { goPath, taskId, error });
if (cancelled) return;
toast.error("自定义业务入口跳转失败");
navigate("/page/strategy/qa/general", { replace: true });
}
}
void openDeeplink();
return () => { cancelled = true; };
}, [goPath, navigate, taskId]);
return (
<div className="text-muted-foreground flex size-full items-center justify-center text-sm">
正在打开业务入口…
</div>
);
}
export default function StrategyRoutes() {
const storedAuth = getStoredAuth();
const canManageBusinessMappings = !storedAuth || storedAuth.system_role === "admin";
@@ -567,6 +667,11 @@ export default function StrategyRoutes() {
</ChatRuntime>
}
/>
<Route
path="custom-deeplink/:agent_id/chats/:thread_id"
element={<CustomDeeplinkAgentChatRoute />}
/>
<Route path="custom-deeplink-entry" element={<CustomDeeplinkEntryRoute />} />
<Route path="skills" element={<SkillsPage />} />
<Route path="skills/evolution" element={<SkillEvolutionPage />} />
@@ -689,6 +794,16 @@ export default function StrategyRoutes() {
)
}
/>
<Route
path="admin/html-templates"
element={
getStoredAuth()?.system_role === "admin" ? (
<HtmlTemplatesPage />
) : (
<Navigate to="/page/workspace/chats/new" replace />
)
}
/>
<Route
path="admin/position-roles"
element={
@@ -770,6 +885,16 @@ export default function StrategyRoutes() {
)
}
/>
<Route
path="admin/audit-retention"
element={
getStoredAuth()?.system_role === "admin" ? (
<AdminAuditRetentionPage />
) : (
<Navigate to="/page/workspace/chats/new" replace />
)
}
/>
<Route
path="admin/tags"
element={<TagsPage />}