Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 style(settings): unify select width and migrate to base-ui Select on service-model (#15248)

Innei718096e306d0
diff --git a/src/features/ServiceModel/ModelAssignmentsForm.tsx b/src/features/ServiceModel/ModelAssignmentsForm.tsx
index df2fe2faec9..c699942a7a1 100644
--- a/src/features/ServiceModel/ModelAssignmentsForm.tsx
+++ b/src/features/ServiceModel/ModelAssignmentsForm.tsx
@@ -89,7 +89,7 @@ const ModelAssignmentsForm = memo(() => {
const defaultAgentItem: FormItemProps = {
children: (
- <Flexbox align="center" direction="horizontal" gap={12} style={{ width: 'min(100%, 448px)' }}>
+ <Flexbox align="center" direction="horizontal" gap={12} style={{ width: 448 }}>
<ModelSelect
showAbility={false}
style={{ minWidth: 0, width: '100%' }}
@@ -100,7 +100,6 @@ const ModelAssignmentsForm = memo(() => {
),
desc: t('defaultAgent.model.desc'),
label: t('defaultAgent.title'),
- minWidth: undefined,
};
const systemModelItems: FormItemProps[] = SYSTEM_AGENT_MODEL_ITEMS.map(({ key }) => {
@@ -112,7 +111,7 @@ const ModelAssignmentsForm = memo(() => {
align="center"
direction="horizontal"
gap={12}
- style={{ width: 'min(100%, 448px)' }}
+ style={{ width: 448 }}
>
<ModelSelect
showAbility={false}
@@ -124,7 +123,6 @@ const ModelAssignmentsForm = memo(() => {
),
desc: t(`systemAgent.${key}.modelDesc`),
label: t(`systemAgent.${key}.title`),
- minWidth: undefined,
} satisfies FormItemProps;
});
@@ -133,7 +131,7 @@ const ModelAssignmentsForm = memo(() => {
return {
children: (
- <Flexbox direction="vertical" gap={8} style={{ width: 'min(100%, 448px)' }}>
+ <Flexbox direction="vertical" gap={8} style={{ width: 448 }}>
<ModelSelect
showAbility={false}
style={{ minWidth: 0, width: '100%' }}
@@ -157,7 +155,6 @@ const ModelAssignmentsForm = memo(() => {
),
desc: t(`systemAgent.${key}.modelDesc`),
label: t(`systemAgent.${key}.title`),
- minWidth: undefined,
} satisfies FormItemProps;
});
@@ -167,24 +164,19 @@ const ModelAssignmentsForm = memo(() => {
return {
children: (
- <Flexbox
- align="center"
- direction="horizontal"
- gap={12}
- style={{ width: 'min(100%, 448px)' }}
- >
- <ModelSelect
- showAbility={false}
- style={{ minWidth: 0, width: '100%' }}
- value={value}
- onChange={(props) => updateSystemAgentModel(key, props)}
+ <Flexbox align="center" direction="horizontal" gap={12}>
+ <Switch
+ aria-label={t(`systemAgent.${key}.title`)}
+ checked={value.enabled}
+ loading={loadingKey === key}
+ onChange={(enabled) => updateSystemAgentModel(key, { enabled })}
/>
- <Flexbox align="center" direction="horizontal" gap={8}>
- <Switch
- aria-label={t(`systemAgent.${key}.title`)}
- checked={value.enabled}
- loading={loadingKey === key}
- onChange={(enabled) => updateSystemAgentModel(key, { enabled })}
+ <Flexbox style={{ width: 448 }}>
+ <ModelSelect
+ showAbility={false}
+ style={{ minWidth: 0, width: '100%' }}
+ value={value}
+ onChange={(props) => updateSystemAgentModel(key, props)}
/>
</Flexbox>
</Flexbox>
@@ -199,7 +191,6 @@ const ModelAssignmentsForm = memo(() => {
{t(`systemAgent.${key}.title`)}
</span>
),
- minWidth: undefined,
} satisfies FormItemProps;
});
@@ -241,6 +232,7 @@ const ModelAssignmentsForm = memo(() => {
itemsType={'group'}
variant={'filled'}
{...FORM_STYLE}
+ itemMinWidth={undefined}
/>
);
});
diff --git a/src/routes/(main)/settings/tts/features/OpenAI.tsx b/src/routes/(main)/settings/tts/features/OpenAI.tsx
index aa6124d3799..5428b77ab27 100644
--- a/src/routes/(main)/settings/tts/features/OpenAI.tsx
+++ b/src/routes/(main)/settings/tts/features/OpenAI.tsx
@@ -1,7 +1,8 @@
'use client';
import { type FormGroupItemType } from '@lobehub/ui';
-import { Form, Icon, Select, Skeleton } from '@lobehub/ui';
+import { Form, Icon, Skeleton } from '@lobehub/ui';
+import { Select } from '@lobehub/ui/base-ui';
import isEqual from 'fast-deep-equal';
import { Loader2Icon } from 'lucide-react';
import { memo, useState } from 'react';
@@ -25,12 +26,16 @@ const OpenAI = memo(() => {
const openai: FormGroupItemType = {
children: [
{
- children: <Select options={opeanaiTTSOptions} />,
+ children: (
+ <Select options={opeanaiTTSOptions} style={{ width: 448 }} />
+ ),
label: t('settingTTS.openai.ttsModel'),
name: ['openAI', 'ttsModel'],
},
{
- children: <Select options={opeanaiSTTOptions} />,
+ children: (
+ <Select options={opeanaiSTTOptions} style={{ width: 448 }} />
+ ),
label: t('settingTTS.openai.sttModel'),
name: ['openAI', 'sttModel'],
},
@@ -55,6 +60,7 @@ const OpenAI = memo(() => {
setLoading(false);
}}
{...FORM_STYLE}
+ itemMinWidth={undefined}
/>
);
});
diff --git a/src/routes/(main)/settings/tts/features/STT.tsx b/src/routes/(main)/settings/tts/features/STT.tsx
index 33e459fe8bb..7c4656c6f02 100644
--- a/src/routes/(main)/settings/tts/features/STT.tsx
+++ b/src/routes/(main)/settings/tts/features/STT.tsx
@@ -1,7 +1,8 @@
'use client';
import { type FormGroupItemType } from '@lobehub/ui';
-import { Form, Icon, Select, Skeleton } from '@lobehub/ui';
+import { Form, Icon, Skeleton } from '@lobehub/ui';
+import { Select } from '@lobehub/ui/base-ui';
import { Switch } from 'antd';
import isEqual from 'fast-deep-equal';
import { Loader2Icon } from 'lucide-react';
@@ -26,7 +27,7 @@ const STT = memo(() => {
const stt: FormGroupItemType = {
children: [
{
- children: <Select options={sttOptions} />,
+ children: <Select options={sttOptions} style={{ width: 448 }} />,
desc: t('settingTTS.sttService.desc'),
label: t('settingTTS.sttService.title'),
name: 'sttServer',
@@ -36,7 +37,6 @@ const STT = memo(() => {
desc: t('settingTTS.sttAutoStop.desc'),
label: t('settingTTS.sttAutoStop.title'),
layout: 'horizontal',
- minWidth: undefined,
name: 'sttAutoStop',
valuePropName: 'checked',
},
@@ -61,6 +61,7 @@ const STT = memo(() => {
setLoading(false);
}}
{...FORM_STYLE}
+ itemMinWidth={undefined}
/>
);
});
diff --git a/src/routes/(main)/settings/tts/features/const.tsx b/src/routes/(main)/settings/tts/features/const.tsx
index 2e3760950e2..f6f930d0357 100644
--- a/src/routes/(main)/settings/tts/features/const.tsx
+++ b/src/routes/(main)/settings/tts/features/const.tsx
@@ -1,5 +1,5 @@
import { OpenAI } from '@lobehub/icons';
-import { type SelectProps } from '@lobehub/ui';
+import { type SelectProps } from '@lobehub/ui/base-ui';
import { LabelRenderer } from '@/components/ModelSelect';