From abd0e28af733dfc62e5088e66409efd051fcfe29 Mon Sep 17 00:00:00 2001 From: Innei Date: Tue, 12 Aug 2025 21:02:55 +0800 Subject: [PATCH] feat(ai): support switch ai panel style in ai setting - Added a new PanelStyleSegment component to manage AI chat panel styles, allowing users to select between fixed and floating layouts. - Updated localization files to include new strings for panel style settings. - Refactored existing components to integrate the new panel style options, improving user configurability and experience. These changes collectively enhance the flexibility and usability of the AI chat interface, providing users with better control over their layout preferences. Signed-off-by: Innei --- .../components/layouts/ChatMoreDropdown.tsx | 2 +- .../settings/modal/SettingModalContent.tsx | 4 +- .../renderer/src/modules/settings/tabs/ai.tsx | 47 +++++++++++++++++-- locales/ai/en.json | 8 +++- 4 files changed, 51 insertions(+), 10 deletions(-) diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatMoreDropdown.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatMoreDropdown.tsx index 5102cc38a..5dc3497a1 100644 --- a/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatMoreDropdown.tsx +++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatMoreDropdown.tsx @@ -174,7 +174,7 @@ export const ChatMoreDropdown = () => { {panelStyle === AIChatPanelStyle.Fixed diff --git a/apps/desktop/layer/renderer/src/modules/settings/modal/SettingModalContent.tsx b/apps/desktop/layer/renderer/src/modules/settings/modal/SettingModalContent.tsx index 603dca129..11a83d72b 100644 --- a/apps/desktop/layer/renderer/src/modules/settings/modal/SettingModalContent.tsx +++ b/apps/desktop/layer/renderer/src/modules/settings/modal/SettingModalContent.tsx @@ -50,9 +50,9 @@ const Content = () => { div]:min-h-full [&>div]:relative", + "px-1 min-h-full [&>div]:min-h-full [&>div]:relative pl-8 pr-7", config.viewportClassName, )} > diff --git a/apps/desktop/layer/renderer/src/modules/settings/tabs/ai.tsx b/apps/desktop/layer/renderer/src/modules/settings/tabs/ai.tsx index 3c10ce130..8b2dcaebf 100644 --- a/apps/desktop/layer/renderer/src/modules/settings/tabs/ai.tsx +++ b/apps/desktop/layer/renderer/src/modules/settings/tabs/ai.tsx @@ -8,9 +8,15 @@ import { useState } from "react" import { useTranslation } from "react-i18next" import { toast } from "sonner" -import { setAISetting, useAISettingValue } from "~/atoms/settings/ai" +import { + AIChatPanelStyle, + setAIChatPanelStyle, + setAISetting, + useAIChatPanelStyle, + useAISettingValue, +} from "~/atoms/settings/ai" -import { SettingActionItem, SettingDescription } from "../control" +import { SettingActionItem, SettingDescription, SettingTabbedSegment } from "../control" import { createDefineSettingItem } from "../helper/builder" import { createSettingBuilder } from "../helper/setting-builder" @@ -28,9 +34,11 @@ export const SettingAI = () => { type: "title", value: t("features.title"), }, + + PanelStyleSegment, defineSettingItem("autoScrollWhenStreaming", { - label: t("autoScrollWhenStreaming.label"), - description: t("autoScrollWhenStreaming.description"), + label: t("settings.autoScrollWhenStreaming.label"), + description: t("settings.autoScrollWhenStreaming.description"), }), { @@ -87,7 +95,7 @@ const PersonalizePromptSetting = () => {
-
+