From 4df604d491ee457d37753abcba60c8e29ac7d487 Mon Sep 17 00:00:00 2001 From: MT-Mint <798521692@qq.com> Date: Thu, 19 Mar 2026 17:33:47 +0800 Subject: [PATCH] style: prettier --- frontend/src/app/layout.tsx | 2 +- .../workspace/chats/[thread_id]/layout.tsx | 2 +- .../app/workspace/chats/[thread_id]/page.tsx | 501 +++++++++--------- frontend/src/app/workspace/layout.tsx | 2 +- .../src/components/ai-elements/artifact.tsx | 5 +- .../ai-elements/chain-of-thought.tsx | 2 +- .../src/components/ai-elements/suggestion.tsx | 2 +- frontend/src/components/ui/toggle-group.tsx | 4 +- .../artifacts/artifact-file-detail.tsx | 110 +++- .../src/components/workspace/input-box.tsx | 3 +- .../workspace/messages/message-list.tsx | 2 +- frontend/src/core/i18n/locales/zh-CN.ts | 3 +- frontend/src/core/iframe-messages.ts | 12 +- .../src/hooks/use-selected-skill-listener.ts | 12 +- 14 files changed, 371 insertions(+), 291 deletions(-) diff --git a/frontend/src/app/layout.tsx b/frontend/src/app/layout.tsx index d861be04..4a2f1953 100644 --- a/frontend/src/app/layout.tsx +++ b/frontend/src/app/layout.tsx @@ -25,7 +25,7 @@ export default async function RootLayout({ return ( diff --git a/frontend/src/app/workspace/chats/[thread_id]/layout.tsx b/frontend/src/app/workspace/chats/[thread_id]/layout.tsx index 3d540ccd..87710377 100644 --- a/frontend/src/app/workspace/chats/[thread_id]/layout.tsx +++ b/frontend/src/app/workspace/chats/[thread_id]/layout.tsx @@ -16,4 +16,4 @@ export default function ChatLayout({ ); -} \ No newline at end of file +} diff --git a/frontend/src/app/workspace/chats/[thread_id]/page.tsx b/frontend/src/app/workspace/chats/[thread_id]/page.tsx index dc887b11..77819192 100644 --- a/frontend/src/app/workspace/chats/[thread_id]/page.tsx +++ b/frontend/src/app/workspace/chats/[thread_id]/page.tsx @@ -252,10 +252,12 @@ export default function ChatPage() { return ( -
+
-
-
+
+
+ +
+
+ {title !== "Untitled" && ( + + )} +
+
+
+
+
+
+ +
+
+
+
+
+
-
- -
-
- {title !== "Untitled" && ( - - )} -
-
-
+ + {/* Fixed 底部居中输入框容器 */}
- {selectedArtifact ? ( - - ) : ( -
-
- + + {isNewThread && !hasSubmitted && ( + + )}
- {thread.values.artifacts?.length === 0 ? ( - } - title="No artifact selected" - description="Select an artifact to view its details" - /> - ) : ( -
-
-

- {t.common.artifacts} -

-
-
- -
-
- )} + } + disabled={ + env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true" || + isSelectedSkillBootstrapping + } + onContextChange={(context) => setSettings("context", context)} + onSubmit={handleSubmit} + onStop={handleStop} + /> + {isSelectedSkillBootstrapping && ( +
+ 正在初始化 Skill 文件... +
+ )} + {env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true" && ( +
+ {t.common.notAvailableInDemoMode}
)}
-
- {/* Fixed 底部居中输入框容器 */} -
-
+ + + 提示 + +

+ 退出后,当前会话结束并销毁,请先下载保存当前结果! +

+ + + + +
+ + + {/* selectedSkill 失败:错误弹窗 */} + { + if (!open) clearSelectedSkillError(); + }} > - - {isNewThread && !hasSubmitted && } -
- } - disabled={ - env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true" || - isSelectedSkillBootstrapping - } - onContextChange={(context) => setSettings("context", context)} - onSubmit={handleSubmit} - onStop={handleStop} - /> - {isSelectedSkillBootstrapping && ( -
- 正在初始化 Skill 文件... -
- )} - {env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true" && ( -
- {t.common.notAvailableInDemoMode} -
- )} -
-
+ + + + ⚠️ {selectedSkillError?.title ?? "技能加载失败"} + + +

