Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78cc2aab56 | ||
|
|
08fa529348 | ||
|
|
e2cdb99194 |
@@ -2,6 +2,31 @@
|
|||||||
|
|
||||||
格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/)(版本段不记日期),版本号遵循语义化版本。
|
格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/)(版本段不记日期),版本号遵循语义化版本。
|
||||||
|
|
||||||
|
## [0.6.0]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- AI 网关渠道表格新增「模型数量」列(与模型列表同口径:排除黑名单、随「过滤弃用」开关)
|
||||||
|
- 渠道「模型列表」弹窗(替代原「同步模型」按钮,同步入口迁入弹窗):模型按能力分组展示(对话 / 向量 / 重排 / 语音),支持关键字过滤;每行可「测试」(通过即标记「验证模型」徽章并置渠道可用,后续探测优先使用)与「拉黑」(全局黑名单);弃用模型降灰标注,非对话模型不提供测试;操作按钮悬停行时着色,保持列表安静
|
||||||
|
|
||||||
|
## [0.5.1]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 设置 · 账号安全绑定入口:已绑定的登录方式按钮置禁用态并显示「已绑定」,解绑后自动恢复可点
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- 修复禁用密码登录后登录页闪烁:登录方式加载完成前显示加载态,不再先渲染密码表单再切换,同时消除了闪烁窗口内误提交密码触发 403「密码登录已禁用」日志的问题
|
||||||
|
- 系统日志「动作」列补齐 26 条缺失描述(退出登录、外部身份登录 / 绑定、修改登录凭据、AI 密钥 / 渠道 / 黑名单 / 网关设置、通知渠道 / 模板、代理导入 / 探测 / 关联租户等)
|
||||||
|
|
||||||
|
## [0.5.0]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- AI 网关「接入信息」新增 `POST /tts` 端点展示(文本转语音 · xAI 官方格式)
|
||||||
|
- AI 网关「可用模型」新增「过滤弃用」开关:开启后已宣布弃用(即使未退役)的模型从模型列表与路由中排除,状态持久化,切换即时刷新列表
|
||||||
|
|
||||||
## [0.4.0]
|
## [0.4.0]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import type {
|
|||||||
AiModel,
|
AiModel,
|
||||||
AiModelBlacklistItem,
|
AiModelBlacklistItem,
|
||||||
AiModelCacheItem,
|
AiModelCacheItem,
|
||||||
|
AiSettings,
|
||||||
} from '@/types/api'
|
} from '@/types/api'
|
||||||
|
|
||||||
// ---- 网关密钥 ----
|
// ---- 网关密钥 ----
|
||||||
@@ -82,12 +83,31 @@ export function syncAiChannelModels(id: number): Promise<AiModelCacheItem[]> {
|
|||||||
}).then((r) => r.items)
|
}).then((r) => r.items)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function listAiChannelModels(id: number): Promise<AiModelCacheItem[]> {
|
||||||
|
return request<{ items: AiModelCacheItem[] }>(`/ai-channels/${id}/models`).then((r) => r.items)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 单模型 max_tokens=16 试调;通过即设为该渠道探测验证模型并按需置渠道可用 */
|
||||||
|
export function testAiChannelModel(id: number, model: string): Promise<AiChannel> {
|
||||||
|
return request(`/ai-channels/${id}/test-model`, { method: 'POST', body: { model } })
|
||||||
|
}
|
||||||
|
|
||||||
// ---- 聚合模型与调用日志 ----
|
// ---- 聚合模型与调用日志 ----
|
||||||
|
|
||||||
export function listAiModels(): Promise<AiModel[]> {
|
export function listAiModels(): Promise<AiModel[]> {
|
||||||
return request<{ items: AiModel[] }>('/ai-models').then((r) => r.items)
|
return request<{ items: AiModel[] }>('/ai-models').then((r) => r.items)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---- 网关全局设置 ----
|
||||||
|
|
||||||
|
export function getAiSettings(): Promise<AiSettings> {
|
||||||
|
return request<AiSettings>('/ai-settings')
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateAiSettings(body: AiSettings): Promise<AiSettings> {
|
||||||
|
return request<AiSettings>('/ai-settings', { method: 'PUT', body })
|
||||||
|
}
|
||||||
|
|
||||||
// ---- 模型黑名单 ----
|
// ---- 模型黑名单 ----
|
||||||
|
|
||||||
export function listAiBlacklist(): Promise<AiModelBlacklistItem[]> {
|
export function listAiBlacklist(): Promise<AiModelBlacklistItem[]> {
|
||||||
|
|||||||
@@ -0,0 +1,201 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { NButton, NInput, NModal, useDialog } from 'naive-ui'
|
||||||
|
import { computed, ref, watch } from 'vue'
|
||||||
|
|
||||||
|
import {
|
||||||
|
addAiBlacklist,
|
||||||
|
listAiChannelModels,
|
||||||
|
syncAiChannelModels,
|
||||||
|
testAiChannelModel,
|
||||||
|
} from '@/api/aigateway'
|
||||||
|
import { useToast } from '@/composables/useToast'
|
||||||
|
import type { AiChannel, AiModelCacheItem } from '@/types/api'
|
||||||
|
|
||||||
|
const props = defineProps<{ show: boolean; channel: AiChannel | null }>()
|
||||||
|
const emit = defineEmits<{ 'update:show': [boolean]; changed: [] }>()
|
||||||
|
|
||||||
|
const toast = useToast()
|
||||||
|
const dialog = useDialog()
|
||||||
|
|
||||||
|
const rows = ref<AiModelCacheItem[]>([])
|
||||||
|
const loading = ref(false)
|
||||||
|
const syncing = ref(false)
|
||||||
|
const testing = ref('')
|
||||||
|
const filter = ref('')
|
||||||
|
/** 本地镜像验证模型:测试通过即时高亮,不等父级刷新 */
|
||||||
|
const probeModel = ref('')
|
||||||
|
|
||||||
|
const CAP_ORDER = ['CHAT', 'EMBEDDING', 'RERANK', 'TTS']
|
||||||
|
const CAP_LABEL: Record<string, string> = { CHAT: '对话', EMBEDDING: '向量', RERANK: '重排', TTS: '语音' }
|
||||||
|
|
||||||
|
/** 按能力分组 + 关键字过滤;仅对话组提供「测试」入口 */
|
||||||
|
const groups = computed(() => {
|
||||||
|
const kw = filter.value.trim().toLowerCase()
|
||||||
|
const buckets = new Map<string, AiModelCacheItem[]>()
|
||||||
|
for (const r of rows.value) {
|
||||||
|
if (kw && !r.name.toLowerCase().includes(kw)) continue
|
||||||
|
const cap = r.capability || 'CHAT'
|
||||||
|
buckets.set(cap, [...(buckets.get(cap) ?? []), r])
|
||||||
|
}
|
||||||
|
const order = [...CAP_ORDER, ...[...buckets.keys()].filter((c) => !CAP_ORDER.includes(c))]
|
||||||
|
return order
|
||||||
|
.filter((cap) => buckets.has(cap))
|
||||||
|
.map((cap) => ({ cap, label: CAP_LABEL[cap] ?? cap, items: buckets.get(cap)! }))
|
||||||
|
})
|
||||||
|
|
||||||
|
const shownCount = computed(() => groups.value.reduce((n, g) => n + g.items.length, 0))
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.show,
|
||||||
|
(show) => {
|
||||||
|
if (show && props.channel) {
|
||||||
|
probeModel.value = props.channel.probeModel
|
||||||
|
filter.value = ''
|
||||||
|
void reload()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
async function reload() {
|
||||||
|
if (!props.channel) return
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
rows.value = await listAiChannelModels(props.channel.id)
|
||||||
|
} catch (e) {
|
||||||
|
toast.error(e instanceof Error ? e.message : '加载失败')
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function doSync() {
|
||||||
|
if (!props.channel) return
|
||||||
|
syncing.value = true
|
||||||
|
try {
|
||||||
|
rows.value = await syncAiChannelModels(props.channel.id)
|
||||||
|
toast.success(`已同步 ${rows.value.length} 个模型`)
|
||||||
|
emit('changed')
|
||||||
|
} catch (e) {
|
||||||
|
toast.error(e instanceof Error ? e.message : '同步失败')
|
||||||
|
} finally {
|
||||||
|
syncing.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function doTest(name: string) {
|
||||||
|
if (!props.channel || testing.value) return
|
||||||
|
testing.value = name
|
||||||
|
try {
|
||||||
|
const ch = await testAiChannelModel(props.channel.id, name)
|
||||||
|
probeModel.value = ch.probeModel
|
||||||
|
toast.success('测试通过', '已设为该渠道探测验证模型,后续探测优先使用')
|
||||||
|
emit('changed')
|
||||||
|
} catch (e) {
|
||||||
|
toast.error(e instanceof Error ? e.message : '测试失败')
|
||||||
|
} finally {
|
||||||
|
testing.value = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmBlacklist(name: string) {
|
||||||
|
dialog.warning({
|
||||||
|
title: '拉黑模型',
|
||||||
|
content: `「${name}」将从全部渠道剔除,同步与探测不再入库;可在模型黑名单中移出后重新同步恢复。`,
|
||||||
|
positiveText: '拉黑',
|
||||||
|
negativeText: '取消',
|
||||||
|
onPositiveClick: async () => {
|
||||||
|
try {
|
||||||
|
await addAiBlacklist(name)
|
||||||
|
toast.success('已拉黑')
|
||||||
|
void reload()
|
||||||
|
emit('changed')
|
||||||
|
} catch (e) {
|
||||||
|
toast.error(e instanceof Error ? e.message : '拉黑失败')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<NModal
|
||||||
|
:show="show"
|
||||||
|
preset="card"
|
||||||
|
:style="{ width: '640px', maxWidth: 'calc(100vw - 24px)' }"
|
||||||
|
@update:show="emit('update:show', $event)"
|
||||||
|
>
|
||||||
|
<template #header>
|
||||||
|
<div>
|
||||||
|
<div class="text-[15px] leading-tight font-semibold">模型列表</div>
|
||||||
|
<div class="mono mt-1 text-xs font-normal text-ink-3">{{ channel?.name ?? '' }}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="flex items-center gap-2 pb-2">
|
||||||
|
<NInput v-model:value="filter" size="small" placeholder="过滤模型名…" clearable class="min-w-0 flex-1" />
|
||||||
|
<span class="flex-none text-xs whitespace-nowrap text-ink-3">
|
||||||
|
{{ filter ? `${shownCount} / ${rows.length}` : `${rows.length} 个模型` }}
|
||||||
|
</span>
|
||||||
|
<NButton size="small" :loading="syncing" @click="doSync">同步模型</NButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="-mx-2 max-h-[58vh] overflow-y-auto">
|
||||||
|
<div v-if="loading" class="py-10 text-center text-xs text-ink-3">加载中…</div>
|
||||||
|
<template v-else>
|
||||||
|
<template v-for="g in groups" :key="g.cap">
|
||||||
|
<div class="px-3 pt-3 pb-1 text-[11.5px] font-semibold tracking-wide text-ink-3">
|
||||||
|
{{ g.label }} <span class="font-normal">· {{ g.items.length }}</span>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-for="r in g.items"
|
||||||
|
:key="r.name"
|
||||||
|
class="group flex items-center gap-2 rounded-lg px-3 py-[5px] hover:bg-row-hover"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="mono min-w-0 truncate text-[13px]"
|
||||||
|
:class="r.deprecatedAt ? 'text-ink-3' : ''"
|
||||||
|
:title="r.modelOcid"
|
||||||
|
>
|
||||||
|
{{ r.name }}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
v-if="r.name === probeModel"
|
||||||
|
class="flex flex-none items-center gap-1 rounded-[5px] bg-info/15 px-1.5 py-px text-[10.5px] font-medium text-info"
|
||||||
|
>
|
||||||
|
<span class="h-[5px] w-[5px] rounded-full bg-info" />验证模型
|
||||||
|
</span>
|
||||||
|
<span v-if="r.deprecatedAt" class="flex-none text-[11px] text-warn">弃用</span>
|
||||||
|
<span class="min-w-0 flex-1" />
|
||||||
|
<button
|
||||||
|
v-if="g.cap === 'CHAT'"
|
||||||
|
type="button"
|
||||||
|
class="flex-none cursor-pointer rounded-[5px] px-1.5 py-0.5 text-xs hover:bg-accent/10"
|
||||||
|
:class="testing === r.name ? 'text-accent' : 'text-ink-3/70 group-hover:text-accent'"
|
||||||
|
:disabled="!!testing"
|
||||||
|
@click="doTest(r.name)"
|
||||||
|
>
|
||||||
|
{{ testing === r.name ? '测试中…' : '测试' }}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="flex-none cursor-pointer rounded-[5px] px-1.5 py-0.5 text-xs text-ink-3/70 group-hover:text-err hover:bg-err/10"
|
||||||
|
@click="confirmBlacklist(r.name)"
|
||||||
|
>
|
||||||
|
拉黑
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div v-if="!shownCount" class="py-10 text-center text-xs text-ink-3">
|
||||||
|
{{ rows.length ? '无匹配模型' : '暂无模型缓存,点击右上「同步模型」拉取' }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-1 border-t border-line-soft pt-2.5 text-[11.5px] leading-relaxed text-ink-3">
|
||||||
|
<span class="font-medium text-ink-2">测试</span>:发 max_tokens=16
|
||||||
|
试调,通过即设为该渠道探测验证模型(后续探测优先使用)并置渠道可用 ·
|
||||||
|
<span class="font-medium text-ink-2">拉黑</span>:全局生效,从全部渠道剔除 ·
|
||||||
|
非对话模型不提供测试
|
||||||
|
</div>
|
||||||
|
</NModal>
|
||||||
|
</template>
|
||||||
@@ -2,8 +2,9 @@
|
|||||||
import { NButton, NDataTable, NInput, NSelect, NTooltip, useDialog, type DataTableColumns } from 'naive-ui'
|
import { NButton, NDataTable, NInput, NSelect, NTooltip, useDialog, type DataTableColumns } from 'naive-ui'
|
||||||
import { computed, h, reactive, ref } from 'vue'
|
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 { listCachedRegions } from '@/api/configs'
|
||||||
|
import AiChannelModelsModal from '@/components/ai/AiChannelModelsModal.vue'
|
||||||
import GroupChips from '@/components/ai/GroupChips.vue'
|
import GroupChips from '@/components/ai/GroupChips.vue'
|
||||||
import AppInputNumber from '@/components/AppInputNumber.vue'
|
import AppInputNumber from '@/components/AppInputNumber.vue'
|
||||||
import FormField from '@/components/FormField.vue'
|
import FormField from '@/components/FormField.vue'
|
||||||
@@ -109,14 +110,13 @@ async function doProbe(id: number) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function doSync(id: number) {
|
// ---- 模型列表弹窗 ----
|
||||||
try {
|
const showModels = ref(false)
|
||||||
const models = await syncAiChannelModels(id)
|
const modelsChannel = ref<AiChannel | null>(null)
|
||||||
toast.success(`已同步 ${models.length} 个模型`)
|
|
||||||
emit('changed')
|
function openModels(ch: AiChannel) {
|
||||||
} catch (e) {
|
modelsChannel.value = ch
|
||||||
toast.error(e instanceof Error ? e.message : '同步失败')
|
showModels.value = true
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggle(ch: AiChannel) {
|
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: '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: '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: 'probeStatus', width: 120, render: probeCell },
|
||||||
{
|
{
|
||||||
title: '操作', key: 'actions', width: 250,
|
title: '操作', key: 'actions', width: 250,
|
||||||
render: (r) => h('div', { class: 'flex items-center gap-0.5' }, [
|
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', 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, 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: 'primary', onClick: () => openEdit(r) }, { default: () => '编辑' }),
|
||||||
h(NButton, { size: 'tiny', quaternary: true, type: 'error', onClick: () => confirmRemove(r) }, { default: () => '删除' }),
|
h(NButton, { size: 'tiny', quaternary: true, type: 'error', onClick: () => confirmRemove(r) }, { default: () => '删除' }),
|
||||||
@@ -205,10 +209,16 @@ const columns = computed<DataTableColumns<AiChannel>>(() => [
|
|||||||
</div>
|
</div>
|
||||||
<NDataTable :columns="columns" :data="channels" :loading="loading" :bordered="false" size="small" />
|
<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">
|
<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 逐渠道探测,渠道清空自动暂停)
|
有渠道时系统自动维护「AI渠道探测」后台任务(每天 00:00 逐渠道探测,渠道清空自动暂停)
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<AiChannelModelsModal
|
||||||
|
v-model:show="showModels"
|
||||||
|
:channel="modelsChannel"
|
||||||
|
@changed="emit('changed')"
|
||||||
|
/>
|
||||||
|
|
||||||
<FormModal
|
<FormModal
|
||||||
v-model:show="showForm"
|
v-model:show="showForm"
|
||||||
:title="editing ? '编辑渠道' : '添加渠道'"
|
:title="editing ? '编辑渠道' : '添加渠道'"
|
||||||
|
|||||||
@@ -204,6 +204,11 @@ const bindableProviders = computed(() => {
|
|||||||
return out
|
return out
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/** 已绑定的 provider 集合;绑定入口按钮据此禁用,解绑后自动恢复 */
|
||||||
|
const boundProviders = computed(
|
||||||
|
() => new Set((identities.data.value?.items ?? []).map((it) => it.provider)),
|
||||||
|
)
|
||||||
|
|
||||||
async function bindProvider(provider: string) {
|
async function bindProvider(provider: string) {
|
||||||
binding.value = provider
|
binding.value = provider
|
||||||
try {
|
try {
|
||||||
@@ -507,9 +512,10 @@ async function deleteProvider(p: ProviderType) {
|
|||||||
:key="p"
|
:key="p"
|
||||||
size="small"
|
size="small"
|
||||||
:loading="binding === p"
|
:loading="binding === p"
|
||||||
|
:disabled="boundProviders.has(p)"
|
||||||
@click="bindProvider(p)"
|
@click="bindProvider(p)"
|
||||||
>
|
>
|
||||||
绑定 {{ displayNameOf(p) }}
|
{{ boundProviders.has(p) ? '已绑定' : '绑定' }} {{ displayNameOf(p) }}
|
||||||
</NButton>
|
</NButton>
|
||||||
<span class="text-xs text-ink-3">将跳转到对应平台授权</span>
|
<span class="text-xs text-ink-3">将跳转到对应平台授权</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
*/
|
*/
|
||||||
const exact: Record<string, string> = {
|
const exact: Record<string, string> = {
|
||||||
'POST /api/v1/auth/login': '登录面板',
|
'POST /api/v1/auth/login': '登录面板',
|
||||||
|
'POST /api/v1/auth/logout': '退出登录',
|
||||||
|
'GET /api/v1/auth/oauth/:provider/callback': '外部身份登录 / 绑定',
|
||||||
|
'PUT /api/v1/auth/credentials': '修改登录凭据',
|
||||||
|
'PUT /api/v1/auth/password-login': '切换密码登录开关',
|
||||||
|
'POST /api/v1/auth/revoke-sessions': '撤销全部会话',
|
||||||
'POST /api/v1/auth/totp/setup': '发起两步验证绑定',
|
'POST /api/v1/auth/totp/setup': '发起两步验证绑定',
|
||||||
'POST /api/v1/auth/totp/activate': '启用两步验证',
|
'POST /api/v1/auth/totp/activate': '启用两步验证',
|
||||||
'POST /api/v1/auth/totp/disable': '停用两步验证',
|
'POST /api/v1/auth/totp/disable': '停用两步验证',
|
||||||
@@ -42,6 +47,26 @@ const exact: Record<string, string> = {
|
|||||||
'DELETE /api/v1/tasks/:id': '删除后台任务',
|
'DELETE /api/v1/tasks/:id': '删除后台任务',
|
||||||
'POST /api/v1/tasks/:id/run': '手动执行任务',
|
'POST /api/v1/tasks/:id/run': '手动执行任务',
|
||||||
'POST /api/v1/webhooks/oci-logs/:secret': '回传消息投递',
|
'POST /api/v1/webhooks/oci-logs/:secret': '回传消息投递',
|
||||||
|
'POST /api/v1/ai-keys': '创建网关密钥',
|
||||||
|
'PUT /api/v1/ai-keys/:id': '修改网关密钥',
|
||||||
|
'DELETE /api/v1/ai-keys/:id': '删除网关密钥',
|
||||||
|
'PUT /api/v1/ai-keys/:id/content-log': '设置密钥内容留痕',
|
||||||
|
'POST /api/v1/ai-channels': '创建网关渠道',
|
||||||
|
'PUT /api/v1/ai-channels/:id': '修改网关渠道',
|
||||||
|
'DELETE /api/v1/ai-channels/:id': '删除网关渠道',
|
||||||
|
'POST /api/v1/ai-channels/:id/probe': '探测网关渠道',
|
||||||
|
'POST /api/v1/ai-channels/:id/sync-models': '同步渠道模型',
|
||||||
|
'POST /api/v1/ai-channels/:id/test-model': '测试渠道模型',
|
||||||
|
'POST /api/v1/ai-blacklist': '拉黑模型',
|
||||||
|
'DELETE /api/v1/ai-blacklist/:id': '移出模型黑名单',
|
||||||
|
'PUT /api/v1/ai-settings': '保存网关设置',
|
||||||
|
'PUT /api/v1/settings/notify-channels/:type': '保存通知渠道配置',
|
||||||
|
'POST /api/v1/settings/notify-channels/:type/test': '发送通知测试消息',
|
||||||
|
'PUT /api/v1/settings/notify-templates/:kind': '保存通知模板',
|
||||||
|
'POST /api/v1/settings/notify-templates/:kind/test': '发送模板测试消息',
|
||||||
|
'POST /api/v1/proxies/import': '批量导入代理',
|
||||||
|
'POST /api/v1/proxies/:id/probe': '探测代理',
|
||||||
|
'PUT /api/v1/proxies/:id/tenants': '设置代理关联租户',
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 资源段兜底词典:精确表未命中时以「动词 + 资源」组合 */
|
/** 资源段兜底词典:精确表未命中时以「动词 + 资源」组合 */
|
||||||
|
|||||||
@@ -946,8 +946,12 @@ export interface AiChannel {
|
|||||||
lastProbeAt: string | null
|
lastProbeAt: string | null
|
||||||
probeStatus: AiProbeStatus
|
probeStatus: AiProbeStatus
|
||||||
probeError: string
|
probeError: string
|
||||||
|
/** 用户测试通过后固定的探测验证模型;探测时置于候选首位 */
|
||||||
|
probeModel: string
|
||||||
createdAt: string
|
createdAt: string
|
||||||
updatedAt: string
|
updatedAt: string
|
||||||
|
/** 渠道模型缓存计数(列表查询回填) */
|
||||||
|
modelCount: number
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 聚合可用模型(OpenAI /models 形态) */
|
/** 聚合可用模型(OpenAI /models 形态) */
|
||||||
@@ -964,10 +968,18 @@ export interface AiModelCacheItem {
|
|||||||
modelOcid: string
|
modelOcid: string
|
||||||
name: string
|
name: string
|
||||||
vendor: string
|
vendor: string
|
||||||
|
capability: string
|
||||||
syncedAt: string
|
syncedAt: string
|
||||||
|
deprecatedAt: string | null
|
||||||
|
retiredAt: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 模型黑名单条目:拉黑即全渠道剔除,同步 / 探测不再入库 */
|
/** 模型黑名单条目:拉黑即全渠道剔除,同步 / 探测不再入库 */
|
||||||
|
/** AI 网关全局设置 */
|
||||||
|
export interface AiSettings {
|
||||||
|
filterDeprecated: boolean
|
||||||
|
}
|
||||||
|
|
||||||
export interface AiModelBlacklistItem {
|
export interface AiModelBlacklistItem {
|
||||||
id: number
|
id: number
|
||||||
name: string
|
name: string
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { NButton, useDialog } from 'naive-ui'
|
import { NButton, NSwitch, useDialog } from 'naive-ui'
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
addAiBlacklist,
|
addAiBlacklist,
|
||||||
|
getAiSettings,
|
||||||
listAiBlacklist,
|
listAiBlacklist,
|
||||||
listAiChannels,
|
listAiChannels,
|
||||||
listAiKeys,
|
listAiKeys,
|
||||||
listAiModels,
|
listAiModels,
|
||||||
removeAiBlacklist,
|
removeAiBlacklist,
|
||||||
|
updateAiSettings,
|
||||||
} from '@/api/aigateway'
|
} from '@/api/aigateway'
|
||||||
import AiChannelPanel from '@/components/ai/AiChannelPanel.vue'
|
import AiChannelPanel from '@/components/ai/AiChannelPanel.vue'
|
||||||
import AiKeyPanel from '@/components/ai/AiKeyPanel.vue'
|
import AiKeyPanel from '@/components/ai/AiKeyPanel.vue'
|
||||||
@@ -32,6 +34,7 @@ const endpoints = [
|
|||||||
{ method: 'POST', path: '/messages', note: 'Claude · 流式/非流式' },
|
{ method: 'POST', path: '/messages', note: 'Claude · 流式/非流式' },
|
||||||
{ method: 'POST', path: '/embeddings', note: 'OpenAI Embeddings · 向量化' },
|
{ method: 'POST', path: '/embeddings', note: 'OpenAI Embeddings · 向量化' },
|
||||||
{ method: 'POST', path: '/audio/speech', note: '文本转语音 · xAI Voice' },
|
{ method: 'POST', path: '/audio/speech', note: '文本转语音 · xAI Voice' },
|
||||||
|
{ method: 'POST', path: '/tts', note: '文本转语音 · xAI 官方格式' },
|
||||||
{ method: 'POST', path: '/rerank', note: '文档重排 · Cohere Rerank' },
|
{ method: 'POST', path: '/rerank', note: '文档重排 · Cohere Rerank' },
|
||||||
{ method: 'POST', path: '/moderations', note: '内容审核 · OCI Guardrails' },
|
{ method: 'POST', path: '/moderations', note: '内容审核 · OCI Guardrails' },
|
||||||
{ method: 'GET', path: '/models', note: '模型列表(按密钥分组过滤)' },
|
{ method: 'GET', path: '/models', note: '模型列表(按密钥分组过滤)' },
|
||||||
@@ -87,6 +90,25 @@ async function copyModel(id: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 「过滤弃用模型」开关:开启后已宣布弃用(即使未退役)的模型从列表与路由中排除 */
|
||||||
|
const filterDeprecated = ref(false)
|
||||||
|
void getAiSettings()
|
||||||
|
.then((s) => { filterDeprecated.value = s.filterDeprecated })
|
||||||
|
.catch(() => {})
|
||||||
|
|
||||||
|
async function toggleFilterDeprecated(v: boolean) {
|
||||||
|
filterDeprecated.value = v
|
||||||
|
try {
|
||||||
|
const s = await updateAiSettings({ filterDeprecated: v })
|
||||||
|
filterDeprecated.value = s.filterDeprecated
|
||||||
|
message.success(v ? '已过滤弃用模型(列表与路由同时排除)' : '已恢复展示弃用模型')
|
||||||
|
} catch (e) {
|
||||||
|
message.error(e instanceof Error ? e.message : '操作失败')
|
||||||
|
filterDeprecated.value = !v
|
||||||
|
}
|
||||||
|
refreshModels()
|
||||||
|
}
|
||||||
|
|
||||||
function refreshModels() {
|
function refreshModels() {
|
||||||
void models.run({ silent: true })
|
void models.run({ silent: true })
|
||||||
void blacklist.run({ silent: true })
|
void blacklist.run({ silent: true })
|
||||||
@@ -166,8 +188,17 @@ async function unbanModel(b: AiModelBlacklistItem) {
|
|||||||
<div class="text-sm font-semibold">可用模型</div>
|
<div class="text-sm font-semibold">可用模型</div>
|
||||||
<div class="mt-0.5 text-xs text-ink-3">按厂商分组;点击厂商展开,点击模型名复制,✕ 加入黑名单</div>
|
<div class="mt-0.5 text-xs text-ink-3">按厂商分组;点击厂商展开,点击模型名复制,✕ 加入黑名单</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex flex-none items-center gap-3">
|
||||||
|
<label
|
||||||
|
class="flex cursor-pointer items-center gap-1.5 text-xs text-ink-3"
|
||||||
|
title="开启后,已宣布弃用(即使未退役)的模型从模型列表与路由中排除;关闭恢复"
|
||||||
|
>
|
||||||
|
过滤弃用
|
||||||
|
<NSwitch size="small" :value="filterDeprecated" @update:value="toggleFilterDeprecated" />
|
||||||
|
</label>
|
||||||
<span class="text-xs text-ink-3">{{ models.data.value?.length ?? '…' }} 个</span>
|
<span class="text-xs text-ink-3">{{ models.data.value?.length ?? '…' }} 个</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="px-4.5 py-1.5">
|
<div class="px-4.5 py-1.5">
|
||||||
<div
|
<div
|
||||||
v-for="g in modelGroups"
|
v-for="g in modelGroups"
|
||||||
|
|||||||
+11
-1
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { NButton, NInput } from 'naive-ui'
|
import { NButton, NInput, NSpin } from 'naive-ui'
|
||||||
import { onMounted, ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
|
|
||||||
@@ -30,6 +30,8 @@ const errorMsg = ref('')
|
|||||||
const providers = ref<OauthProviderInfo[]>([])
|
const providers = ref<OauthProviderInfo[]>([])
|
||||||
// 密码登录已禁用(设置里开启且存在可用外部身份):隐藏用户名密码表单
|
// 密码登录已禁用(设置里开启且存在可用外部身份):隐藏用户名密码表单
|
||||||
const passwordLoginDisabled = ref(false)
|
const passwordLoginDisabled = ref(false)
|
||||||
|
// 登录方式加载中:providers 返回前不渲染表单,避免「先见密码表单再消失」的闪烁与误提交
|
||||||
|
const bootLoading = ref(true)
|
||||||
|
|
||||||
// 左侧品牌区功能徽章:各自不同周期/幅度/相位上下浮动(不规律观感)
|
// 左侧品牌区功能徽章:各自不同周期/幅度/相位上下浮动(不规律观感)
|
||||||
const featureChips = [
|
const featureChips = [
|
||||||
@@ -47,6 +49,8 @@ onMounted(async () => {
|
|||||||
passwordLoginDisabled.value = r.passwordLoginDisabled && r.providers.length > 0
|
passwordLoginDisabled.value = r.passwordLoginDisabled && r.providers.length > 0
|
||||||
} catch {
|
} catch {
|
||||||
/* 登录页容忍 provider 列表加载失败 */
|
/* 登录页容忍 provider 列表加载失败 */
|
||||||
|
} finally {
|
||||||
|
bootLoading.value = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -155,6 +159,11 @@ async function oauthLogin(provider: string) {
|
|||||||
<div class="rounded-[14px] border border-line bg-card px-[30px] pt-[30px] pb-7 shadow-[0_18px_50px_rgba(20,20,19,.10),0_2px_8px_rgba(20,20,19,.05)]">
|
<div class="rounded-[14px] border border-line bg-card px-[30px] pt-[30px] pb-7 shadow-[0_18px_50px_rgba(20,20,19,.10),0_2px_8px_rgba(20,20,19,.05)]">
|
||||||
<div class="font-serif text-[19px] font-semibold">欢迎回来</div>
|
<div class="font-serif text-[19px] font-semibold">欢迎回来</div>
|
||||||
|
|
||||||
|
<div v-if="bootLoading" class="flex items-center justify-center py-14">
|
||||||
|
<NSpin size="small" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
<div
|
<div
|
||||||
v-if="errorMsg"
|
v-if="errorMsg"
|
||||||
class="mt-4 flex items-start gap-2 rounded-md border border-err/30 bg-err/10 px-3 py-2 text-[12.5px] text-err"
|
class="mt-4 flex items-start gap-2 rounded-md border border-err/30 bg-err/10 px-3 py-2 text-[12.5px] text-err"
|
||||||
@@ -227,6 +236,7 @@ async function oauthLogin(provider: string) {
|
|||||||
由管理员在 设置 · 账号安全 中管理
|
由管理员在 设置 · 账号安全 中管理
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user