1 Commits
Author SHA1 Message Date
wangdefa e2cdb99194 接入信息补tts端点,可用模型新增过滤弃用开关
CI / test (push) Successful in 25s
Release / release (push) Successful in 25s
- 接入信息展示 POST /tts(xAI 官方格式)
- 可用模型卡片「过滤弃用」NSwitch:GET/PUT /api/v1/ai-settings,切换即时刷新;修复 request body 双重 stringify
- CHANGELOG 0.5.0(0.4.0 已发版冻结)
2026-07-14 09:50:01 +08:00
4 changed files with 56 additions and 2 deletions
+7
View File
@@ -2,6 +2,13 @@
格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/)(版本段不记日期),版本号遵循语义化版本。
## [0.5.0]
### Added
- AI 网关「接入信息」新增 `POST /tts` 端点展示(文本转语音 · xAI 官方格式)
- AI 网关「可用模型」新增「过滤弃用」开关:开启后已宣布弃用(即使未退役)的模型从模型列表与路由中排除,状态持久化,切换即时刷新列表
## [0.4.0]
### Added
+11
View File
@@ -7,6 +7,7 @@ import type {
AiModel,
AiModelBlacklistItem,
AiModelCacheItem,
AiSettings,
} from '@/types/api'
// ---- 网关密钥 ----
@@ -88,6 +89,16 @@ export function listAiModels(): Promise<AiModel[]> {
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[]> {
+5
View File
@@ -968,6 +968,11 @@ export interface AiModelCacheItem {
}
/** 模型黑名单条目:拉黑即全渠道剔除,同步 / 探测不再入库 */
/** AI 网关全局设置 */
export interface AiSettings {
filterDeprecated: boolean
}
export interface AiModelBlacklistItem {
id: number
name: string
+32 -1
View File
@@ -1,14 +1,16 @@
<script setup lang="ts">
import { NButton, useDialog } from 'naive-ui'
import { NButton, NSwitch, useDialog } from 'naive-ui'
import { computed, ref } from 'vue'
import {
addAiBlacklist,
getAiSettings,
listAiBlacklist,
listAiChannels,
listAiKeys,
listAiModels,
removeAiBlacklist,
updateAiSettings,
} from '@/api/aigateway'
import AiChannelPanel from '@/components/ai/AiChannelPanel.vue'
import AiKeyPanel from '@/components/ai/AiKeyPanel.vue'
@@ -32,6 +34,7 @@ const endpoints = [
{ method: 'POST', path: '/messages', note: 'Claude · 流式/非流式' },
{ method: 'POST', path: '/embeddings', note: 'OpenAI Embeddings · 向量化' },
{ method: 'POST', path: '/audio/speech', note: '文本转语音 · xAI Voice' },
{ method: 'POST', path: '/tts', note: '文本转语音 · xAI 官方格式' },
{ method: 'POST', path: '/rerank', note: '文档重排 · Cohere Rerank' },
{ method: 'POST', path: '/moderations', note: '内容审核 · OCI Guardrails' },
{ 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() {
void models.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="mt-0.5 text-xs text-ink-3">按厂商分组;点击厂商展开,点击模型名复制, 加入黑名单</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>
</div>
</div>
<div class="px-4.5 py-1.5">
<div
v-for="g in modelGroups"