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(agent): move run-priority hint to Model & Tools header with context-aware tooltip (#17219)

LiJian2291a8f7ab13
diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json
index 4f33bf45257..16c7c5072f7 100644
--- a/locales/en-US/setting.json
+++ b/locales/en-US/setting.json
@@ -618,7 +618,8 @@
"settingAgent.agentTools.overriddenNote": "{{count}} user tool(s) overridden by same-named Agent Tools; they will not run.",
"settingAgent.agentTools.pickerEmpty": "No user connectors available to add",
"settingAgent.agentTools.priorityHint": "Run priority",
- "settingAgent.agentTools.priorityTooltip": "When identifiers collide, the Agent tool overrides the User tool at runtime (Agent > Workspace > Personal).",
+ "settingAgent.agentTools.priorityTooltip": "When tools share a name, the agent-exclusive tool runs first at runtime; your user tools come next.",
+ "settingAgent.agentTools.priorityTooltipWorkspace": "When tools share a name, this agent-scoped tool runs first at runtime; the workspace user tools are the fallback.",
"settingAgent.agentTools.removeOwnedConfirm": "Delete this agent-exclusive connector? Its credentials will be removed.",
"settingAgent.agentTools.tabAgent": "Agent Tools",
"settingAgent.agentTools.tabUser": "User Tools",
diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json
index 0eb5d8cad97..39f5ba67601 100644
--- a/locales/zh-CN/setting.json
+++ b/locales/zh-CN/setting.json
@@ -618,7 +618,8 @@
"settingAgent.agentTools.overriddenNote": "{{count}} 个用户工具被同名 Agent 工具覆盖,运行时不会生效。",
"settingAgent.agentTools.pickerEmpty": "没有可添加的用户连接器",
"settingAgent.agentTools.priorityHint": "运行优先级",
- "settingAgent.agentTools.priorityTooltip": "同名时,运行时优先使用 Agent 工具(Agent > 工作空间 > 个人)。",
+ "settingAgent.agentTools.priorityTooltip": "工具同名时,运行时优先使用 Agent 专属工具,其次才使用你的用户工具。",
+ "settingAgent.agentTools.priorityTooltipWorkspace": "工具同名时,运行时优先使用该 Agent 维度的工具,其次兜底到当前工作空间下 user 维度的用户工具。",
"settingAgent.agentTools.removeOwnedConfirm": "删除这个 Agent 专属连接器?其凭据将被移除。",
"settingAgent.agentTools.tabAgent": "Agent 工具",
"settingAgent.agentTools.tabUser": "用户工具",
diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.ts
index 5d2e4a1b430..c579eaec692 100644
--- a/packages/locales/src/default/setting.ts
+++ b/packages/locales/src/default/setting.ts
@@ -716,7 +716,9 @@ export default {
'settingAgent.agentTools.pickerEmpty': 'No user connectors available to add',
'settingAgent.agentTools.priorityHint': 'Run priority',
'settingAgent.agentTools.priorityTooltip':
- 'When identifiers collide, the Agent tool overrides the User tool at runtime (Agent > Workspace > Personal).',
+ 'When tools share a name, the agent-exclusive tool runs first at runtime; your user tools come next.',
+ 'settingAgent.agentTools.priorityTooltipWorkspace':
+ 'When tools share a name, this agent-scoped tool runs first at runtime; the workspace user tools are the fallback.',
'settingAgent.agentTools.removeOwnedConfirm':
'Delete this agent-exclusive connector? Its credentials will be removed.',
'settingAgent.agentTools.tabAgent': 'Agent Tools',
diff --git a/src/features/ProfileEditor/AgentUserTools/RunPriorityHint.tsx b/src/features/ProfileEditor/AgentUserTools/RunPriorityHint.tsx
new file mode 100644
index 00000000000..802960b0754
--- /dev/null
+++ b/src/features/ProfileEditor/AgentUserTools/RunPriorityHint.tsx
@@ -0,0 +1,51 @@
+'use client';
+
+import { Flexbox, Icon, Tooltip } from '@lobehub/ui';
+import { InfoIcon } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useAgentStore } from '@/store/agent';
+import { agentByIdSelectors } from '@/store/agent/selectors';
+
+interface RunPriorityHintProps {
+ agentId?: string;
+}
+
+/**
+ * The "Run priority" hint shown in the top-right of the Model & Tools panel.
+ * The tooltip is context-aware:
+ * - Personal agent: agent-exclusive tools win over the user's tools.
+ * - Workspace agent: the agent-scoped tools win, falling back to the
+ * workspace's user-scoped tools.
+ */
+const RunPriorityHint = memo<RunPriorityHintProps>(({ agentId }) => {
+ const { t } = useTranslation('setting');
+ const activeAgentId = useAgentStore((s) => s.activeAgentId);
+ const effectiveAgentId = agentId || activeAgentId || '';
+ const isWorkspaceAgent = useAgentStore(agentByIdSelectors.isWorkspaceAgentById(effectiveAgentId));
+
+ return (
+ <Tooltip
+ title={t(
+ isWorkspaceAgent
+ ? 'settingAgent.agentTools.priorityTooltipWorkspace'
+ : 'settingAgent.agentTools.priorityTooltip',
+ )}
+ >
+ <Flexbox
+ horizontal
+ align={'center'}
+ gap={4}
+ style={{ cursor: 'help', fontSize: 12, opacity: 0.55 }}
+ >
+ <Icon icon={InfoIcon} size={14} />
+ {t('settingAgent.agentTools.priorityHint')}
+ </Flexbox>
+ </Tooltip>
+ );
+});
+
+RunPriorityHint.displayName = 'RunPriorityHint';
+
+export default RunPriorityHint;
diff --git a/src/features/ProfileEditor/AgentUserTools/index.tsx b/src/features/ProfileEditor/AgentUserTools/index.tsx
index 8f2ad749fd4..23801806bc0 100644
--- a/src/features/ProfileEditor/AgentUserTools/index.tsx
+++ b/src/features/ProfileEditor/AgentUserTools/index.tsx
@@ -1,11 +1,9 @@
'use client';
import { upsertPluginMode } from '@lobechat/types';
-import { Flexbox, Icon, Tooltip } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
import isEqual from 'fast-deep-equal';
-import { InfoIcon } from 'lucide-react';
import { memo, useEffect, useState } from 'react';
-import { useTranslation } from 'react-i18next';
import { type AgentToolProps } from '@/features/ProfileEditor/AgentTool';
import { useAgentStore } from '@/store/agent';
@@ -24,7 +22,6 @@ import UserToolsSection from './UserToolsSection';
*/
const AgentUserTools = memo<AgentToolProps>((props) => {
const { agentId } = props;
- const { t } = useTranslation('setting');
const activeAgentId = useAgentStore((s) => s.activeAgentId);
const effectiveAgentId = agentId || activeAgentId || '';
@@ -83,20 +80,6 @@ const AgentUserTools = memo<AgentToolProps>((props) => {
return (
<Flexbox gap={16} width={'100%'}>
- <Flexbox horizontal align={'center'} justify={'flex-end'}>
- <Tooltip title={t('settingAgent.agentTools.priorityTooltip')}>
- <Flexbox
- horizontal
- align={'center'}
- gap={4}
- style={{ cursor: 'help', fontSize: 12, opacity: 0.55 }}
- >
- <Icon icon={InfoIcon} size={14} />
- {t('settingAgent.agentTools.priorityHint')}
- </Flexbox>
- </Tooltip>
- </Flexbox>
-
<AgentToolsSection agentId={effectiveAgentId} onStartCopy={() => setCopyMode(true)} />
<UserToolsSection
diff --git a/src/routes/(main)/agent/profile/features/ProfileEditor/index.tsx b/src/routes/(main)/agent/profile/features/ProfileEditor/index.tsx
index 9937e9f40df..c4701a85a50 100644
--- a/src/routes/(main)/agent/profile/features/ProfileEditor/index.tsx
+++ b/src/routes/(main)/agent/profile/features/ProfileEditor/index.tsx
@@ -10,6 +10,7 @@ import React, { memo } from 'react';
import { useTranslation } from 'react-i18next';
import ModelSelect from '@/features/ModelSelect';
+import RunPriorityHint from '@/features/ProfileEditor/AgentUserTools/RunPriorityHint';
import { usePermission } from '@/hooks/usePermission';
import { useAgentStore } from '@/store/agent';
import { agentSelectors } from '@/store/agent/selectors';
@@ -139,7 +140,10 @@ const ProfileEditor = memo(() => {
) : (
<>
<Flexbox className={styles.configPanel} gap={10}>
- <div className={styles.configLabel}>{t('settingAgent.runtimeConfig.title')}</div>
+ <Flexbox horizontal align={'center'} gap={12} justify={'space-between'}>
+ <div className={styles.configLabel}>{t('settingAgent.runtimeConfig.title')}</div>
+ <RunPriorityHint agentId={agentId} />
+ </Flexbox>
<Flexbox horizontal align={'center'} gap={12} justify={'flex-start'} wrap={'wrap'}>
<ModelSelect
initialWidth