Merge: 解决 ScheduledTaskRunDetailPage 合并冲突

保留 HEAD 的编辑功能 import(useCallback、Edit3、Loader2、Save、X),
同时采用 b78672 中的 useRouteNavigate 自定义导航 hook。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
吉鑫升andClaude Sonnet 4.6 committed 2026-05-14 19:29:35 +08:00
commit 28948975db
77 files changed
+19667 -159

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
import { createContext, useCallback, useContext } from "react";
import { useNavigate, type NavigateOptions } from "react-router-dom";
export const RouteBaseContext = createContext("/page/workspace");
export const RouteBaseProvider = RouteBaseContext.Provider;
export function useRouteBase() {
return useContext(RouteBaseContext);
}
export function useRouteNavigate() {
const navigate = useNavigate();
const base = useRouteBase();
return useCallback(
(path: string | number, opts?: NavigateOptions) => {
if (typeof path === "string") {
navigate(path.replace("/page/workspace", base), opts);
} else {
navigate(path);
}
},
[navigate, base],
);
}
+11 -2
View File
@@ -1,5 +1,7 @@
import { useContext } from "react";
import type { Message } from "@langchain/langgraph-sdk";
import { RouteBaseContext } from "@/core/route-base";
import type { AgentThread, AgentThreadContext } from "./types";
type ThreadAgentRef = Pick<AgentThreadContext, "agent_id" | "agent_name">;
@@ -28,6 +30,7 @@ function pickAgentRef(
export function pathOfThread(
thread: ThreadRouteTarget,
context?: ThreadAgentRef | null,
base = "/page/workspace",
) {
const threadId = typeof thread === "string" ? thread : thread.thread_id;
const agentRef =
@@ -36,8 +39,14 @@ export function pathOfThread(
: pickAgentRef(thread.context, thread.metadata);
return agentRef
? `/page/workspace/agents/${encodeURIComponent(agentRef)}/chats/${threadId}`
: `/page/workspace/chats/${threadId}`;
? `${base}/agents/${encodeURIComponent(agentRef)}/chats/${threadId}`
: `${base}/chats/${threadId}`;
}
export function usePathOfThread() {
const base = useContext(RouteBaseContext);
return (thread: ThreadRouteTarget, context?: ThreadAgentRef | null) =>
pathOfThread(thread, context, base);
}
export function textOfMessage(message: Message) {