From 255b99e967494ac7ebdd60a426a91502df0069c3 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Fri, 6 Nov 2026 17:09:10 +0800 Subject: [PATCH] feat: chat theme --- ui/src/api/chat/README.md | 6 ++-- ui/src/api/types/chat-auth.ts | 1 + .../components/content/items/form.vue | 11 +++--- .../items/tool/components/ScrollDiff.vue | 2 +- .../components/header/debug/index.vue | 2 +- ui/src/conversation-panel/index.scss | 6 ++-- .../left-sidebar/conversation-list/index.vue | 7 ++-- .../conversation-panel/view/debug/index.vue | 4 +-- ui/src/stores/chat/auth.ts | 17 +++++++--- ui/src/stores/chat/index.ts | 4 +++ ui/src/stores/chat/theme.ts | 34 +++++++++++++++++++ ui/src/styles/STYLE_README.md | 8 +++++ ui/src/styles/element-plus.scss | 6 ++-- .../components/DisplaySettingPreview.vue | 6 ++-- .../components/ButtonCreateApplication.vue | 4 +-- .../components/ButtonCreateKnowledge.vue | 8 ++--- .../ai-generate/panel/AiGeneratePanel.vue | 2 +- .../execution-details/DetailContainer.vue | 2 +- ui/src/workflow-canvas/index.vue | 2 +- 19 files changed, 95 insertions(+), 37 deletions(-) create mode 100644 ui/src/stores/chat/theme.ts diff --git a/ui/src/api/chat/README.md b/ui/src/api/chat/README.md index 00fb0355d5d..a0105c0e673 100644 --- a/ui/src/api/chat/README.md +++ b/ui/src/api/chat/README.md @@ -19,8 +19,10 @@ Chat 业务接口统一调用后端 v3 路由(`/chat/api/v3/...`);文件 可选进度回调及取消,统一返回 `{ request, abort }`。`request` 解包得到文件地址; 取消仍拒绝 Promise,但不弹出通用错误提示。loading 由调用方管理。 -`auth.ts` 维护门户与单应用的认证:`getApplicationAuthProfile(accessToken)` 请求 `/profile`, -`getPortalAuthProfile()` 请求 `/portal/profile`,两者返回结构相同的 `AuthProfile`,差异字段在 `meta`。 +`auth.ts` 维护门户与单应用的认证:`getApplicationAuthProfile(accessToken)` 请求 `/v3/profile`, +`getPortalAuthProfile()` 请求 `/v3/portal/profile`,两者返回结构相同的 `AuthProfile`,差异字段在 `meta`。 +主题配置位于响应顶层 `custom_theme`,不在 `meta` 内;Chat Auth Store 获取或复用该配置后, +显式应用 `custom_theme.theme_color`,登录页与正式对话共用此主题。 `postAnonymousAuth(accessToken?)` 与 `postLogin(loginRequest, accessToken?)` 传入 accessToken 时为应用认证, 否则为门户认证。`getCaptcha(username, accessToken)` 获取应用登录验证码,后端以 `accessToken` 查询参数接收应用令牌,暂不支持门户。`chat-user.ts` 的 `getChatUserProfile()` 获取当前对话用户。 diff --git a/ui/src/api/types/chat-auth.ts b/ui/src/api/types/chat-auth.ts index aeef796485f..1cef88a07ab 100644 --- a/ui/src/api/types/chat-auth.ts +++ b/ui/src/api/types/chat-auth.ts @@ -10,6 +10,7 @@ export interface AuthProfile> { login_value: LoginMethod[] rsa_key: string logo: string + custom_theme?: { theme_color?: string; header_font_color?: string } | null meta: Meta } diff --git a/ui/src/conversation-panel/components/content/items/form.vue b/ui/src/conversation-panel/components/content/items/form.vue index 1d0ae4c910b..dbaaa4fbed6 100644 --- a/ui/src/conversation-panel/components/content/items/form.vue +++ b/ui/src/conversation-panel/components/content/items/form.vue @@ -4,7 +4,7 @@ import { MkDynamicsForm } from '@/components/mk-dynamics-form' import type { DynamicFormValue, FormField } from '@/components/mk-dynamics-form' import type { Dict } from '@/api/types' import { useSendMessageOptional } from '@/conversation-panel/components/message-list/index' -import { useViewType, VIEW_TYPE, type ViewType } from "@/conversation-panel/view/index" +import { useViewType, VIEW_TYPE, type ViewType } from '@/conversation-panel/view/index' defineOptions({ name: 'ConversationFormContent' }) const viewType = useViewType() // 发送能力由消息列表或外部宿主 provide;拿不到 → 只读降级 @@ -57,17 +57,14 @@ const submit = async () => { } } const READONLY_VIEWS: readonly ViewType[] = [VIEW_TYPE.LOG, VIEW_TYPE.SHARE] -