feat(models): add model test debugger for saved model configs
Let admins send real requests against configured chat, embedding, rerank, VLM, and ASR models from settings, with thinking controls shown only when the model supports them.
This commit is contained in:
@@ -1,8 +1,24 @@
|
||||
<template>
|
||||
<div class="model-settings">
|
||||
<div class="section-header">
|
||||
<h2>{{ $t('modelSettings.title') }}</h2>
|
||||
<p class="section-description">{{ $t('modelSettings.description') }}</p>
|
||||
<div class="section-header__top">
|
||||
<div>
|
||||
<h2>{{ $t('modelSettings.title') }}</h2>
|
||||
<p class="section-description">{{ $t('modelSettings.description') }}</p>
|
||||
</div>
|
||||
<t-button
|
||||
v-if="authStore.hasRole('admin')"
|
||||
type="button"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="medium"
|
||||
class="model-test-trigger"
|
||||
@click="showDebugDrawer = true"
|
||||
>
|
||||
<template #icon><play-circle-icon /></template>
|
||||
{{ $t('modelSettings.actions.debugModel') }}
|
||||
</t-button>
|
||||
</div>
|
||||
|
||||
<div class="builtin-models-hint" role="note">
|
||||
<p class="builtin-hint-label">{{ $t('modelSettings.builtinModels.title') }}</p>
|
||||
@@ -114,6 +130,7 @@
|
||||
<!-- 模型编辑器抽屉 -->
|
||||
<ModelEditorDialog v-model:visible="showDialog" :model-type="currentModelType" :model-data="editingModel"
|
||||
@confirm="handleModelSave" />
|
||||
<ModelDebugDrawer v-model:visible="showDebugDrawer" :models="allModels" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
@@ -121,9 +138,10 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { MessagePlugin } from 'tdesign-vue-next'
|
||||
import { AddIcon } from 'tdesign-icons-vue-next'
|
||||
import { AddIcon, PlayCircleIcon } from 'tdesign-icons-vue-next'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import ModelEditorDialog from '@/components/ModelEditorDialog.vue'
|
||||
import ModelDebugDrawer from '@/components/ModelDebugDrawer.vue'
|
||||
import { listModels, createModel, updateModel as updateModelAPI, deleteModel as deleteModelAPI, type ModelConfig } from '@/api/model'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
|
||||
@@ -133,6 +151,7 @@ type ModelType = 'chat' | 'embedding' | 'rerank' | 'vllm' | 'asr'
|
||||
type FilterType = 'all' | ModelType
|
||||
|
||||
const showDialog = ref(false)
|
||||
const showDebugDrawer = ref(false)
|
||||
const currentModelType = ref<ModelType>('chat')
|
||||
const editingModel = ref<any>(null)
|
||||
const loading = ref(true)
|
||||
@@ -585,6 +604,33 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
.section-header__top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.model-test-trigger {
|
||||
--td-bg-color-container-hover: transparent;
|
||||
flex-shrink: 0;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
font-weight: 600;
|
||||
|
||||
&:hover,
|
||||
&:focus,
|
||||
&.t-is-active,
|
||||
&:active {
|
||||
background-color: transparent !important;
|
||||
color: var(--td-brand-color-hover);
|
||||
}
|
||||
|
||||
&:active {
|
||||
color: var(--td-brand-color-active);
|
||||
}
|
||||
}
|
||||
|
||||
.builtin-models-hint {
|
||||
margin-top: 12px;
|
||||
padding: 10px 12px;
|
||||
|
||||
Reference in New Issue
Block a user