🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(chat): warn when agent mode is on but the model lacks tool calling (#15828)
Arvin Xu87966afec8e3
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.jsonindex 5c78690ccad..f14bdd8ea56 100644--- a/locales/en-US/chat.json+++ b/locales/en-US/chat.json@@ -246,6 +246,7 @@"inbox.title": "Lobe AI","input.addAi": "Add an AI message","input.addUser": "Add a user message",+ "input.agentModeUnsupportedModel": "The current model doesn’t support agentic tool calling. Switch to a model with agent capability for the best experience.","input.costEstimate.creditsPerMillionTokens": "{{credits}} credits/M tokens","input.costEstimate.hint": "Estimated cost: ~{{credits}} credits","input.costEstimate.inputLabel": "Input",diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.jsonindex 50cbc3e6b7a..c688a658e4c 100644--- a/locales/zh-CN/chat.json+++ b/locales/zh-CN/chat.json@@ -246,6 +246,7 @@"inbox.title": "Lobe AI","input.addAi": "添加一条助理消息","input.addUser": "添加一条用户消息",+ "input.agentModeUnsupportedModel": "当前模型不支持 Agentic 工具调用,建议切换为具备 Agent 能力的模型以获得最佳体验。","input.costEstimate.creditsPerMillionTokens": "{{credits}} 积分/百万标记","input.costEstimate.hint": "预计费用:约{{credits}}积分","input.costEstimate.inputLabel": "输入",diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.tsindex 4e55715daf5..4c3ce004780 100644--- a/packages/locales/src/default/chat.ts+++ b/packages/locales/src/default/chat.ts@@ -208,6 +208,8 @@ export default {'inbox.title': 'Lobe AI','input.addAi': 'Add an AI message','input.addUser': 'Add a user message',+ 'input.agentModeUnsupportedModel':+ 'The current model doesn’t support agentic tool calling. Switch to a model with agent capability for the best experience.','input.costEstimate.creditsPerMillionTokens': '{{credits}} credits/M tokens','input.costEstimate.hint': 'Estimated cost: ~{{credits}} credits','input.costEstimate.inputLabel': 'Input',diff --git a/src/features/ChatInput/Desktop/AgentModeNotice.tsx b/src/features/ChatInput/Desktop/AgentModeNotice.tsxnew file mode 100644index 00000000000..94b194bfab7--- /dev/null+++ b/src/features/ChatInput/Desktop/AgentModeNotice.tsx@@ -0,0 +1,58 @@+'use client';++import { Alert } from '@lobehub/ui';+import { createStaticStyles, cx } from 'antd-style';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { useAgentId } from '@/features/ChatInput/hooks/useAgentId';+import { useAgentStore } from '@/store/agent';+import { agentByIdSelectors } from '@/store/agent/selectors';+import { aiModelSelectors, useAiInfraStore } from '@/store/aiInfra';++const styles = createStaticStyles(({ css }) => ({+ alert: css`+ .ant-alert-message {+ font-size: 12px;+ line-height: 18px !important;+ }++ .ant-alert-icon {+ height: 18px !important;+ }+ `,+}));++/**+ * Warns the user when Agent mode is enabled but the currently selected model+ * does not support function/tool calling — agentic runs need tool calling to+ * work, so we suggest switching to a model with agent capability.+ */+const AgentModeNotice = memo(() => {+ const { t } = useTranslation('chat');+ const agentId = useAgentId();++ const [enableAgentMode, model, provider] = useAgentStore((s) => [+ agentByIdSelectors.getAgentEnableModeById(agentId)(s),+ agentByIdSelectors.getAgentModelById(agentId)(s),+ agentByIdSelectors.getAgentModelProviderById(agentId)(s),+ ]);++ const supportToolUse = useAiInfraStore(aiModelSelectors.isModelSupportToolUse(model, provider));++ if (!enableAgentMode || supportToolUse) return null;++ return (+ <Alert+ classNames={{ alert: cx(styles.alert) }}+ style={{ fontSize: 12 }}+ title={t('input.agentModeUnsupportedModel')}+ type={'warning'}+ variant={'borderless'}+ />+ );+});++AgentModeNotice.displayName = 'AgentModeNotice';++export default AgentModeNotice;diff --git a/src/features/ChatInput/Desktop/index.tsx b/src/features/ChatInput/Desktop/index.tsxindex 6499340f2b1..e7adc46316e 100644--- a/src/features/ChatInput/Desktop/index.tsx+++ b/src/features/ChatInput/Desktop/index.tsx@@ -25,6 +25,7 @@ import { useSkillDrop } from '../InputEditor/ActionTag/useSkillDrop';import { type PlaceholderVariant } from '../InputEditor/Placeholder';import SendArea from '../SendArea';import TypoBar from '../TypoBar';+import AgentModeNotice from './AgentModeNotice';import ContextContainer from './ContextContainer';const styles = createStaticStyles(({ css, cssVar }) => ({@@ -157,6 +158,7 @@ const DesktopChatInput = memo<DesktopChatInputProps>(onDragOver={skillDrop.onDragOver}onDrop={skillDrop.onDrop}>+ {!isConfigLoading && <AgentModeNotice />}<ChatInputdata-testid="chat-input"defaultHeight={chatInputHeight || 32}