diff --git a/web/frontend/src/lib/model-channel.js b/web/frontend/src/lib/model-channel.js
new file mode 100644
index 00000000..68fbabd8
--- /dev/null
+++ b/web/frontend/src/lib/model-channel.js
@@ -0,0 +1,20 @@
+export function modelChannelName(id, channel) {
+ return channel?.name?.trim() || id;
+}
+
+export function modelChannelOptions(channels) {
+ const options = channels.map(([value, channel]) => ({ value, name: modelChannelName(value, channel) }));
+ const counts = new Map();
+ for (const { name } of options) {
+ counts.set(name, (counts.get(name) || 0) + 1);
+ }
+ return options.map(({ value, name }) => ({
+ value,
+ name,
+ label: counts.get(name) > 1 ? `${name} · ID ${value}` : name
+ }));
+}
+
+export function selectedModelChannelName(option) {
+ return option.name || option.label;
+}
diff --git a/web/frontend/src/pages/chat/ChatSettings.jsx b/web/frontend/src/pages/chat/ChatSettings.jsx
index 5dd41db7..6fc0db5f 100644
--- a/web/frontend/src/pages/chat/ChatSettings.jsx
+++ b/web/frontend/src/pages/chat/ChatSettings.jsx
@@ -4,6 +4,7 @@ import { useResource } from '../../components/hooks';
import { ErrorBanner, toastError } from '../../components/ui';
import { api } from '../../lib/http';
import { useT } from '../../lib/i18n';
+import { modelChannelName, modelChannelOptions, selectedModelChannelName } from '../../lib/model-channel';
import { REASONING_EFFORTS, REASONING_MODES } from './useModelPreferences';
const { Text } = Typography;
@@ -49,15 +50,12 @@ export default function ChatSettings({
: approvalActive
? t('chat.hitlUseHumanFirstMessage', null, '首条消息改用人工审批')
: t('chat.hitlEnableFirstMessage', null, '为首条消息开启人工审批');
- const defaultChannel = model.config.data?.default_channel;
- const defaultModel = model.channels.find(([id]) => id === defaultChannel)?.[1]?.model;
+ const defaultId = model.config.data?.default_channel;
+ const defaultName = defaultId ? modelChannelName(defaultId, model.config.data?.channels?.[defaultId]) : '';
const defaultLabel = t('chat.aiChannelDefault', null, '跟随默认通道');
const channelOptions = [
- { value: '', label: defaultModel ? `${defaultLabel} · ${defaultModel}` : defaultLabel },
- ...model.channels.map(([id, config]) => ({
- value: id,
- label: [config?.name || id, config?.model].filter(Boolean).join(' · ')
- }))
+ { value: '', label: defaultName ? `${defaultLabel} · ${defaultName}` : defaultLabel },
+ ...modelChannelOptions(model.channels)
];
const reasoningLabels = {
default: t('chat.reasoningModeDefault', null, '跟随系统'),
@@ -105,6 +103,7 @@ export default function ChatSettings({
label={t('chat.aiChannelLabel', null, 'AI 通道')}
value={model.channel}
optionList={channelOptions}
+ renderSelectedItem={selectedModelChannelName}
onSelect={model.setChannel}
loading={model.config.loading}
disabled={busy || model.config.loading || Boolean(model.config.error)}
diff --git a/web/frontend/src/pages/deep-assessments/CreateModal.jsx b/web/frontend/src/pages/deep-assessments/CreateModal.jsx
index 441b27a9..7c838307 100644
--- a/web/frontend/src/pages/deep-assessments/CreateModal.jsx
+++ b/web/frontend/src/pages/deep-assessments/CreateModal.jsx
@@ -3,6 +3,7 @@ import { useCallback, useEffect, useState } from 'react';
import { Banner, Button, Form, Modal, Spin } from '@douyinfe/semi-ui';
import { api } from '../../lib/http';
import { useT } from '../../lib/i18n';
+import { modelChannelOptions, selectedModelChannelName } from '../../lib/model-channel';
import { ErrorBanner, toastError, toastSuccess } from '../../components/ui';
const HITL_OPTIONS = [
@@ -57,10 +58,7 @@ export default function CreateAssessmentModal({ visible, onCancel, onCreated })
}
};
- const models = (options?.models || []).map(item => ({
- value: item.id,
- label: [item.name || item.id, item.model].filter(Boolean).join(' · ')
- }));
+ const models = modelChannelOptions((options?.models || []).map(item => [item.id, item]));
const roles = (options?.roles || []).map(role => ({ value: role, label: role }));
const projects = (options?.projects || []).map(project => ({ value: project.id, label: project.name || project.id }));
@@ -121,6 +119,7 @@ export default function CreateAssessmentModal({ visible, onCancel, onCreated })
field="model"
label={t('deepAssessments.model', null, '模型渠道')}
optionList={[{ value: '', label: '系统默认' }, ...models]}
+ renderSelectedItem={selectedModelChannelName}
style={{ width: '100%' }}
/>
{
const data = config.data;
if (!data) return [];
- const channels = data.ai?.channels ? Object.keys(data.ai.channels) : [];
+ const channels = data.ai?.channels || {};
+ const channelNames = Object.entries(channels).map(([id, channel]) => modelChannelName(id, channel));
+ const defaultId = data.ai?.default_channel;
const tools = Array.isArray(data.tools) ? data.tools : [];
const enabledTools = tools.filter(tool => tool.enabled).length;
return [
- { label: t('settings.defaultChannel', null, '默认 AI 通道'), value: data.ai?.default_channel || '—' },
+ { label: t('settings.defaultChannel', null, '默认 AI 通道'), value: defaultId ? modelChannelName(defaultId, channels[defaultId]) : '—' },
{
label: t('settingsBasic.aiChannelSavedList', null, '已保存通道'),
- value: `${formatNumber(channels.length)}${channels.length ? `(${channels.slice(0, 4).join('、')})` : ''}`
+ value: `${formatNumber(channelNames.length)}${channelNames.length ? `(${channelNames.slice(0, 4).join('、')})` : ''}`
},
{
label: t('settings.toolsEnabled', null, '已启用工具'),
diff --git a/web/frontend/src/pages/settings/sections/ProbePanel.jsx b/web/frontend/src/pages/settings/sections/ProbePanel.jsx
index 0248b1b9..7c02baa5 100644
--- a/web/frontend/src/pages/settings/sections/ProbePanel.jsx
+++ b/web/frontend/src/pages/settings/sections/ProbePanel.jsx
@@ -5,6 +5,7 @@ import { useId, useState } from 'react';
import { Banner, Button, Input, Select, Space, Tag, Typography } from '@douyinfe/semi-ui';
import { api } from '../../../lib/http';
import { useT } from '../../../lib/i18n';
+import { modelChannelOptions, selectedModelChannelName } from '../../../lib/model-channel';
import { ErrorBanner, KeyValueList, SectionCard, toastSuccess } from '../../../components/ui';
import { Hint } from './common';
@@ -194,15 +195,9 @@ export default function ProbePanel({ config, canWrite, reloadConfig }) {
const [saveError, setSaveError] = useState(null);
const [applyPending, setApplyPending] = useState(false);
const locked = !canWrite || saving;
- const channelNames = channelIds.map(id => channels[id].name?.trim() || id);
const channelOptions = legacy
? [{ value: MAIN_CHANNEL, label: t('settingsProbe.mainChannel', null, '主模型通道') }]
- : channelIds.map((id, index) => {
- const name = channelNames[index];
- const displayName = channelNames.indexOf(name) !== channelNames.lastIndexOf(name) ? `${name} · ${id}` : name;
- const suffix = id === defaultId ? t('settingsProbe.defaultChannelSuffix', null, '(默认)') : '';
- return { value: id, label: displayName + suffix };
- });
+ : modelChannelOptions(Object.entries(channels));
const providerOptions = PROVIDERS.map(({ value, key, fallback }) => ({ value, label: t(key, null, fallback) }));
if (!providerOptions.some(option => option.value === form.provider)) {
providerOptions.push({ value: form.provider, label: form.provider });
@@ -390,17 +385,23 @@ export default function ProbePanel({ config, canWrite, reloadConfig }) {
)}
>
-