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.

✨ feat(chat-input): merge model and reasoning effort into one selector (#18838)

Arvin Xu7cb61353f0fb
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index 64a39d6e77c..8dd728e2d44 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -1059,6 +1059,7 @@
"minimap.previousMessage": "Previous message",
"minimap.senderAssistant": "Agent",
"minimap.senderUser": "You",
+ "modelSelector.model": "Model",
"newAgent": "Create Agent",
"newAmpAgent": "Add Amp",
"newClaudeCodeAgent": "Add Claude Code",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index 86bc39f9570..50cbd5b8c35 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -1059,6 +1059,7 @@
"minimap.previousMessage": "上一条消息",
"minimap.senderAssistant": "助理",
"minimap.senderUser": "你",
+ "modelSelector.model": "模型",
"newAgent": "创建助理",
"newAmpAgent": "添加 Amp",
"newClaudeCodeAgent": "添加 Claude Code",
@@ -1164,8 +1165,8 @@
"reasoningEffort.levels.no_think": "关闭",
"reasoningEffort.levels.none": "关闭",
"reasoningEffort.levels.xhigh": "超高",
- "reasoningEffort.mode.pro": "Pro",
- "reasoningEffort.mode.standard": "Standard",
+ "reasoningEffort.mode.pro": "专业",
+ "reasoningEffort.mode.standard": "标准",
"reasoningEffort.title": "推理强度",
"reasoningEffort.updateFailed": "推理强度更新失败,请重试",
"regenerate": "重新生成",
diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.ts
index 7c6f39b7153..d086bb1d86b 100644
--- a/packages/locales/src/default/chat.ts
+++ b/packages/locales/src/default/chat.ts
@@ -789,6 +789,7 @@ export default {
'minimap.previousMessage': 'Previous message',
'minimap.senderAssistant': 'Agent',
'minimap.senderUser': 'You',
+ 'modelSelector.model': 'Model',
'createModal.createBlank': 'Start Blank',
'createModal.groupPlaceholder': 'Describe what this Group should do...',
'createModal.groupTitle': 'What should this Group do?',
diff --git a/src/features/AgentBuilder/AgentBuilderConversation.tsx b/src/features/AgentBuilder/AgentBuilderConversation.tsx
index 61235777699..56f2876afc1 100644
--- a/src/features/AgentBuilder/AgentBuilderConversation.tsx
+++ b/src/features/AgentBuilder/AgentBuilderConversation.tsx
@@ -15,8 +15,8 @@ import TopicSelector from './TopicSelector';
interface AgentBuilderConversationProps {
agentId: string;
}
-const actions: ActionKeys[] = ['model'];
-const rightActions: ActionKeys[] = [];
+const actions: ActionKeys[] = [];
+const rightActions: ActionKeys[] = ['model'];
/**
* Agent Builder Conversation Component
diff --git a/src/features/ChatInput/ActionBar/Effort/Controls.tsx b/src/features/ChatInput/ActionBar/Effort/Controls.tsx
deleted file mode 100644
index 5a6897a2a42..00000000000
--- a/src/features/ChatInput/ActionBar/Effort/Controls.tsx
+++ /dev/null
@@ -1,138 +0,0 @@
-import { Flexbox, Icon } from '@lobehub/ui';
-import { Divider } from 'antd';
-import { createStaticStyles, cssVar, cx } from 'antd-style';
-import isEqual from 'fast-deep-equal';
-import { CheckIcon } from 'lucide-react';
-import type { AiModelReasoningConfig } from 'model-bank';
-import { MODEL_REASONING_PARAM_DEFAULTS, MODEL_REASONING_PARAM_LEVELS } from 'model-bank';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { aiModelSelectors, useAiInfraStore } from '@/store/aiInfra';
-
-const styles = createStaticStyles(({ css }) => ({
- active: css`
- background: ${cssVar.colorFillTertiary};
- `,
- check: css`
- font-size: 16px;
- color: ${cssVar.colorPrimary};
- `,
- label: css`
- font-size: 14px;
- color: ${cssVar.colorText};
- `,
- option: css`
- cursor: pointer;
-
- display: flex;
- gap: 12px;
- align-items: center;
- justify-content: space-between;
-
- width: 100%;
- padding-block: 8px;
- padding-inline: 8px;
- border: none;
- border-radius: ${cssVar.borderRadius};
-
- text-align: start;
-
- background: transparent;
-
- transition: background-color 0.2s;
-
- &:hover {
- background: ${cssVar.colorFillTertiary};
- }
- `,
-}));
-
-interface OptionProps {
- active: boolean;
- label: string;
- onClick: () => void;
-}
-
-// A real <button> so keyboard-only and screen-reader users can focus each
-// level and toggle it with Enter/Space
-const Option = memo<OptionProps>(({ active, label, onClick }) => (
- <button
- aria-pressed={active}
- className={cx(styles.option, active && styles.active)}
- type={'button'}
- onClick={onClick}
- >
- <span className={styles.label}>{label}</span>
- {active && <Icon className={styles.check} icon={CheckIcon} />}
- </button>
-));
-
-interface ControlsProps {
- model: string;
- provider: string;
-}
-
-const Controls = memo<ControlsProps>(({ model, provider }) => {
- const { t } = useTranslation('chat');
-
- const reasoningParams = useAiInfraStore(
- aiModelSelectors.modelReasoningExtendParams(model, provider),
- isEqual,
- );
- const config = useAiInfraStore(aiModelSelectors.modelReasoningConfig(model, provider), isEqual);
- const updating = useAiInfraStore(
- aiModelSelectors.isModelReasoningConfigUpdating(model, provider),
- );
- const updateModelReasoningConfig = useAiInfraStore((s) => s.updateModelReasoningConfig);
-
- // modelReasoningExtendParams only returns MODEL_REASONING_EXTEND_PARAMS
- // entries, so the narrowing cast is safe
- const effortKey = reasoningParams.find((param) => param !== 'reasoningMode') as
- Exclude<keyof AiModelReasoningConfig, 'reasoningMode'> | undefined;
- const hasReasoningMode = reasoningParams.includes('reasoningMode');
-
- // Keep the same model-dependent fallback as the ControlsForm slider
- const effortDefault = effortKey
- ? effortKey === 'gpt5_2ReasoningEffort' && model === 'gpt-5.5'
- ? 'medium'
- : MODEL_REASONING_PARAM_DEFAULTS[effortKey]
- : undefined;
- const effortValue = (effortKey && config?.[effortKey]) ?? effortDefault;
- const modeValue = config?.reasoningMode ?? MODEL_REASONING_PARAM_DEFAULTS.reasoningMode;
-
- const handleSelect = async (patch: AiModelReasoningConfig) => {
- if (updating) return;
- // failure already rolls back and toasts inside the store action
- await updateModelReasoningConfig(model, provider, patch).catch(() => {});
- };
-
- return (
- <Flexbox gap={4} style={{ opacity: updating ? 0.6 : undefined }}>
- {effortKey &&
- MODEL_REASONING_PARAM_LEVELS[effortKey].map((level) => (
- <Option
- active={effortValue === level}
- key={level}
- label={t(`reasoningEffort.levels.${level}`)}
- onClick={() => handleSelect({ [effortKey]: level })}
- />
- ))}
- {hasReasoningMode && (
- <>
- {effortKey && <Divider style={{ margin: 0 }} />}
- {MODEL_REASONING_PARAM_LEVELS.reasoningMode.map((mode) => (
- <Option
- active={modeValue === mode}
- key={mode}
- label={t(`reasoningEffort.mode.${mode}`)}
- onClick={() => handleSelect({ reasoningMode: mode })}
- />
- ))}
- </>
- )}
- </Flexbox>
- );
-});
-
-export default Controls;
diff --git a/src/features/ChatInput/ActionBar/Effort/index.tsx b/src/features/ChatInput/ActionBar/Effort/index.tsx
deleted file mode 100644
index 95f9a4a221b..00000000000
--- a/src/features/ChatInput/ActionBar/Effort/index.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-import { GaugeIcon } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { aiModelSelectors, useAiInfraStore } from '@/store/aiInfra';
-
-import { useAgentId } from '../../hooks/useAgentId';
-import { useEffectiveModel } from '../../hooks/useEffectiveModel';
-import { ChatInputAction } from '../components/ChatInputAction';
-import Controls from './Controls';
-
-const EffortAction = memo<{ model: string; provider: string }>(({ model, provider }) => {
- const { t } = useTranslation('chat');
-
- // The saved model-instance reasoning defaults are fetched by
- // ReasoningConfigLoader (mounted in ChatInputProvider), so the dropdown and
- // the send pipeline (modelParamsResolver) read the same store value.
- return (
- <ChatInputAction
- icon={GaugeIcon}
- showTooltip={false}
- title={t('reasoningEffort.title')}
- popover={{
- content: <Controls model={model} provider={provider} />,
- maxWidth: 280,
- minWidth: 200,
- placement: 'topLeft',
- styles: {
- content: {
- padding: 4,
- },
- },
- }}
- />
- );
-});
-
-/**
- * Reasoning-effort select for the chat input. The value is a user-level
- * model-instance setting (userId + providerId + modelId, personal scope) —
- * not part of the agent's chatConfig — so it follows the user across agents.
- *
- * Mounted on every chat surface; renders nothing unless the effective model
- * declares a reasoning-effort family extend param (or reasoningMode).
- */
-const Effort = memo(() => {
- const agentId = useAgentId();
- const { model, provider } = useEffectiveModel(agentId);
- const hasReasoningParams = useAiInfraStore(
- aiModelSelectors.isModelHasReasoningExtendParams(model, provider),
- );
-
- if (!hasReasoningParams) return null;
-
- return <EffortAction model={model} provider={provider} />;
-});
-
-Effort.displayName = 'Effort';
-
-export default Effort;
diff --git a/src/features/ChatInput/ActionBar/Model/SelectorMenu.tsx b/src/features/ChatInput/ActionBar/Model/SelectorMenu.tsx
new file mode 100644
index 00000000000..a209d30eddb
--- /dev/null
+++ b/src/features/ChatInput/ActionBar/Model/SelectorMenu.tsx
@@ -0,0 +1,207 @@
+import { ModelIcon } from '@lobehub/icons';
+import {
+ DropdownMenuItem,
+ DropdownMenuItemContent,
+ DropdownMenuItemExtra,
+ DropdownMenuItemLabel,
+ DropdownMenuPopup,
+ DropdownMenuPortal,
+ DropdownMenuPositioner,
+ DropdownMenuRoot,
+ DropdownMenuSubmenuArrow,
+ DropdownMenuSubmenuRoot,
+ DropdownMenuSubmenuTrigger,
+ DropdownMenuTrigger,
+ renderDropdownMenuItems,
+} from '@lobehub/ui/base-ui';
+import { createStaticStyles, cssVar } from 'antd-style';
+import type { ReactNode } from 'react';
+import { memo, useCallback, useMemo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { ModelSwitchSubmenuPopup } from '@/features/ModelSwitchPanel';
+
+import type { SelectorSubmenuItem } from '../../components/buildSelectorSubmenu';
+import { buildSelectorSubmenu } from '../../components/buildSelectorSubmenu';
+import type { ReasoningEffortControl } from '../../hooks/useReasoningEffortControl';
+import { type DropdownPlacement } from '../context';
+
+const styles = createStaticStyles(({ css }) => ({
+ meta: css`
+ overflow: hidden;
+ display: flex;
+ gap: 6px;
+ align-items: center;
+
+ max-width: 150px;
+
+ /* The packaged extra slot defaults to the code font (it is styled for
+ keyboard hints); a model name belongs in the UI font. */
+ font-family: ${cssVar.fontFamily};
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ `,
+ name: css`
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ `,
+ popup: css`
+ width: 240px;
+ `,
+}));
+
+/**
+ * The effort rows go through `renderDropdownMenuItems`, which draws base-ui's own
+ * submenu arrow. That glyph is not exported, so the hand-built model row would
+ * otherwise sit next to them wearing a different arrow.
+ */
+const SubmenuArrow = () => (
+ <svg
+ aria-hidden
+ fill="currentColor"
+ stroke="currentColor"
+ strokeLinejoin="round"
+ strokeWidth={1.5}
+ viewBox="0 0 16 16"
+ >
+ <path d="M6 5l4 3-4 3z" />
+ </svg>
+);
+
+interface SelectorMenuProps {
+ canSelectModel: boolean;
+ children: ReactNode;
+ displayName: string;
+ effort: ReasoningEffortControl;
+ model: string;
+ onModelChange: (params: { model: string; provider: string }) => Promise<void>;
+ openOnHover?: boolean;
+ placement?: DropdownPlacement;
+ provider: string;
+}
+
+/**
+ * Model + reasoning effort as one control: the collapsed menu names both
+ * current values, and each opens its own submenu — the model one mounting the
+ * full model panel. Mirrors the heterogeneous-agent selector so both chat
+ * surfaces read the same way.
+ */
+const SelectorMenu = memo<SelectorMenuProps>(
+ ({
+ canSelectModel,
+ children,
+ displayName,
+ effort,
+ model,
+ onModelChange,
+ openOnHover = false,
+ placement = 'topLeft',
+ provider,
+ }) => {
+ const { t } = useTranslation('chat');
+ const [open, setOpen] = useState(false);
+
+ const {
+ effortKey,
+ effortLevels,
+ effortValue,
+ hasReasoningMode,
+ modeLevels,
+ modeValue,
+ select,
+ } = effort;
+
+ // The model panel commits on click and then asks its host to close; here
+ // that host is the whole model+effort menu, not a panel of its own.
+ const handleModelPanelOpenChange = useCallback((nextOpen: boolean) => {
+ if (!nextOpen) setOpen(false);
+ }, []);
+
+ const items = useMemo(() => {
+ const rows: SelectorSubmenuItem[] = [];
+
+ if (effortKey)
+ rows.push(
+ buildSelectorSubmenu({
+ current: effortValue ?? '',
+ label: t('reasoningEffort.title'),
+ onSelect: (value: string) => select({ [effortKey]: value }),
+ options: effortLevels.map((level) => ({
+ label: t(`reasoningEffort.levels.${level}`),
+ value: level,
+ })),
+ valueLabel: effortValue ? t(`reasoningEffort.levels.${effortValue}`) : '',
+ }),
+ );
+
+ if (hasReasoningMode)
+ rows.push(
+ buildSelectorSubmenu({
+ current: modeValue,
+ label: t('extendParams.reasoningMode.title'),
+ onSelect: (value: string) => select({ reasoningMode: value as typeof modeValue }),
+ options: modeLevels.map((mode) => ({
+ label: t(`reasoningEffort.mode.${mode}`),
+ value: mode,
+ })),
+ valueLabel: t(`reasoningEffort.mode.${modeValue}`),
+ }),
+ );
+
+ return rows;
+ }, [effortKey, effortLevels, effortValue, hasReasoningMode, modeLevels, modeValue, select, t]);
+
+ const modelMeta = (
+ <DropdownMenuItemExtra className={styles.meta}>
+ <ModelIcon model={model} size={16} />
+ <span className={styles.name}>{displayName}</span>
+ </DropdownMenuItemExtra>
+ );
+
+ return (
+ <DropdownMenuRoot open={open} onOpenChange={setOpen}>
+ <DropdownMenuTrigger openOnHover={openOnHover}>{children}</DropdownMenuTrigger>
+ <DropdownMenuPortal>
+ <DropdownMenuPositioner hoverTrigger={openOnHover} placement={placement} sideOffset={8}>
+ <DropdownMenuPopup className={styles.popup}>
+ {canSelectModel ? (
+ <DropdownMenuSubmenuRoot>
+ <DropdownMenuSubmenuTrigger label={t('modelSelector.model')}>
+ <DropdownMenuItemContent>
+ <DropdownMenuItemLabel>{t('modelSelector.model')}</DropdownMenuItemLabel>
+ {modelMeta}
+ <DropdownMenuSubmenuArrow>
+ <SubmenuArrow />
+ </DropdownMenuSubmenuArrow>
+ </DropdownMenuItemContent>
+ </DropdownMenuSubmenuTrigger>
+ <ModelSwitchSubmenuPopup
+ model={model}
+ provider={provider}
+ onModelChange={onModelChange}
+ onOpenChange={handleModelPanelOpenChange}
+ />
+ </DropdownMenuSubmenuRoot>
+ ) : (
+ // Locked model (agent-pinned or use-only access): still name it,
+ // since reasoning effort below stays the user's to change.
+ <DropdownMenuItem disabled closeOnClick={false}>
+ <DropdownMenuItemContent>
+ <DropdownMenuItemLabel>{t('modelSelector.model')}</DropdownMenuItemLabel>
+ {modelMeta}
+ </DropdownMenuItemContent>
+ </DropdownMenuItem>
+ )}
+ {renderDropdownMenuItems(items)}
+ </DropdownMenuPopup>
+ </DropdownMenuPositioner>
+ </DropdownMenuPortal>
+ </DropdownMenuRoot>
+ );
+ },
+);
+
+SelectorMenu.displayName = 'ModelSelectorMenu';
+
+export default SelectorMenu;
diff --git a/src/features/ChatInput/ActionBar/Model/index.tsx b/src/features/ChatInput/ActionBar/Model/index.tsx
index cd5945dc475..0f2118febe0 100644
--- a/src/features/ChatInput/ActionBar/Model/index.tsx
+++ b/src/features/ChatInput/ActionBar/Model/index.tsx
@@ -1,55 +1,23 @@
-import { ModelIcon } from '@lobehub/icons';
-import { Center, Tooltip } from '@lobehub/ui';
-import { createStaticStyles, cx } from 'antd-style';
+import { Tooltip } from '@lobehub/ui';
import { memo, useCallback } from 'react';
+import { useTranslation } from 'react-i18next';
import ModelSwitchPanel from '@/features/ModelSwitchPanel';
import { aiModelSelectors, useAiInfraStore } from '@/store/aiInfra';
import { useChatStore } from '@/store/chat';
import { topicSelectors } from '@/store/chat/slices/topic/selectors';
+import SelectorTrigger from '../../components/SelectorTrigger';
import { useAgentId } from '../../hooks/useAgentId';
import { useAgentModelSelection } from '../../hooks/useAgentModelSelection';
import { useModelLockTooltip } from '../../hooks/useModelLockTooltip';
+import { useReasoningEffortControl } from '../../hooks/useReasoningEffortControl';
import { useActionBarContext } from '../context';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- icon: css`
- transition: scale 400ms cubic-bezier(0.215, 0.61, 0.355, 1);
- `,
- model: css`
- cursor: pointer;
- border-radius: 24px;
-
- :hover {
- background: ${cssVar.colorFillSecondary};
- }
-
- :active {
- div {
- scale: 0.8;
- }
- }
- `,
- modelReadonly: css`
- cursor: default;
-
- :hover {
- background: transparent;
- }
-
- :active {
- div {
- scale: 1;
- }
- }
- `,
-}));
+import SelectorMenu from './SelectorMenu';
const ModelSwitch = memo(() => {
- const { actionSize, dropdownPlacement } = useActionBarContext();
- const blockSize = actionSize?.blockSize ?? 32;
- const iconSize = actionSize?.size ?? 20;
+ const { t } = useTranslation('chat');
+ const { dropdownPlacement } = useActionBarContext();
const agentId = useAgentId();
const {
canDisplayModel,
@@ -72,6 +40,11 @@ const ModelSwitch = memo(() => {
const enabledModel = useAiInfraStore(aiModelSelectors.getEnabledModelById(model, provider));
const displayName = enabledModel?.displayName || model;
const lockTooltip = useModelLockTooltip(displayName, selectionLockReason);
+ // Reasoning effort is a per-model user preference, so it rides along with the
+ // model trigger instead of claiming a second action slot.
+ const effort = useReasoningEffortControl(model, provider);
+ // A pinned model still opens the menu when there is an effort to pick there.
+ const interactive = canSelectModel || effort.hasReasoningParams;
const handleModelChange = useCallback(
async (params: { model: string; provider: string }) => {
@@ -83,30 +56,50 @@ const ModelSwitch = memo(() => {
[activeTopicId, canSelectModel, selectModel, updateTopicModel],
);
+ // Both current values in one label, the way the heterogeneous selector reads:
+ // "GPT-5.6 Sol 中". The effort half is dropped for models without one.
+ const effortLabel = effort.effortValue
+ ? t(`reasoningEffort.levels.${effort.effortValue}`)
+ : undefined;
+ const triggerText = effortLabel ? `${displayName} ${effortLabel}` : displayName;
+
const trigger = (
- <Center
- aria-disabled={!canSelectModel}
- aria-label={displayName}
- className={cx(styles.model, !canSelectModel && styles.modelReadonly)}
- height={blockSize}
- width={blockSize}
- >
- <div className={styles.icon}>
- <ModelIcon model={model} size={iconSize} />
- </div>
- </Center>
+ <SelectorTrigger
+ aria-disabled={!interactive}
+ ariaLabel={triggerText}
+ text={triggerText}
+ {...(interactive ? {} : { style: { cursor: 'default' } })}
+ />
);
if (!canDisplayModel) return null;
+ // Model + effort in one menu, so the two settings that decide how a turn runs
+ // are picked in the same place (see SelectorMenu).
+ if (effort.hasReasoningParams)
+ return (
+ <SelectorMenu
+ canSelectModel={canSelectModel}
+ displayName={displayName}
+ effort={effort}
+ model={model}
+ placement={dropdownPlacement ?? 'topRight'}
+ provider={provider}
+ onModelChange={handleModelChange}
+ >
+ {trigger}
+ </SelectorMenu>
+ );
+
// Locked: say which model is pinned AND why it can't be changed here — the
- // bare model name used to leave the inert button unexplained.
+ // bare model name used to leave the inert chip unexplained.
if (!canSelectModel) return <Tooltip title={lockTooltip ?? displayName}>{trigger}</Tooltip>;
return (
<ModelSwitchPanel
model={model}
- placement={dropdownPlacement}
+ openOnHover={false}
+ placement={dropdownPlacement ?? 'topRight'}
provider={provider}
onModelChange={handleModelChange}
>
diff --git a/src/features/ChatInput/ActionBar/ModelLabel/index.tsx b/src/features/ChatInput/ActionBar/ModelLabel/index.tsx
deleted file mode 100644
index c2a07563ded..00000000000
--- a/src/features/ChatInput/ActionBar/ModelLabel/index.tsx
+++ /dev/null
@@ -1,118 +0,0 @@
-import { Center, Flexbox, Tooltip } from '@lobehub/ui';
-import { createStaticStyles, cx } from 'antd-style';
-import { ChevronDownIcon } from 'lucide-react';
-import { memo, useCallback } from 'react';
-
-import ModelSwitchPanel from '@/features/ModelSwitchPanel';
-import { aiModelSelectors, useAiInfraStore } from '@/store/aiInfra';
-import { useChatStore } from '@/store/chat';
-import { topicSelectors } from '@/store/chat/slices/topic/selectors';
-
-import { useAgentId } from '../../hooks/useAgentId';
-import { useAgentModelSelection } from '../../hooks/useAgentModelSelection';
-import { useModelLockTooltip } from '../../hooks/useModelLockTooltip';
-import { useActionBarContext } from '../context';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- chevron: css`
- color: ${cssVar.colorTextQuaternary};
- `,
- name: css`
- overflow: hidden;
-
- max-width: 160px;
-
- font-size: 12px;
- color: ${cssVar.colorTextSecondary};
- text-overflow: ellipsis;
- white-space: nowrap;
- `,
- trigger: css`
- cursor: pointer;
- border-radius: 6px;
-
- :hover {
- background: ${cssVar.colorFillTertiary};
- }
- `,
- triggerReadonly: css`
- cursor: default;
-
- &:hover {
- background: transparent;
- }
- `,
-}));
-
-const ModelLabel = memo(() => {
- const { dropdownPlacement } = useActionBarContext();
- const agentId = useAgentId();
- const {
- canDisplayModel,
- canSelectModel,
- model: agentModel,
- provider: agentProvider,
- selectionLockReason,
- selectModel,
- } = useAgentModelSelection(agentId);
- // Topic-scoped model: a topic pins its own model (top-level `topics.model`
- // column). Display the topic's pinned model when present, else the agent
- // default; a switch pins to the active topic, otherwise updates the agent
- // (via selectModel, which honors workspace member overrides).
- const activeTopicId = useChatStore((s) => s.activeTopicId);
- const topicModel = useChatStore(topicSelectors.activeTopicModel);
- const updateTopicModel = useChatStore((s) => s.updateTopicModel);
- const model = topicModel?.model ?? agentModel;
- const provider = topicModel?.model ? topicModel.provider : agentProvider;
-
- const enabledModel = useAiInfraStore(aiModelSelectors.getEnabledModelById(model, provider));
- const displayName = enabledModel?.displayName || model;
- const lockTooltip = useModelLockTooltip(displayName, selectionLockReason);
-
- const handleModelChange = useCallback(
- async (params: { model: string; provider: string }) => {
- if (!canSelectModel) return;
-
- if (activeTopicId) await updateTopicModel(activeTopicId, params);
- else await selectModel(params);
- },
- [activeTopicId, canSelectModel, selectModel, updateTopicModel],
- );
-
- const trigger = (
- <Center
- horizontal
- aria-label={displayName}
- className={cx(styles.trigger, !canSelectModel && styles.triggerReadonly)}
- height={28}
- paddingInline={6}
- >
- <Flexbox horizontal align={'center'} gap={2}>
- <span className={styles.name}>{displayName}</span>
- {canSelectModel ? <ChevronDownIcon className={styles.chevron} size={12} /> : null}
- </Flexbox>
- </Center>
- );
-
- if (!canDisplayModel) return null;
- // Locked: the chevron is gone and clicking does nothing, so the tooltip is the
- // only place that can say why the model is pinned here.
- if (!canSelectModel)
- return lockTooltip ? <Tooltip title={lockTooltip}>{trigger}</Tooltip> : trigger;
-
- return (
- <ModelSwitchPanel
- model={model}
- openOnHover={false}
- placement={dropdownPlacement}
- provider={provider}
- onModelChange={handleModelChange}
- >
- {trigger}
- </ModelSwitchPanel>
- );
-});
-
-ModelLabel.displayName = 'ModelLabel';
-
-export default ModelLabel;
diff --git a/src/features/ChatInput/ActionBar/Plus/index.tsx b/src/features/ChatInput/ActionBar/Plus/index.tsx
index 2fea487ece7..39f18c006a1 100644
--- a/src/features/ChatInput/ActionBar/Plus/index.tsx
+++ b/src/features/ChatInput/ActionBar/Plus/index.tsx
@@ -56,7 +56,6 @@ import { useDetailPopoverState } from '../components/useDetailPopoverState';
import { useControls as useKnowledgeControls } from '../Knowledge/useControls';
import { useMemoryEnabled } from '../Memory/useMemoryEnabled';
import { useControls as useToolsControls } from '../Tools/useControls';
-import { useEffortMenuItem } from './useEffortMenuItem';
const hotArea = css`
&::before {
@@ -399,8 +398,6 @@ const usePlusMenuItems = ({ close }: { close: () => void }): ActionDropdownMenuI
[updateAgentChatConfig],
);
- const effortItem = useEffortMenuItem();
-
const handleToggleParams = useCallback(() => {
close();
if (isParamsPanelActive) {
@@ -663,10 +660,6 @@ const usePlusMenuItems = ({ close }: { close: () => void }): ActionDropdownMenuI
},
// Agent Gateway directly below the formatting toolbar.
...gatewayItem,
- // Reasoning intensity — a personal per-model preference, so it is NOT
- // gated on canConfigureResource; hidden only when the model has no
- // reasoning extend params (the hook returns []).
- ...effortItem,
// Advanced parameter settings — only when resources can be configured.
...(canConfigureResource
? [
@@ -746,7 +739,6 @@ const usePlusMenuItems = ({ close }: { close: () => void }): ActionDropdownMenuI
agentId,
activeSearchOption,
canConfigureResource,
- effortItem,
enableTopicAcceptance,
canUploadImage,
canUploadVideo,
diff --git a/src/features/ChatInput/ActionBar/Plus/useEffortMenuItem.tsx b/src/features/ChatInput/ActionBar/Plus/useEffortMenuItem.tsx
deleted file mode 100644
index d0e60dcc312..00000000000
--- a/src/features/ChatInput/ActionBar/Plus/useEffortMenuItem.tsx
+++ /dev/null
@@ -1,174 +0,0 @@
-import { Icon } from '@lobehub/ui';
-import { css, cssVar, cx } from 'antd-style';
-import isEqual from 'fast-deep-equal';
-import { CheckIcon, ChevronRight, GaugeIcon } from 'lucide-react';
-import type { AiModelReasoningConfig } from 'model-bank';
-import { MODEL_REASONING_PARAM_DEFAULTS, MODEL_REASONING_PARAM_LEVELS } from 'model-bank';
-import type { ReactNode } from 'react';
-import { useMemo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { aiModelSelectors, useAiInfraStore } from '@/store/aiInfra';
-
-import { useAgentId } from '../../hooks/useAgentId';
-import { useEffectiveModel } from '../../hooks/useEffectiveModel';
-import { type ActionDropdownMenuItems } from '../components/ActionDropdown';
-
-const activeLabel = css`
- display: flex;
- gap: 16px;
- align-items: center;
- justify-content: space-between;
-
- width: 100%;
-
- color: inherit;
-`;
-
-const currentValue = css`
- overflow: hidden;
-
- font-size: 12px;
- color: ${cssVar.colorTextSecondary};
- text-overflow: ellipsis;
- white-space: nowrap;
-`;
-
-/**
- * "Reasoning intensity" submenu for the "+" menu. The value is a user-level
- * model-instance setting (userId + providerId + modelId, personal scope) — not
- * agent resource configuration — so it must stay visible regardless of
- * `canConfigureResource`. Returns no items unless the effective model declares
- * a reasoning-effort family extend param (or reasoningMode).
- *
- * The saved model-instance defaults are fetched by ReasoningConfigLoader
- * (mounted in ChatInputProvider), so this submenu and the send pipeline
- * (modelParamsResolver) read the same store value.
- */
-export const useEffortMenuItem = (): ActionDropdownMenuItems => {
- const { t } = useTranslation('chat');
- const agentId = useAgentId();
- const { model, provider } = useEffectiveModel(agentId);
-
- const hasReasoningParams = useAiInfraStore(
- aiModelSelectors.isModelHasReasoningExtendParams(model, provider),
- );
- const reasoningParams = useAiInfraStore(
- aiModelSelectors.modelReasoningExtendParams(model, provider),
- isEqual,
- );
- const config = useAiInfraStore(aiModelSelectors.modelReasoningConfig(model, provider), isEqual);
- const updating = useAiInfraStore(
- aiModelSelectors.isModelReasoningConfigUpdating(model, provider),
- );
- const updateModelReasoningConfig = useAiInfraStore((s) => s.updateModelReasoningConfig);
-
- return useMemo<ActionDropdownMenuItems>(() => {
- if (!hasReasoningParams) return [];
-
- // modelReasoningExtendParams only returns MODEL_REASONING_EXTEND_PARAMS
- // entries, so the narrowing cast is safe
- const effortKey = reasoningParams.find((param) => param !== 'reasoningMode') as
- Exclude<keyof AiModelReasoningConfig, 'reasoningMode'> | undefined;
- const hasReasoningMode = reasoningParams.includes('reasoningMode');
-
- // Keep the same model-dependent fallback as the ControlsForm slider
- const effortDefault = effortKey
- ? effortKey === 'gpt5_2ReasoningEffort' && model === 'gpt-5.5'
- ? 'medium'
- : MODEL_REASONING_PARAM_DEFAULTS[effortKey]
- : undefined;
- const effortValue = (effortKey && config?.[effortKey]) ?? effortDefault;
- const modeValue = config?.reasoningMode ?? MODEL_REASONING_PARAM_DEFAULTS.reasoningMode;
-
- const handleSelect = async (patch: AiModelReasoningConfig) => {
- if (updating) return;
- // failure already rolls back and toasts inside the store action
- await updateModelReasoningConfig(model, provider, patch).catch(() => {});
- };
-
- const renderActive = (label: ReactNode, active: boolean) =>
- active ? (
- <div className={cx(activeLabel)}>
- <span>{label}</span>
- <Icon icon={CheckIcon} size={14} />
- </div>
- ) : (
- label
- );
-
- const effortChildren: ActionDropdownMenuItems = effortKey
- ? MODEL_REASONING_PARAM_LEVELS[effortKey].map((level) => ({
- key: `effort-${level}`,
- label: renderActive(t(`reasoningEffort.levels.${level}`), effortValue === level),
- onClick: () => handleSelect({ [effortKey]: level }),
- }))
- : [];
-
- const modeChildren: ActionDropdownMenuItems = hasReasoningMode
- ? MODEL_REASONING_PARAM_LEVELS.reasoningMode.map((mode) => ({
- key: `effort-mode-${mode}`,
- label: renderActive(t(`reasoningEffort.mode.${mode}`), modeValue === mode),
- onClick: () => handleSelect({ reasoningMode: mode }),
- }))
- : [];
-
- // When the model exposes both params, wrap each list in a labeled group so
- // users can tell "effort level" and "reasoning mode" are two independent
- // settings (each carries its own check mark). A single-param submenu stays
- // flat — the parent row already names it.
- const children: ActionDropdownMenuItems =
- effortChildren.length > 0 && modeChildren.length > 0
- ? [
- {
- children: effortChildren,
- key: 'effort-level-group',
- label: t('reasoningEffort.title'),
- type: 'group' as const,
- },
- { type: 'divider' as const },
- {
- children: modeChildren,
- key: 'effort-mode-group',
- label: t('extendParams.reasoningMode.title'),
- type: 'group' as const,
- },
- ]
- : [...effortChildren, ...modeChildren];
-
- // Current value shown on the collapsed row (Codex-style): effort level,
- // plus the reasoning mode when the model exposes both.
- const currentText = [
- effortKey && effortValue ? t(`reasoningEffort.levels.${effortValue}`) : undefined,
- hasReasoningMode ? t(`reasoningEffort.mode.${modeValue}`) : undefined,
- ]
- .filter(Boolean)
- .join(' · ');
-
- return [
- {
- children,
- // Trailing chevron (replaces base-ui's default triangle submenu arrow,
- // which is hidden via the .lobe-submenu-chevron rule in ActionDropdown).
- extra: <Icon className="lobe-submenu-chevron" icon={ChevronRight} size={16} />,
- icon: GaugeIcon,
- key: 'effort',
- label: (
- <div className={cx(activeLabel)}>
- <span>{t('reasoningEffort.title')}</span>
- {currentText && <span className={cx(currentValue)}>{currentText}</span>}
- </div>
- ),
- } as ActionDropdownMenuItems[number],
- ];
- }, [
- config,
- hasReasoningParams,
- model,
- provider,
- reasoningParams,
- t,
- updateModelReasoningConfig,
- updating,
- ]);
-};
diff --git a/src/features/ChatInput/ActionBar/config.ts b/src/features/ChatInput/ActionBar/config.ts
index c63b08d6b48..2c0d11f8c1c 100644
--- a/src/features/ChatInput/ActionBar/config.ts
+++ b/src/features/ChatInput/ActionBar/config.ts
@@ -2,12 +2,10 @@ import VoiceDictation from '../Dictation';
import VoiceMessage from '../VoiceMessage';
import AgentMode from './AgentMode';
import Clear from './Clear';
-import Effort from './Effort';
import History from './History';
import Memory from './Memory';
import Mention from './Mention';
import Model from './Model';
-import ModelLabel from './ModelLabel';
import Params from './Params';
import Plus from './Plus';
import PromptTransform from './PromptTransform';
@@ -21,14 +19,12 @@ export const actionMap = {
agentMode: AgentMode,
clear: Clear,
contextWindow: ContextWindow,
- effort: Effort,
fileUpload: Upload,
plus: Plus,
history: History,
memory: Memory,
mention: Mention,
model: Model,
- modelLabel: ModelLabel,
params: Params,
promptTransform: PromptTransform,
search: Search,
diff --git a/src/features/ChatInput/ActionBar/filterChatOnlyActions.ts b/src/features/ChatInput/ActionBar/filterChatOnlyActions.ts
index 9ebcffbc0e0..c0080cf1e18 100644
--- a/src/features/ChatInput/ActionBar/filterChatOnlyActions.ts
+++ b/src/features/ChatInput/ActionBar/filterChatOnlyActions.ts
@@ -3,13 +3,10 @@ import type { ActionKey, ActionKeys } from './config';
const CHAT_ONLY_ACTIONS = new Set<ActionKey>([
'agentMode',
'clear',
- // personal per-model reasoning preference, not resource configuration
- 'effort',
'fileUpload',
'history',
'mention',
'model',
- 'modelLabel',
'plus',
'promptTransform',
'typo',
@@ -19,8 +16,8 @@ const CHAT_ONLY_ACTIONS = new Set<ActionKey>([
/**
* Chat-only members (no configuration access) keep runtime preferences,
* attachments, formatting and chat operations while configuration actions are
- * hidden. `model` stays as the icon trigger — it is policy-aware and renders a
- * readonly icon when the member cannot pick a model.
+ * hidden. `model` stays as the text chip — it is policy-aware and renders an
+ * inert label when the member cannot pick a model.
*/
export const filterChatOnlyActions = (actions: ActionKeys[]): ActionKeys[] => {
const visibleActions: ActionKeys[] = [];
diff --git a/src/features/ChatInput/ActionBar/index.test.ts b/src/features/ChatInput/ActionBar/index.test.ts
index 1c1090f72aa..c275b41b9bb 100644
--- a/src/features/ChatInput/ActionBar/index.test.ts
+++ b/src/features/ChatInput/ActionBar/index.test.ts
@@ -64,9 +64,8 @@ describe('filterChatOnlyActions', () => {
).toEqual(['agentMode', 'model', 'fileUpload', 'voiceDictation', '---', ['typo', 'clear']]);
});
- it('keeps the icon model trigger for chat-only members instead of degrading to the text label', () => {
+ it('keeps the model chip for chat-only members', () => {
expect(filterChatOnlyActions(['model', 'plus'])).toEqual(['model', 'plus']);
- expect(filterChatOnlyActions(['modelLabel', 'plus'])).toEqual(['modelLabel', 'plus']);
});
});
diff --git a/src/features/ChatInput/ControlBar/HeteroModel/SelectorMenu.tsx b/src/features/ChatInput/ControlBar/HeteroModel/SelectorMenu.tsx
index 0275c0e5992..b2f97559338 100644
--- a/src/features/ChatInput/ControlBar/HeteroModel/SelectorMenu.tsx
+++ b/src/features/ChatInput/ControlBar/HeteroModel/SelectorMenu.tsx
@@ -18,10 +18,10 @@ import {
import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
-import { buildSelectorSubmenu } from './buildSelectorSubmenu';
+import { buildSelectorSubmenu } from '../../components/buildSelectorSubmenu';
+import Trigger from '../../components/SelectorTrigger';
import { ModelCatalogSelector } from './ModelCatalogSelector';
import { buildSelectorView, resolveModelSwitchSelection } from './selectorView';
-import Trigger from './Trigger';
interface SelectorMenuProps {
agentId?: string;
diff --git a/src/features/ChatInput/Desktop/index.tsx b/src/features/ChatInput/Desktop/index.tsx
index b266690a0be..325a998f84f 100644
--- a/src/features/ChatInput/Desktop/index.tsx
+++ b/src/features/ChatInput/Desktop/index.tsx
@@ -11,6 +11,7 @@ import { createPortal } from 'react-dom';
import { useTranslation } from 'react-i18next';
import ChatInputNotice from '@/features/ChatInput/ChatInputNotice';
+import ComposerExpandButton from '@/features/ChatInput/components/ComposerExpandButton';
import { useChatInputStore } from '@/features/ChatInput/store';
import { LayoutContainerContext } from '@/features/DesktopLayoutContainer/LayoutContainerContext';
import { useChatStore } from '@/store/chat';
@@ -197,16 +198,23 @@ const DesktopChatInput = memo<DesktopChatInputProps>(
/>
) : null;
const noticeNode = !isConfigLoading && <ChatInputNotice />;
+ // The action bar is `width: 100%`, so a sibling placed *inside* its
+ // shrink-to-fit box is pushed past the bar's right edge and leaves a
+ // one-slot hole between the last action and the expand toggle. Keep the
+ // toggle in a row outside that box.
const leftSlotContent = (
- <Flexbox horizontal align={'center'} className={styles.leftActions}>
- {leftContent ?? (
- <ActionBar
- disableCollapse
- borderRadius={borderRadius}
- dropdownPlacement={dropdownPlacement}
- extraActionItems={extraActionItems}
- />
- )}
+ <Flexbox horizontal align={'center'} flex={'none'} gap={2}>
+ <Flexbox horizontal align={'center'} className={styles.leftActions}>
+ {leftContent ?? (
+ <ActionBar
+ disableCollapse
+ borderRadius={borderRadius}
+ dropdownPlacement={dropdownPlacement}
+ extraActionItems={extraActionItems}
+ />
+ )}
+ </Flexbox>
+ <ComposerExpandButton />
</Flexbox>
);
const leftSlot = noticeNode ? (
diff --git a/src/features/ChatInput/Mobile/index.tsx b/src/features/ChatInput/Mobile/index.tsx
index 423d4fda359..55365667f69 100644
--- a/src/features/ChatInput/Mobile/index.tsx
+++ b/src/features/ChatInput/Mobile/index.tsx
@@ -6,6 +6,7 @@ import { createStaticStyles, cssVar, cx } from 'antd-style';
import { memo } from 'react';
import ChatInputNotice from '@/features/ChatInput/ChatInputNotice';
+import ComposerExpandButton from '@/features/ChatInput/components/ComposerExpandButton';
import { useChatInputStore } from '@/features/ChatInput/store';
import dynamic from '@/libs/next/dynamic';
@@ -74,8 +75,11 @@ const DesktopChatInput = memo(() => {
<ChatInputActionBar
left={
<Flexbox horizontal align={'center'} className={styles.leftSlot} gap={4}>
- <Flexbox horizontal align={'center'} className={styles.leftActions}>
- <ActionBar disableCollapse />
+ <Flexbox horizontal align={'center'} flex={'none'} gap={2}>
+ <Flexbox horizontal align={'center'} className={styles.leftActions}>
+ <ActionBar disableCollapse />
+ </Flexbox>
+ <ComposerExpandButton />
</Flexbox>
<ChatInputNotice />
</Flexbox>
diff --git a/src/features/ChatInput/SendArea/index.tsx b/src/features/ChatInput/SendArea/index.tsx
index ea5fa494a6a..2b935fb7ed0 100644
--- a/src/features/ChatInput/SendArea/index.tsx
+++ b/src/features/ChatInput/SendArea/index.tsx
@@ -6,7 +6,6 @@ import { type ActionKey } from '../ActionBar/config';
import { actionMap } from '../ActionBar/config';
import { useChatInputResourceAccess } from '../hooks/useChatInputResourceAccess';
import { useChatInputStore } from '../store';
-import ExpandButton from './ExpandButton';
import { resolveSendAreaActionKeys } from './resolveActionKeys';
import SendButton from './SendButton';
@@ -27,7 +26,6 @@ interface SendAreaProps {
const SendArea = memo<SendAreaProps>(({ hideContextWindow = true }) => {
const { canShowControls } = useChatInputResourceAccess();
- const allowExpand = useChatInputStore((s) => s.allowExpand);
const rightActions = useChatInputStore((s) => s.rightActions, isEqual);
const activeAudioInputMode = useChatInputStore((s) => s.activeAudioInputMode);
const audioInputActive = activeAudioInputMode !== undefined;
@@ -48,7 +46,6 @@ const SendArea = memo<SendAreaProps>(({ hideContextWindow = true }) => {
return (
<Flexbox horizontal align={'center'} flex={'none'} gap={12}>
- {canShowControls && allowExpand && !audioInputActive && <ExpandButton />}
{items}
{!audioInputActive && <SendButton />}
</Flexbox>
diff --git a/src/features/ChatInput/VoiceMessage/index.tsx b/src/features/ChatInput/VoiceMessage/index.tsx
index c3d2fbf330f..4188a9ddbda 100644
--- a/src/features/ChatInput/VoiceMessage/index.tsx
+++ b/src/features/ChatInput/VoiceMessage/index.tsx
@@ -13,7 +13,11 @@ import { useEffectiveModel } from '../hooks/useEffectiveModel';
import { useChatInputStore, useStoreApi } from '../store';
import { formatVoiceDuration } from './mediaRecorder';
import { useIntentionalHover } from './useIntentionalHover';
-import { getVoiceMessageActionState, useVoiceMessageCapability } from './useVoiceMessageCapability';
+import {
+ getVoiceMessageActionState,
+ getVoiceMessageIdleState,
+ useVoiceMessageCapability,
+} from './useVoiceMessageCapability';
import { useVoiceMessageRecorder } from './useVoiceMessageRecorder';
const VoiceMessageIcon = ({
@@ -591,7 +595,13 @@ const VoiceMessage = memo(() => {
const isActive = activeAudioInputMode === 'voiceMessage' || hasRecorderActivity;
const isOtherAudioModeActive =
activeAudioInputMode !== undefined && activeAudioInputMode !== 'voiceMessage';
- const canStart = canUseVoiceMessage && Boolean(onVoiceMessageSend) && !isOtherAudioModeActive;
+ const idleState = getVoiceMessageIdleState({
+ canRecordVoiceMessage,
+ hasSendHandler: Boolean(onVoiceMessageSend),
+ isGenerating,
+ isOtherAudioModeActive,
+ });
+ const canStart = idleState.canStart;
useEffect(() => {
if (hasRecorderActivity && activeAudioInputMode !== 'voiceMessage') {
@@ -660,11 +670,11 @@ const VoiceMessage = memo(() => {
}, [recorder]);
if (!isActive) {
+ if (idleState.hidden) return null;
+
const disabledReason = isOtherAudioModeActive
? t('voiceMessage.otherAudioModeActive')
- : isGenerating
- ? t('voiceMessage.replyInProgress')
- : t('voiceMessage.unsupported');
+ : t('voiceMessage.replyInProgress');
return canStart ? (
<ChatInputAction
diff --git a/src/features/ChatInput/VoiceMessage/useVoiceMessageCapability.test.ts b/src/features/ChatInput/VoiceMessage/useVoiceMessageCapability.test.ts
index 2c4da6db924..6b05ce55248 100644
--- a/src/features/ChatInput/VoiceMessage/useVoiceMessageCapability.test.ts
+++ b/src/features/ChatInput/VoiceMessage/useVoiceMessageCapability.test.ts
@@ -7,6 +7,7 @@ import { useAiInfraStore } from '@/store/aiInfra';
import {
getVoiceMessageActionState,
getVoiceMessageCapability,
+ getVoiceMessageIdleState,
supportsRawAudioMessage,
useVoiceMessageCapability,
} from './useVoiceMessageCapability';
@@ -377,3 +378,44 @@ describe('getVoiceMessageActionState', () => {
});
});
});
+
+describe('getVoiceMessageIdleState', () => {
+ const base = {
+ canRecordVoiceMessage: true,
+ hasSendHandler: true,
+ isGenerating: false,
+ isOtherAudioModeActive: false,
+ };
+
+ it('drops the trigger when the model cannot take audio at all', () => {
+ expect(getVoiceMessageIdleState({ ...base, canRecordVoiceMessage: false })).toEqual({
+ canStart: false,
+ hidden: true,
+ });
+ });
+
+ it('drops the trigger on a composer that has no voice-message handler', () => {
+ expect(getVoiceMessageIdleState({ ...base, hasSendHandler: false })).toEqual({
+ canStart: false,
+ hidden: true,
+ });
+ });
+
+ it('keeps the trigger visible but inert while a reply is generating', () => {
+ expect(getVoiceMessageIdleState({ ...base, isGenerating: true })).toEqual({
+ canStart: false,
+ hidden: false,
+ });
+ });
+
+ it('keeps the trigger visible but inert while another audio mode owns the bar', () => {
+ expect(getVoiceMessageIdleState({ ...base, isOtherAudioModeActive: true })).toEqual({
+ canStart: false,
+ hidden: false,
+ });
+ });
+
+ it('offers the trigger when the model supports audio and nothing else is running', () => {
+ expect(getVoiceMessageIdleState(base)).toEqual({ canStart: true, hidden: false });
+ });
+});
diff --git a/src/features/ChatInput/VoiceMessage/useVoiceMessageCapability.ts b/src/features/ChatInput/VoiceMessage/useVoiceMessageCapability.ts
index 7b63c7a2e7b..a16388c89d6 100644
--- a/src/features/ChatInput/VoiceMessage/useVoiceMessageCapability.ts
+++ b/src/features/ChatInput/VoiceMessage/useVoiceMessageCapability.ts
@@ -11,6 +11,33 @@ import {
useServerConfigStore,
} from '@/store/serverConfig';
+interface VoiceMessageIdleStateInput {
+ canRecordVoiceMessage: boolean;
+ hasSendHandler: boolean;
+ isGenerating: boolean;
+ isOtherAudioModeActive: boolean;
+}
+
+/**
+ * How the idle (not recording) trigger presents itself.
+ *
+ * "Can't right now" and "can't at all" are different answers. A run in flight
+ * or another audio mode ends, so the trigger stays put and its tooltip says
+ * why. A model that cannot take audio — or a composer with no voice-message
+ * handler — never will, so the trigger is dropped instead of sitting inert
+ * beside Send where nobody can tell whether it works.
+ */
+export const getVoiceMessageIdleState = ({
+ canRecordVoiceMessage,
+ hasSendHandler,
+ isGenerating,
+ isOtherAudioModeActive,
+}: VoiceMessageIdleStateInput) => {
+ if (!canRecordVoiceMessage || !hasSendHandler) return { hidden: true, canStart: false } as const;
+
+ return { hidden: false, canStart: !isGenerating && !isOtherAudioModeActive } as const;
+};
+
interface VoiceMessageActionStateInput {
canRecordVoiceMessage: boolean;
canSendRecording: boolean;
diff --git a/src/features/ChatInput/components/ComposerExpandButton.tsx b/src/features/ChatInput/components/ComposerExpandButton.tsx
new file mode 100644
index 00000000000..032abcd245f
--- /dev/null
+++ b/src/features/ChatInput/components/ComposerExpandButton.tsx
@@ -0,0 +1,26 @@
+'use client';
+
+import { memo } from 'react';
+
+import { useChatInputResourceAccess } from '../hooks/useChatInputResourceAccess';
+import ExpandButton from '../SendArea/ExpandButton';
+import { useChatInputStore } from '../store';
+
+/**
+ * The expand toggle, gated the way the send area used to gate it. It sits in
+ * the composer's left slot: the right side is reserved for the model chip and
+ * Send, and an audio session takes the whole bar over.
+ */
+const ComposerExpandButton = memo(() => {
+ const { canShowControls } = useChatInputResourceAccess();
+ const allowExpand = useChatInputStore((s) => s.allowExpand);
+ const audioInputActive = useChatInputStore((s) => s.activeAudioInputMode !== undefined);
+
+ if (!canShowControls || !allowExpand || audioInputActive) return null;
+
+ return <ExpandButton />;
+});
+
+ComposerExpandButton.displayName = 'ComposerExpandButton';
+
+export default ComposerExpandButton;
diff --git a/src/features/ChatInput/ControlBar/HeteroModel/Trigger.tsx b/src/features/ChatInput/components/SelectorTrigger.tsx
similarity index 77%
rename from src/features/ChatInput/ControlBar/HeteroModel/Trigger.tsx
rename to src/features/ChatInput/components/SelectorTrigger.tsx
index 2868c5ac244..4eeb25ef188 100644
--- a/src/features/ChatInput/ControlBar/HeteroModel/Trigger.tsx
+++ b/src/features/ChatInput/components/SelectorTrigger.tsx
@@ -37,6 +37,10 @@ const styles = createStaticStyles(({ css }) => ({
}));
/**
+ * The text chip both composer model selectors open from — the heterogeneous
+ * one and the standard model + reasoning-effort one. Text only by design: the
+ * label already names the model, so an icon would only add noise next to Send.
+ *
* `DropdownMenuTrigger` clones its child to inject the open handler, ref and
* `aria-haspopup`/`aria-expanded`. Swallowing the rest props here leaves a
* chip that renders correctly and never opens, so they must reach the element.
@@ -47,7 +51,7 @@ interface TriggerProps extends ComponentPropsWithRef<'div'> {
text: string;
}
-const Trigger = memo<TriggerProps>(({ ariaLabel, className, fast, text, ...rest }) => (
+const SelectorTrigger = memo<TriggerProps>(({ ariaLabel, className, fast, text, ...rest }) => (
<div {...rest} aria-label={ariaLabel} className={cx(styles.trigger, className)}>
{fast && <Icon icon={ZapIcon} size={12} />}
<span className={styles.label}>{text}</span>
@@ -55,6 +59,6 @@ const Trigger = memo<TriggerProps>(({ ariaLabel, className, fast, text, ...rest
</div>
));
-Trigger.displayName = 'HeteroModelTrigger';
+SelectorTrigger.displayName = 'SelectorTrigger';
-export default Trigger;
+export default SelectorTrigger;
diff --git a/src/features/ChatInput/ControlBar/HeteroModel/buildSelectorSubmenu.tsx b/src/features/ChatInput/components/buildSelectorSubmenu.tsx
similarity index 95%
rename from src/features/ChatInput/ControlBar/HeteroModel/buildSelectorSubmenu.tsx
rename to src/features/ChatInput/components/buildSelectorSubmenu.tsx
index cfb1c8e9928..06937fc0a1c 100644
--- a/src/features/ChatInput/ControlBar/HeteroModel/buildSelectorSubmenu.tsx
+++ b/src/features/ChatInput/components/buildSelectorSubmenu.tsx
@@ -25,7 +25,7 @@ export interface SelectorOption<T extends string> {
* `renderDropdownMenuItems` renders `extra` on submenu rows too, but @lobehub/ui
* only declares it on leaf items — widen it so the current-value column stays typed.
*/
-type SelectorSubmenuItem = DropdownItem & { extra?: ReactNode };
+export type SelectorSubmenuItem = DropdownItem & { extra?: ReactNode };
export const buildSelectorSubmenu = <T extends string>({
current,
diff --git a/src/features/ChatInput/hooks/useEffectiveModel.ts b/src/features/ChatInput/hooks/useEffectiveModel.ts
index 6660650fdf4..baf0676e9b9 100644
--- a/src/features/ChatInput/hooks/useEffectiveModel.ts
+++ b/src/features/ChatInput/hooks/useEffectiveModel.ts
@@ -20,7 +20,7 @@ interface ModelAndProvider {
* Use this everywhere a capability is gated on the model that will actually run
* (vision/upload, tool use, builtin search, context window, …) so the controls
* stay in sync with the topic model after a switch — not the stale agent
- * default. The Model/ModelLabel controls resolve display + switch routing
+ * default. The Model control resolves display + switch routing
* against the same topic model (see `useAgentModelSelection` composition there).
*/
export const useEffectiveModel = (agentId: string): ModelAndProvider => {
diff --git a/src/features/ChatInput/hooks/useReasoningEffortControl.test.ts b/src/features/ChatInput/hooks/useReasoningEffortControl.test.ts
new file mode 100644
index 00000000000..d7fb608b068
--- /dev/null
+++ b/src/features/ChatInput/hooks/useReasoningEffortControl.test.ts
@@ -0,0 +1,93 @@
+import { renderHook } from '@testing-library/react';
+import type { AiModelReasoningConfig } from 'model-bank';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { useReasoningEffortControl } from './useReasoningEffortControl';
+
+const testState = vi.hoisted(() => ({
+ ai: {
+ config: undefined as AiModelReasoningConfig | undefined,
+ reasoningParams: [] as string[],
+ updateModelReasoningConfig: vi.fn(() => Promise.resolve()),
+ updating: false,
+ },
+}));
+
+vi.mock('@/store/aiInfra', () => ({
+ aiModelSelectors: {
+ isModelHasReasoningExtendParams: () => (state: typeof testState.ai) =>
+ state.reasoningParams.length > 0,
+ isModelReasoningConfigUpdating: () => (state: typeof testState.ai) => state.updating,
+ modelReasoningConfig: () => (state: typeof testState.ai) => state.config,
+ modelReasoningExtendParams: () => (state: typeof testState.ai) => state.reasoningParams,
+ },
+ useAiInfraStore: <T>(selector: (state: typeof testState.ai) => T) => selector(testState.ai),
+}));
+
+beforeEach(() => {
+ testState.ai.config = undefined;
+ testState.ai.reasoningParams = [];
+ testState.ai.updating = false;
+ testState.ai.updateModelReasoningConfig.mockClear();
+});
+
+describe('useReasoningEffortControl', () => {
+ it('reports no reasoning params when the model declares none', () => {
+ const { result } = renderHook(() => useReasoningEffortControl('gpt-4o', 'openai'));
+
+ expect(result.current.hasReasoningParams).toBe(false);
+ expect(result.current.effortKey).toBeUndefined();
+ expect(result.current.effortLevels).toEqual([]);
+ expect(result.current.hasReasoningMode).toBe(false);
+ });
+
+ it('exposes the effort levels and the saved value', () => {
+ testState.ai.reasoningParams = ['gpt5ReasoningEffort'];
+ testState.ai.config = { gpt5ReasoningEffort: 'high' };
+
+ const { result } = renderHook(() => useReasoningEffortControl('gpt-5', 'openai'));
+
+ expect(result.current.effortKey).toBe('gpt5ReasoningEffort');
+ expect(result.current.effortLevels).toEqual(['minimal', 'low', 'medium', 'high']);
+ expect(result.current.effortValue).toBe('high');
+ });
+
+ it('falls back to the param default, keeping the gpt-5.5 exception', () => {
+ testState.ai.reasoningParams = ['gpt5_2ReasoningEffort'];
+
+ const { result: gpt55 } = renderHook(() => useReasoningEffortControl('gpt-5.5', 'openai'));
+ expect(gpt55.current.effortValue).toBe('medium');
+
+ const { result: other } = renderHook(() => useReasoningEffortControl('gpt-5.2', 'openai'));
+ expect(other.current.effortValue).toBe('none');
+ });
+
+ it('keeps the reasoning mode separate from the effort level', () => {
+ testState.ai.reasoningParams = ['effort', 'reasoningMode'];
+ testState.ai.config = { reasoningMode: 'pro' };
+
+ const { result } = renderHook(() => useReasoningEffortControl('claude', 'anthropic'));
+
+ expect(result.current.effortKey).toBe('effort');
+ expect(result.current.hasReasoningMode).toBe(true);
+ expect(result.current.modeValue).toBe('pro');
+ expect(result.current.modeLevels).toEqual(['standard', 'pro']);
+ });
+
+ it('writes the model-instance config, and ignores clicks while a write is in flight', () => {
+ testState.ai.reasoningParams = ['effort'];
+
+ const { result, rerender } = renderHook(() => useReasoningEffortControl('claude', 'anthropic'));
+ result.current.select({ effort: 'max' });
+
+ expect(testState.ai.updateModelReasoningConfig).toHaveBeenCalledWith('claude', 'anthropic', {
+ effort: 'max',
+ });
+
+ testState.ai.updating = true;
+ rerender();
+ result.current.select({ effort: 'low' });
+
+ expect(testState.ai.updateModelReasoningConfig).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/src/features/ChatInput/hooks/useReasoningEffortControl.ts b/src/features/ChatInput/hooks/useReasoningEffortControl.ts
new file mode 100644
index 00000000000..9c0184a25d4
--- /dev/null
+++ b/src/features/ChatInput/hooks/useReasoningEffortControl.ts
@@ -0,0 +1,89 @@
+'use client';
+
+import isEqual from 'fast-deep-equal';
+import type { AiModelReasoningConfig } from 'model-bank';
+import { MODEL_REASONING_PARAM_DEFAULTS, MODEL_REASONING_PARAM_LEVELS } from 'model-bank';
+import { useCallback } from 'react';
+
+import { aiModelSelectors, useAiInfraStore } from '@/store/aiInfra';
+
+type EffortKey = Exclude<keyof AiModelReasoningConfig, 'reasoningMode'>;
+/** Every level any effort-family param can take — all have a `reasoningEffort.levels.*` label. */
+type EffortLevel = NonNullable<AiModelReasoningConfig[EffortKey]>;
+type ReasoningMode = NonNullable<AiModelReasoningConfig['reasoningMode']>;
+
+export interface ReasoningEffortControl {
+ /** The single effort-family extend param this model exposes, if any. */
+ effortKey?: EffortKey;
+ effortLevels: readonly EffortLevel[];
+ effortValue?: EffortLevel;
+ hasReasoningMode: boolean;
+ /** False when the model exposes neither an effort level nor a reasoning mode. */
+ hasReasoningParams: boolean;
+ modeLevels: readonly ReasoningMode[];
+ modeValue: ReasoningMode;
+ select: (patch: AiModelReasoningConfig) => void;
+ updating: boolean;
+}
+
+/**
+ * Reasoning effort / mode for one model instance, as a user-level setting
+ * (userId + providerId + modelId, personal scope) — not part of the agent's
+ * chatConfig, so it follows the user across agents and stays writable for
+ * chat-only members.
+ *
+ * The saved defaults are fetched by ReasoningConfigLoader (mounted in
+ * ChatInputProvider), so every control built on this hook and the send pipeline
+ * (modelParamsResolver) read the same store value.
+ */
+export const useReasoningEffortControl = (
+ model: string,
+ provider: string,
+): ReasoningEffortControl => {
+ const hasReasoningParams = useAiInfraStore(
+ aiModelSelectors.isModelHasReasoningExtendParams(model, provider),
+ );
+ const reasoningParams = useAiInfraStore(
+ aiModelSelectors.modelReasoningExtendParams(model, provider),
+ isEqual,
+ );
+ const config = useAiInfraStore(aiModelSelectors.modelReasoningConfig(model, provider), isEqual);
+ const updating = useAiInfraStore(
+ aiModelSelectors.isModelReasoningConfigUpdating(model, provider),
+ );
+ const updateModelReasoningConfig = useAiInfraStore((s) => s.updateModelReasoningConfig);
+
+ const select = useCallback(
+ (patch: AiModelReasoningConfig) => {
+ if (updating) return;
+ // failure already rolls back and toasts inside the store action
+ void updateModelReasoningConfig(model, provider, patch).catch(() => {});
+ },
+ [model, provider, updateModelReasoningConfig, updating],
+ );
+
+ // modelReasoningExtendParams only returns MODEL_REASONING_EXTEND_PARAMS
+ // entries, so the narrowing cast is safe
+ const effortKey = reasoningParams.find((param) => param !== 'reasoningMode') as
+ EffortKey | undefined;
+ const hasReasoningMode = reasoningParams.includes('reasoningMode');
+
+ // Keep the same model-dependent fallback as the ControlsForm slider
+ const effortDefault = effortKey
+ ? effortKey === 'gpt5_2ReasoningEffort' && model === 'gpt-5.5'
+ ? 'medium'
+ : MODEL_REASONING_PARAM_DEFAULTS[effortKey]
+ : undefined;
+
+ return {
+ effortKey,
+ effortLevels: effortKey ? MODEL_REASONING_PARAM_LEVELS[effortKey] : [],
+ effortValue: (effortKey && config?.[effortKey]) ?? effortDefault,
+ hasReasoningMode,
+ hasReasoningParams,
+ modeLevels: MODEL_REASONING_PARAM_LEVELS.reasoningMode,
+ modeValue: config?.reasoningMode ?? MODEL_REASONING_PARAM_DEFAULTS.reasoningMode,
+ select,
+ updating,
+ };
+};
diff --git a/src/features/Home/InputArea/EditorInput.tsx b/src/features/Home/InputArea/EditorInput.tsx
index 2f00d9a0a12..b205c088caa 100644
--- a/src/features/Home/InputArea/EditorInput.tsx
+++ b/src/features/Home/InputArea/EditorInput.tsx
@@ -17,7 +17,7 @@ import { HOME_INPUT_BODY_HEIGHT } from './constants';
import ModeSelect from './ModeSelect';
const leftActions: ActionKeys[] = ['plus'];
-const rightActions: ActionKeys[] = ['modelLabel'];
+const rightActions: ActionKeys[] = ['model'];
const CONTAINER_RADIUS = 20;
/** Clearance from the container edge to the round controls sitting in its corners. */
diff --git a/src/features/HomeSidebar/hooks/useCreateModal.tsx b/src/features/HomeSidebar/hooks/useCreateModal.tsx
index 57f916e9575..7b16bc46899 100644
--- a/src/features/HomeSidebar/hooks/useCreateModal.tsx
+++ b/src/features/HomeSidebar/hooks/useCreateModal.tsx
@@ -29,7 +29,7 @@ import {
trackCreateAgentModalSkillSuggestionAction,
} from './createAgentModalAnalytics';
-const LEFT_ACTIONS: ActionKeys[] = ['model'];
+const RIGHT_ACTIONS: ActionKeys[] = ['model'];
const CREATE_MODAL_WIDTH = 'min(90vw, 760px)';
const INSTALLED_SKILL_MODAL_WIDTH = 'min(90vw, 560px)';
@@ -563,7 +563,7 @@ export const CreateAgentModal = memo<CreateAgentModalProps>(
<ChatInputProvider
agentId={agentId}
allowExpand={false}
- leftActions={LEFT_ACTIONS}
+ rightActions={RIGHT_ACTIONS}
sendButtonProps={sendButtonProps}
chatInputEditorRef={(instance) => {
if (instance) editorRef.current = instance;
diff --git a/src/features/ModelSwitchPanel/SubmenuPopup.tsx b/src/features/ModelSwitchPanel/SubmenuPopup.tsx
new file mode 100644
index 00000000000..423a75eb157
--- /dev/null
+++ b/src/features/ModelSwitchPanel/SubmenuPopup.tsx
@@ -0,0 +1,42 @@
+import {
+ DropdownMenuPopup,
+ DropdownMenuPortal,
+ DropdownMenuPositioner,
+ stopPropagation,
+} from '@lobehub/ui';
+import { memo } from 'react';
+
+import { PanelContent } from './components/PanelContent';
+import { styles } from './styles';
+
+interface ModelSwitchSubmenuPopupProps {
+ model?: string;
+ onModelChange?: (params: { model: string; provider: string }) => Promise<void>;
+ /** Called with `false` once a row is picked, so the host can close its whole menu. */
+ onOpenChange?: (open: boolean) => void;
+ provider?: string;
+}
+
+/**
+ * The model panel mounted as a nested submenu instead of its own dropdown, for
+ * hosts that fold model selection into a larger menu (chat input model + effort).
+ * The caller supplies the `DropdownMenuSubmenuRoot` and its trigger row.
+ */
+export const ModelSwitchSubmenuPopup = memo<ModelSwitchSubmenuPopupProps>(
+ ({ model, onModelChange, onOpenChange, provider }) => (
+ <DropdownMenuPortal>
+ <DropdownMenuPositioner alignOffset={-4} anchor={null} placement="right" sideOffset={8}>
+ <DropdownMenuPopup className={styles.container} onKeyDown={stopPropagation}>
+ <PanelContent
+ model={model}
+ provider={provider}
+ onModelChange={onModelChange}
+ onOpenChange={onOpenChange}
+ />
+ </DropdownMenuPopup>
+ </DropdownMenuPositioner>
+ </DropdownMenuPortal>
+ ),
+);
+
+ModelSwitchSubmenuPopup.displayName = 'ModelSwitchSubmenuPopup';
diff --git a/src/features/ModelSwitchPanel/index.tsx b/src/features/ModelSwitchPanel/index.tsx
index e4dd63b94e8..45b932fc18d 100644
--- a/src/features/ModelSwitchPanel/index.tsx
+++ b/src/features/ModelSwitchPanel/index.tsx
@@ -69,4 +69,5 @@ ModelSwitchPanel.displayName = 'ModelSwitchPanel';
export default ModelSwitchPanel;
+export { ModelSwitchSubmenuPopup } from './SubmenuPopup';
export { type ModelSwitchPanelProps } from './types';
diff --git a/src/routes/(main)/agent/features/Conversation/MainChatInput/index.tsx b/src/routes/(main)/agent/features/Conversation/MainChatInput/index.tsx
index 8526685e9fb..b4b86e814ce 100644
--- a/src/routes/(main)/agent/features/Conversation/MainChatInput/index.tsx
+++ b/src/routes/(main)/agent/features/Conversation/MainChatInput/index.tsx
@@ -15,8 +15,9 @@ import { userGeneralSettingsSelectors } from '@/store/user/selectors';
import AgentConfigError from './AgentConfigError';
import { useSendMenuItems } from './useSendMenuItems';
-const contextWindowRightActions: ActionKeys[] = ['voiceMessage', 'contextWindow'];
+const contextWindowRightActions: ActionKeys[] = ['model', 'voiceMessage', 'contextWindow'];
const promptTransformRightActions: ActionKeys[] = [
+ 'model',
'promptTransform',
'voiceMessage',
'contextWindow',
@@ -43,9 +44,9 @@ const MainChatInput = memo(() => {
? promptTransformRightActions
: contextWindowRightActions;
- // Reasoning effort lives inside the "+" menu (Plus → 推理强度) rather than as
- // a standalone action — per the effort parameter refactoring.
- const leftActions: ActionKeys[] = useMemo(() => ['model', 'plus', 'voiceDictation'], []);
+ // The model chip lives on the right, next to Send (see rightActions); the
+ // left bar keeps the "+" menu, dictation and the expand toggle.
+ const leftActions: ActionKeys[] = useMemo(() => ['plus', 'voiceDictation'], []);
return (
<>
diff --git a/src/routes/(main)/group/features/Conversation/MainChatInput/index.tsx b/src/routes/(main)/group/features/Conversation/MainChatInput/index.tsx
index a5f718b345b..22d0a824659 100644
--- a/src/routes/(main)/group/features/Conversation/MainChatInput/index.tsx
+++ b/src/routes/(main)/group/features/Conversation/MainChatInput/index.tsx
@@ -9,8 +9,6 @@ import { useChatStore } from '@/store/chat';
import { useSendMenuItems } from './useSendMenuItems';
const leftActions: ActionKeys[] = [
- 'model',
- 'effort',
'search',
'memory',
'fileUpload',
@@ -20,7 +18,7 @@ const leftActions: ActionKeys[] = [
['typo', 'params', 'clear'],
];
-const rightActions: ActionKeys[] = ['voiceMessage', 'contextWindow'];
+const rightActions: ActionKeys[] = ['model', 'voiceMessage', 'contextWindow'];
/**
* MainChatInput
diff --git a/src/routes/(main)/group/profile/features/AgentBuilder/AgentBuilderConversation.tsx b/src/routes/(main)/group/profile/features/AgentBuilder/AgentBuilderConversation.tsx
index 71340c7ce8e..b979139e1c5 100644
--- a/src/routes/(main)/group/profile/features/AgentBuilder/AgentBuilderConversation.tsx
+++ b/src/routes/(main)/group/profile/features/AgentBuilder/AgentBuilderConversation.tsx
@@ -12,8 +12,8 @@ import TopicSelector from './TopicSelector';
interface AgentBuilderConversationProps {
agentId: string;
}
-const actions: ActionKeys[] = ['model'];
-const rightActions: ActionKeys[] = [];
+const actions: ActionKeys[] = [];
+const rightActions: ActionKeys[] = ['model'];
/**
* Agent Builder Conversation Component
diff --git a/src/store/chat/slices/topic/action.ts b/src/store/chat/slices/topic/action.ts
index 160ed88e5ff..882bc8d1d48 100644
--- a/src/store/chat/slices/topic/action.ts
+++ b/src/store/chat/slices/topic/action.ts
@@ -410,7 +410,7 @@ export class ChatTopicActionImpl {
* Pin a model to a topic by writing the top-level `topics.model`/`provider`
* columns (the config source of truth), NOT metadata. Called when the user
* switches model while a topic is active so each topic keeps its own model
- * (see the Model/ModelLabel controls); generation + ChatInput display read it
+ * (see the ChatInput Model control); generation + ChatInput display read it
* back via `topicSelectors.getTopicModelById`.
*/
updateTopicModel = async (