Skip to content

Commit c6038c0

Browse files
authored
💄 style: adjust ControlsForm component to adapt to mobile phone display (#9013)
* 🐛 fix: adjust ControlsForm component to use responsive widths for descriptions * 🐛 fix: update ControlsForm component for responsive description widths on narrow screens
1 parent 4ccf4c3 commit c6038c0

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

src/features/ChatInput/ActionBar/Model/ControlsForm.tsx

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Form } from '@lobehub/ui';
22
import type { FormItemProps } from '@lobehub/ui';
3-
import { Form as AntdForm, Switch } from 'antd';
3+
import { Form as AntdForm, Switch, Grid } from 'antd';
44
import isEqual from 'fast-deep-equal';
55
import Link from 'next/link';
66
import { memo } from 'react';
@@ -32,11 +32,21 @@ const ControlsForm = memo(() => {
3232

3333
const modelExtendParams = useAiInfraStore(aiModelSelectors.modelExtendParams(model, provider));
3434

35+
const screens = Grid.useBreakpoint();
36+
const isNarrow = !screens.sm;
37+
38+
const descWide = { display: 'inline-block', width: 300 } as const;
39+
const descNarrow = {
40+
display: 'block',
41+
maxWidth: '100%',
42+
whiteSpace: 'normal',
43+
} as const;
44+
3545
const items = [
3646
{
3747
children: <ContextCachingSwitch />,
3848
desc: (
39-
<span style={{ display: 'inline-block', width: 300 }}>
49+
<span style={isNarrow ? descNarrow : descWide}>
4050
<Trans i18nKey={'extendParams.disableContextCaching.desc'} ns={'chat'}>
4151
单条对话生成成本最高可降低 90%,响应速度提升 4 倍(
4252
<Link
@@ -50,13 +60,14 @@ const ControlsForm = memo(() => {
5060
</span>
5161
),
5262
label: t('extendParams.disableContextCaching.title'),
63+
layout: isNarrow ? 'vertical' : 'horizontal',
5364
minWidth: undefined,
5465
name: 'disableContextCaching',
5566
},
5667
{
5768
children: <Switch />,
5869
desc: (
59-
<span style={{ display: 'inline-block', width: 300 }}>
70+
<span style={isNarrow ? descNarrow : descWide}>
6071
<Trans i18nKey={'extendParams.enableReasoning.desc'} ns={'chat'}>
6172
基于 Claude Thinking 机制限制(
6273
<Link
@@ -72,7 +83,7 @@ const ControlsForm = memo(() => {
7283
</span>
7384
),
7485
label: t('extendParams.enableReasoning.title'),
75-
layout: 'horizontal',
86+
layout: isNarrow ? 'vertical' : 'horizontal',
7687
minWidth: undefined,
7788
name: 'enableReasoning',
7889
},
@@ -132,14 +143,16 @@ const ControlsForm = memo(() => {
132143
},
133144
{
134145
children: <Switch />,
135-
desc: t('extendParams.urlContext.desc'),
146+
desc: isNarrow ? (
147+
<span style={descNarrow}>{t('extendParams.urlContext.desc')}</span>
148+
) : (
149+
t('extendParams.urlContext.desc')
150+
),
136151
label: t('extendParams.urlContext.title'),
137-
layout: 'horizontal',
152+
layout: isNarrow ? 'vertical' : 'horizontal',
138153
minWidth: undefined,
139154
name: 'urlContext',
140-
style: {
141-
width: 445,
142-
},
155+
style: isNarrow ? undefined : { width: 445 },
143156
tag: 'urlContext',
144157
},
145158
{

0 commit comments

Comments
 (0)