+ {selectedSkillError?.message ?? "发生了未知错误,请稍后重试。"} +

+ + + +
+ - {/* 退出确认对话框 */} - - - - 提示 - -

- 退出后,当前会话结束并销毁,请先下载保存当前结果! -

- - - - -
-
- - {/* selectedSkill 失败:错误弹窗 */} - { - if (!open) clearSelectedSkillError(); - }} - > - - - - ⚠️ {selectedSkillError?.title ?? "技能加载失败"} - - -

- {selectedSkillError?.message ?? "发生了未知错误,请稍后重试。"} -

- - - -
-
- - {/* MARK: 开发测试:iframe 通信功能测试面板 */} - {/* */} + {/* MARK: 开发测试:iframe 通信功能测试面板 */} + {/* */}
); diff --git a/frontend/src/app/workspace/layout.tsx b/frontend/src/app/workspace/layout.tsx index 285aa93e..98b869b4 100644 --- a/frontend/src/app/workspace/layout.tsx +++ b/frontend/src/app/workspace/layout.tsx @@ -76,4 +76,4 @@ export default function WorkspaceLayout({ /> ); -} \ No newline at end of file +} diff --git a/frontend/src/components/ai-elements/artifact.tsx b/frontend/src/components/ai-elements/artifact.tsx index 03ebd13f..c02eb5ee 100644 --- a/frontend/src/components/ai-elements/artifact.tsx +++ b/frontend/src/components/ai-elements/artifact.tsx @@ -30,10 +30,7 @@ export const ArtifactHeader = ({ ...props }: ArtifactHeaderProps) => (
); diff --git a/frontend/src/components/ai-elements/chain-of-thought.tsx b/frontend/src/components/ai-elements/chain-of-thought.tsx index 1b61a51d..a8891821 100644 --- a/frontend/src/components/ai-elements/chain-of-thought.tsx +++ b/frontend/src/components/ai-elements/chain-of-thought.tsx @@ -150,7 +150,7 @@ export const ChainOfThoughtStep = memo( {isValidElement(Icon) ? ( Icon ) : ( - + )}
diff --git a/frontend/src/components/ai-elements/suggestion.tsx b/frontend/src/components/ai-elements/suggestion.tsx index a640835d..a7f3b033 100644 --- a/frontend/src/components/ai-elements/suggestion.tsx +++ b/frontend/src/components/ai-elements/suggestion.tsx @@ -62,7 +62,7 @@ export const Suggestion = ({
- {isCodeFile && ( - - - - - + + + + + - - - - - + + + + +
); diff --git a/frontend/src/components/workspace/input-box.tsx b/frontend/src/components/workspace/input-box.tsx index b1aea4b8..8255cfe6 100644 --- a/frontend/src/components/workspace/input-box.tsx +++ b/frontend/src/components/workspace/input-box.tsx @@ -142,7 +142,8 @@ export function InputBox({ const [isFocused, setIsFocused] = useState(false); // isNewThread 时禁用收缩,始终保持展开(除非已提交消息) - const effectiveIsFocused = (isNewThread ?? false) && !hasSubmitted || isFocused; + const effectiveIsFocused = + ((isNewThread ?? false) && !hasSubmitted) || isFocused; // 点击外部区域时收起输入框 useEffect(() => { diff --git a/frontend/src/components/workspace/messages/message-list.tsx b/frontend/src/components/workspace/messages/message-list.tsx index 40bbd391..aa7947f2 100644 --- a/frontend/src/components/workspace/messages/message-list.tsx +++ b/frontend/src/components/workspace/messages/message-list.tsx @@ -57,7 +57,7 @@ export function MessageList({ - + {groupMessages(messages, (group) => { if (group.type === "human" || group.type === "assistant") { return ( diff --git a/frontend/src/core/i18n/locales/zh-CN.ts b/frontend/src/core/i18n/locales/zh-CN.ts index a6ca26c3..32551209 100644 --- a/frontend/src/core/i18n/locales/zh-CN.ts +++ b/frontend/src/core/i18n/locales/zh-CN.ts @@ -105,7 +105,8 @@ export const zhCN: Translations = { suggestions: [ { suggestion: "自媒体文案", - prompt: "为[主题/产品]撰写吸引人的自媒体文案,包括标题、正文和话题标签。", + prompt: + "为[主题/产品]撰写吸引人的自媒体文案,包括标题、正文和话题标签。", icon: PenLineIcon, skill_id: "432", }, diff --git a/frontend/src/core/iframe-messages.ts b/frontend/src/core/iframe-messages.ts index d57849a7..9a28b2f1 100644 --- a/frontend/src/core/iframe-messages.ts +++ b/frontend/src/core/iframe-messages.ts @@ -22,8 +22,10 @@ export const RECEIVE_MESSAGE_TYPES = { } as const; // 消息类型 -export type PostMessageType = (typeof POST_MESSAGE_TYPES)[keyof typeof POST_MESSAGE_TYPES]; -export type ReceiveMessageType = (typeof RECEIVE_MESSAGE_TYPES)[keyof typeof RECEIVE_MESSAGE_TYPES]; +export type PostMessageType = + (typeof POST_MESSAGE_TYPES)[keyof typeof POST_MESSAGE_TYPES]; +export type ReceiveMessageType = + (typeof RECEIVE_MESSAGE_TYPES)[keyof typeof RECEIVE_MESSAGE_TYPES]; // 消息数据类型 export interface FullscreenMessage { @@ -48,8 +50,10 @@ export interface SelectedSkillMessage { } // 发送消息的辅助函数 -export function sendToParent(message: FullscreenMessage | SelectSkillMessage | OpenSkillDialogMessage): void { +export function sendToParent( + message: FullscreenMessage | SelectSkillMessage | OpenSkillDialogMessage, +): void { if (window.parent !== window) { window.parent.postMessage(message, "*"); } -} \ No newline at end of file +} diff --git a/frontend/src/hooks/use-selected-skill-listener.ts b/frontend/src/hooks/use-selected-skill-listener.ts index 8a295a3b..fc20d66d 100644 --- a/frontend/src/hooks/use-selected-skill-listener.ts +++ b/frontend/src/hooks/use-selected-skill-listener.ts @@ -70,7 +70,9 @@ export function useSelectedSkillListener({ return; } - console.log(`[useSelectedSkillListener] 开始初始化技能: ${title} (${id})`); + console.log( + `[useSelectedSkillListener] 开始初始化技能: ${title} (${id})`, + ); setIsBootstrapping(true); toast.loading(`正在加载技能「${title}」...`, { id: "skill-bootstrap" }); @@ -88,7 +90,8 @@ export function useSelectedSkillListener({ if (result.success) { skillBootstrappedKeyRef.current = initKey; toast.success(`技能「${title}」加载成功`, { - description: result.message || `已创建 ${result.created_files} 个文件`, + description: + result.message || `已创建 ${result.created_files} 个文件`, duration: 4000, }); } else { @@ -127,7 +130,10 @@ export function useSelectedSkillListener({ if (data?.type !== "selectedSkill") return; const { id, title } = data; - console.log("[useSelectedSkillListener] 收到 postMessage selectedSkill:", data); + console.log( + "[useSelectedSkillListener] 收到 postMessage selectedSkill:", + data, + ); setSelectedSkill({ skill_id: String(id), title }); void performBootstrap(id, title);