♻️ refactor: remove DefaultAgentForm UI from settings pages (#13342)

🔥 refactor: remove DefaultAgentForm UI from settings pages

Remove the user-facing Default Agent configuration form from both
the agent settings page and the service-model settings page.
The underlying store action and selectors are preserved for
programmatic use (e.g. onboarding).

Fixes LOBE-1125

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Arvin Xu
2026-03-30 10:18:31 +08:00
committed by GitHub
parent b6c66dbdd7
commit a9cd2f7301
3 changed files with 0 additions and 72 deletions
@@ -1,68 +0,0 @@
'use client';
import { type FormGroupItemType } from '@lobehub/ui';
import { Form, Icon, Skeleton } from '@lobehub/ui';
import { Form as AntForm } from 'antd';
import { Loader2Icon } from 'lucide-react';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { FORM_STYLE } from '@/const/layoutTokens';
import ModelSelect from '@/features/ModelSelect';
import { useUserStore } from '@/store/user';
import { settingsSelectors } from '@/store/user/selectors';
const DefaultAgentForm = memo(() => {
const { t } = useTranslation('setting');
const [form] = AntForm.useForm();
const [loading, setLoading] = useState(false);
const [updateDefaultAgent, isUserStateInit] = useUserStore((s) => [
s.updateDefaultAgent,
s.isUserStateInit,
]);
const defaultAgentConfig = useUserStore(
(s) => settingsSelectors.currentSettings(s).defaultAgent?.config,
);
if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 3 }} title={false} />;
const defaultAgentSettings: FormGroupItemType = {
children: [
{
children: (
<ModelSelect
showAbility={false}
onChange={async ({ model, provider }) => {
setLoading(true);
await updateDefaultAgent({ config: { model, provider } });
setLoading(false);
}}
/>
),
desc: t('defaultAgent.model.desc'),
label: t('defaultAgent.model.title'),
name: 'defaultAgentConfig',
},
],
extra: loading && <Icon spin icon={Loader2Icon} size={16} style={{ opacity: 0.5 }} />,
title: t('defaultAgent.title'),
};
return (
<Form
collapsible={false}
form={form}
initialValues={{ defaultAgentConfig }}
items={[defaultAgentSettings]}
itemsType={'group'}
variant={'filled'}
{...FORM_STYLE}
/>
);
});
DefaultAgentForm.displayName = 'DefaultAgentForm';
export default DefaultAgentForm;
@@ -6,7 +6,6 @@ import { useTranslation } from 'react-i18next';
import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
import DefaultAgentForm from './features/DefaultAgentForm';
import SystemAgentForm from './features/SystemAgentForm';
const Page = () => {
@@ -15,7 +14,6 @@ const Page = () => {
return (
<>
<SettingHeader title={t('tab.agent')} />
<DefaultAgentForm />
<SystemAgentForm systemAgentKey="topic" />
<SystemAgentForm systemAgentKey="generationTopic" />
<SystemAgentForm systemAgentKey="translation" />
@@ -6,7 +6,6 @@ import { useTranslation } from 'react-i18next';
import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
import DefaultAgentForm from '../agent/features/DefaultAgentForm';
import SystemAgentForm from '../agent/features/SystemAgentForm';
import Image from '../image/features/Image';
import OpenAI from '../tts/features/OpenAI';
@@ -19,7 +18,6 @@ const Page = () => {
return (
<>
<SettingHeader title={t('tab.serviceModel')} />
<DefaultAgentForm />
<SystemAgentForm systemAgentKey="topic" />
<SystemAgentForm systemAgentKey="generationTopic" />
<SystemAgentForm systemAgentKey="translation" />