From d9c9c8f24239ff59091312dfcd18e3ddfea87905 Mon Sep 17 00:00:00 2001 From: MT-Fire <798521692@qq.com> Date: Sat, 11 Apr 2026 21:42:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(route):=20=E5=89=8D=E5=BE=80=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D=E9=A1=B5=E7=9A=84=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/workspace/chats/[thread_id]/page.tsx | 38 ++++++++----------- .../src/components/workspace/input-box.tsx | 29 +++++++++++++- frontend/src/core/i18n/locales/en-US.ts | 1 + frontend/src/core/i18n/locales/types.ts | 1 + frontend/src/core/i18n/locales/zh-CN.ts | 1 + 5 files changed, 46 insertions(+), 24 deletions(-) diff --git a/frontend/src/app/workspace/chats/[thread_id]/page.tsx b/frontend/src/app/workspace/chats/[thread_id]/page.tsx index 8fb9a478..9a06eb4b 100644 --- a/frontend/src/app/workspace/chats/[thread_id]/page.tsx +++ b/frontend/src/app/workspace/chats/[thread_id]/page.tsx @@ -527,37 +527,31 @@ export default function ChatPage() { )} > {!(showWelcomeStyle && thread.isThreadLoading) ? ( - - {showWelcomeStyle && !hasSubmitted && ( - - )} - - } - disabled={ - env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true" || + extraHeader={
+ {showWelcomeStyle && !hasSubmitted && ( + + )} +
} + disabled={env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true" || isSelectedSkillBootstrapping || isUploading || - (isNewThread && !safeThreadId) - } + (isNewThread && !safeThreadId)} onContextChange={(context) => setSettings("context", context)} onSubmit={handleSubmit} - onStop={handleStop} - /> + onStop={handleStop} /> + ) : ( // '' @@ -583,7 +577,7 @@ export default function ChatPage() { 提示

- (测试中:计划销毁但是现在没有销毁) 退出后,当前会话结束并销毁,请先下载保存当前结果! + 历史记录每七天自动删除,现在将返回欢迎页,是否继续?

+ + + + + {/* 场景 2:skill 选择通信 */} +
+
+ ② postMessage 通信(发送到宿主) +
+
+ + + + +
+
+ + {/* 场景 3:接收宿主页 selectedSkill */} +
+
+ ③ 接收宿主页 selectedSkill +
+
+ + + + +
+
+ + {/* 场景 4:剪贴板复制(iframe 通信) */} +
+
+ + ④ 剪贴板复制(iframe 通信) + - {isSkillMode ? "skill ✅" : "普通"} + {isInIframe ? "iframe 模式" : "独立页面"} - - - selectedSkill: - - {iframeSkill.selectedSkill - ? `${iframeSkill.selectedSkill.skill_id} / ${iframeSkill.selectedSkill.title}` - : "无"} - - -
-
- - {/* 场景 1:侧边栏隐藏 */} -
-
- ① 侧边栏隐藏(layout) -
-
- - -
-
- - {/* 场景 2:skill 选择通信 */} -
-
- ② postMessage 通信(发送到宿主) -
-
- - - - -
-
- - {/* 场景 3:接收宿主页 selectedSkill */} -
-
- ③ 接收宿主页 selectedSkill -
-
- - - - -
-
- - {/* 场景 4:剪贴板复制(iframe 通信) */} -
-
- - ④ 剪贴板复制(iframe 通信) - - - {isInIframe ? "iframe 模式" : "独立页面"} - -
-
- -
- {isInIframe - ? "将通过 postMessage 请求父页面复制" - : "将直接调用 navigator.clipboard"}
-
-
- - {/* 场景 5:is_chatting */} -
-
- ⑤ is_chatting -
-
- - -
-
- - {/* 日志 */} - {log.length > 0 && ( -
-
- 操作日志 -
- {log.map((l, i) => ( -
+ +
+ {isInIframe + ? "将通过 postMessage 请求父页面复制" + : "将直接调用 navigator.clipboard"}
- ))} +
- )} - } + + {/* 场景 5:is_chatting */} +
+
+ ⑤ is_chatting +
+
+ + +
+
+ + {/* 日志 */} + {log.length > 0 && ( +
+
+ 操作日志 +
+ {log.map((l, i) => ( +
+ {l} +
+ ))} +
+ )} + + )} ); } diff --git a/frontend/src/components/workspace/input-box.tsx b/frontend/src/components/workspace/input-box.tsx index a154cd27..641e5628 100644 --- a/frontend/src/components/workspace/input-box.tsx +++ b/frontend/src/components/workspace/input-box.tsx @@ -2,8 +2,6 @@ import { useRouter } from "next/navigation"; - - import type { ChatStatus } from "ai"; import { CheckIcon, @@ -62,9 +60,7 @@ import { } from "@/components/ui/dropdown-menu"; import { Tag } from "@/components/ui/tag"; import { useI18n } from "@/core/i18n/hooks"; -import type { - SelectedSkillPayloadItem, -} from "@/core/i18n/locales/types"; +import type { SelectedSkillPayloadItem } from "@/core/i18n/locales/types"; import { POST_MESSAGE_TYPES, sendToParent } from "@/core/iframe-messages"; import { useModels } from "@/core/models/hooks"; import type { AgentThreadContext } from "@/core/threads"; @@ -367,7 +363,7 @@ export function InputBox({ className={cn( "flex transition-all duration-300 ease-out", !effectiveIsFocused && - "pointer-events-none invisible h-[0px] translate-y-2 p-[0px] opacity-0", + "pointer-events-none invisible h-[0px] translate-y-2 p-[0px] opacity-0", )} > @@ -380,7 +376,7 @@ export function InputBox({ /> */} - - {showWelcomeStyle && !hasSubmitted && searchParams.get("mode") !== "skill" && ( - - )} + {showWelcomeStyle && + !hasSubmitted && + searchParams.get("mode") !== "skill" && ( + + )} {!disabled && !showWelcomeStyle && @@ -543,19 +541,19 @@ function SuggestionList({ const promptSuggestions = suggestions.filter( ( suggestion, - ): suggestion is Exclude<(typeof suggestions)[number], { type: "separator" }> => - !("type" in suggestion), + ): suggestion is Exclude< + (typeof suggestions)[number], + { type: "separator" } + > => !("type" in suggestion), ); const handleSuggestionClick = useCallback( - ( - suggestion: { - prompt: string; - skill_id?: string[]; - children?: SelectedSkillPayloadItem[]; - suggestion: string; - }, - ) => { + (suggestion: { + prompt: string; + skill_id?: string[]; + children?: SelectedSkillPayloadItem[]; + suggestion: string; + }) => { if (isBootstrapping) return; // 优先使用 children 中的 skill(保留每个 skill 自己的 name,用于 tag 展示) @@ -564,8 +562,9 @@ function SuggestionList({ id: String(item.id).trim(), name: item.name?.trim() ?? "", })) - .filter((item): item is { id: string; name: string } => - Boolean(item.id) && Boolean(item.name), + .filter( + (item): item is { id: string; name: string } => + Boolean(item.id) && Boolean(item.name), ); if (childSkills.length > 0) { void bootstrapAndLockSkills({ @@ -604,7 +603,10 @@ function SuggestionList({ [bootstrapAndLockSkills, isBootstrapping, textInput], ); return ( - + {promptSuggestions.map((suggestion) => ( router.replace(`/workspace/chats/${threadId}?is_chatting=true`)}> - + onClick={() => + router.replace(`/workspace/chats/${threadId}?is_chatting=true`) + } + > + + + ); @@ -705,14 +726,17 @@ function IframeSkillDialogButton({ ) : null} {!isBootstrapping && selectedSkills.length > 0 ? (
{ if (event.deltaY === 0) return; event.currentTarget.scrollLeft += event.deltaY; }} > {selectedSkills.map((skill, index) => ( - + {skill.title} {/* TODO: 因为后端接口不支持取消选择skill,所以暂时禁用取消选择按钮 */}