feat: 完善渠道商管理
This commit is contained in:
@@ -98,3 +98,8 @@ export function updateModel(data: AiModelUpdateInput) {
|
||||
export function deleteModel(id: string) {
|
||||
return del(`/channel/model/${id}`).json();
|
||||
}
|
||||
|
||||
// 清除尊享模型ID缓存
|
||||
export function clearPremiumModelCache() {
|
||||
return post('/model/clear-premium-cache').json();
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ export interface AiModelDto {
|
||||
providerName?: string;
|
||||
iconUrl?: string;
|
||||
isPremium: boolean;
|
||||
isEnabled: boolean;
|
||||
}
|
||||
|
||||
// 创建AI模型输入
|
||||
@@ -84,6 +85,7 @@ export interface AiModelCreateInput {
|
||||
providerName?: string;
|
||||
iconUrl?: string;
|
||||
isPremium: boolean;
|
||||
isEnabled: boolean;
|
||||
}
|
||||
|
||||
// 更新AI模型输入
|
||||
@@ -103,6 +105,7 @@ export interface AiModelUpdateInput {
|
||||
providerName?: string;
|
||||
iconUrl?: string;
|
||||
isPremium: boolean;
|
||||
isEnabled: boolean;
|
||||
}
|
||||
|
||||
// 获取AI模型列表输入
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
createModel,
|
||||
updateModel,
|
||||
deleteModel,
|
||||
clearPremiumModelCache,
|
||||
} from '@/api/channel';
|
||||
|
||||
// ==================== 应用管理 ====================
|
||||
@@ -182,6 +183,7 @@ function openModelDialog(type: 'create' | 'edit', row?: AiModelDto) {
|
||||
providerName: '',
|
||||
iconUrl: '',
|
||||
isPremium: false,
|
||||
isEnabled: true,
|
||||
};
|
||||
}
|
||||
else {
|
||||
@@ -228,6 +230,17 @@ async function handleDeleteModel(row: AiModelDto) {
|
||||
}
|
||||
}
|
||||
|
||||
// 清理尊享模型缓存
|
||||
async function handleClearCache() {
|
||||
try {
|
||||
await clearPremiumModelCache();
|
||||
ElMessage.success('缓存清理成功');
|
||||
}
|
||||
catch (error: any) {
|
||||
ElMessage.error(error.message || '缓存清理失败');
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
fetchAppList();
|
||||
@@ -306,6 +319,9 @@ onMounted(() => {
|
||||
clearable
|
||||
@keyup.enter="fetchModelList"
|
||||
/>
|
||||
<el-button type="warning" size="small" @click="handleClearCache">
|
||||
清理缓存
|
||||
</el-button>
|
||||
<el-button type="primary" size="small" :icon="Plus" @click="openModelDialog('create')">
|
||||
新建
|
||||
</el-button>
|
||||
@@ -338,6 +354,13 @@ onMounted(() => {
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否启用" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.isEnabled ? 'success' : 'danger'">
|
||||
{{ row.isEnabled ? '启用' : '禁用' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="multiplier" label="模型倍率" width="100" />
|
||||
<el-table-column prop="multiplierShow" label="显示倍率" width="100" />
|
||||
<el-table-column prop="orderNum" label="排序" width="80" />
|
||||
@@ -415,6 +438,9 @@ onMounted(() => {
|
||||
<el-form-item label="是否尊享模型">
|
||||
<el-switch v-model="modelForm.isPremium" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用">
|
||||
<el-switch v-model="modelForm.isEnabled" />
|
||||
</el-form-item>
|
||||
<el-form-item label="模型倍率">
|
||||
<el-input-number v-model="modelForm.multiplier" :min="0.01" :step="0.1" />
|
||||
</el-form-item>
|
||||
|
||||
Reference in New Issue
Block a user