渠道模型列表弹窗与模型数量列
This commit is contained in:
@@ -2,8 +2,9 @@
|
||||
import { NButton, NDataTable, NInput, NSelect, NTooltip, useDialog, type DataTableColumns } from 'naive-ui'
|
||||
import { computed, h, reactive, ref } from 'vue'
|
||||
|
||||
import { createAiChannel, deleteAiChannel, probeAiChannel, syncAiChannelModels, updateAiChannel } from '@/api/aigateway'
|
||||
import { createAiChannel, deleteAiChannel, probeAiChannel, updateAiChannel } from '@/api/aigateway'
|
||||
import { listCachedRegions } from '@/api/configs'
|
||||
import AiChannelModelsModal from '@/components/ai/AiChannelModelsModal.vue'
|
||||
import GroupChips from '@/components/ai/GroupChips.vue'
|
||||
import AppInputNumber from '@/components/AppInputNumber.vue'
|
||||
import FormField from '@/components/FormField.vue'
|
||||
@@ -109,14 +110,13 @@ async function doProbe(id: number) {
|
||||
}
|
||||
}
|
||||
|
||||
async function doSync(id: number) {
|
||||
try {
|
||||
const models = await syncAiChannelModels(id)
|
||||
toast.success(`已同步 ${models.length} 个模型`)
|
||||
emit('changed')
|
||||
} catch (e) {
|
||||
toast.error(e instanceof Error ? e.message : '同步失败')
|
||||
}
|
||||
// ---- 模型列表弹窗 ----
|
||||
const showModels = ref(false)
|
||||
const modelsChannel = ref<AiChannel | null>(null)
|
||||
|
||||
function openModels(ch: AiChannel) {
|
||||
modelsChannel.value = ch
|
||||
showModels.value = true
|
||||
}
|
||||
|
||||
async function toggle(ch: AiChannel) {
|
||||
@@ -178,12 +178,16 @@ const columns = computed<DataTableColumns<AiChannel>>(() => [
|
||||
},
|
||||
{ title: '优先级', key: 'priority', width: 76, render: (r) => h('span', { class: 'mono text-[13px]' }, String(r.priority)) },
|
||||
{ title: '权重', key: 'weight', width: 66, render: (r) => h('span', { class: 'mono text-[13px]' }, String(r.weight)) },
|
||||
{
|
||||
title: '模型数量', key: 'modelCount', width: 86,
|
||||
render: (r) => h('span', { class: r.modelCount ? 'mono text-[13px]' : 'text-xs text-ink-3' }, String(r.modelCount ?? 0)),
|
||||
},
|
||||
{ title: '探测状态', key: 'probeStatus', width: 120, render: probeCell },
|
||||
{
|
||||
title: '操作', key: 'actions', width: 250,
|
||||
render: (r) => h('div', { class: 'flex items-center gap-0.5' }, [
|
||||
h(NButton, { size: 'tiny', quaternary: true, type: 'primary', loading: probing.value.has(r.id), onClick: () => doProbe(r.id) }, { default: () => '探测' }),
|
||||
h(NButton, { size: 'tiny', quaternary: true, type: 'primary', onClick: () => doSync(r.id) }, { default: () => '同步模型' }),
|
||||
h(NButton, { size: 'tiny', quaternary: true, type: 'primary', onClick: () => openModels(r) }, { default: () => '模型列表' }),
|
||||
h(NButton, { size: 'tiny', quaternary: true, onClick: () => toggle(r) }, { default: () => (r.enabled ? '停用' : '启用') }),
|
||||
h(NButton, { size: 'tiny', quaternary: true, type: 'primary', onClick: () => openEdit(r) }, { default: () => '编辑' }),
|
||||
h(NButton, { size: 'tiny', quaternary: true, type: 'error', onClick: () => confirmRemove(r) }, { default: () => '删除' }),
|
||||
@@ -205,10 +209,16 @@ const columns = computed<DataTableColumns<AiChannel>>(() => [
|
||||
</div>
|
||||
<NDataTable :columns="columns" :data="channels" :loading="loading" :bordered="false" size="small" />
|
||||
<div class="border-t border-line-soft bg-wash px-4.5 py-2.5 text-xs leading-relaxed text-ink-3">
|
||||
探测三步:列模型(服务可见性)→ 同步模型缓存 → max_tokens=1 试调(配额)· 探测成功自动复位熔断 ·
|
||||
探测三步:列模型(服务可见性)→ 同步模型缓存 → max_tokens=16 试调(配额)· 探测成功自动复位熔断 ·
|
||||
有渠道时系统自动维护「AI渠道探测」后台任务(每天 00:00 逐渠道探测,渠道清空自动暂停)
|
||||
</div>
|
||||
|
||||
<AiChannelModelsModal
|
||||
v-model:show="showModels"
|
||||
:channel="modelsChannel"
|
||||
@changed="emit('changed')"
|
||||
/>
|
||||
|
||||
<FormModal
|
||||
v-model:show="showForm"
|
||||
:title="editing ? '编辑渠道' : '添加渠道'"
|
||||
|
||||
Reference in New Issue
Block a user