refactor(frontend): 补充优化剩余组件

- 优化 TooltipContent 组件
- 改进 ModelsTab 和 UserModelDetailDrawer 组件
This commit is contained in:
fawney19
2025-12-12 20:22:27 +08:00
parent 9fa093c96c
commit c55058758b
3 changed files with 9 additions and 14 deletions

View File

@@ -13,6 +13,7 @@ interface Props {
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
class: undefined,
side: 'top', side: 'top',
sideOffset: 4, sideOffset: 4,
align: 'center', align: 'center',

View File

@@ -221,9 +221,9 @@ const props = defineProps<{
}>() }>()
const emit = defineEmits<{ const emit = defineEmits<{
'edit-model': [model: Model] 'editModel': [model: Model]
'delete-model': [model: Model] 'deleteModel': [model: Model]
'batch-assign': [] 'batchAssign': []
}>() }>()
const { error: showError, success: showSuccess } = useToast() const { error: showError, success: showSuccess } = useToast()
@@ -350,17 +350,17 @@ function getStatusTitle(model: Model): string {
// 编辑模型 // 编辑模型
function editModel(model: Model) { function editModel(model: Model) {
emit('edit-model', model) emit('editModel', model)
} }
// 删除模型 // 删除模型
function deleteModel(model: Model) { function deleteModel(model: Model) {
emit('delete-model', model) emit('deleteModel', model)
} }
// 打开批量关联对话框 // 打开批量关联对话框
function openBatchAssignDialog() { function openBatchAssignDialog() {
emit('batch-assign') emit('batchAssign')
} }
// 切换模型启用状态 // 切换模型启用状态

View File

@@ -370,7 +370,7 @@ const props = defineProps<Props>()
const emit = defineEmits<{ const emit = defineEmits<{
'update:open': [value: boolean] 'update:open': [value: boolean]
'toggle-capability': [modelName: string, capName: string] 'toggleCapability': [modelName: string, capName: string]
}>() }>()
const { success: showSuccess, error: showError } = useToast() const { success: showSuccess, error: showError } = useToast()
@@ -383,12 +383,6 @@ interface Props {
modelCapabilitySettings?: Record<string, Record<string, boolean>> modelCapabilitySettings?: Record<string, Record<string, boolean>>
} }
// 根据能力名称获取显示名称
function getCapabilityDisplayName(capName: string): string {
const cap = props.capabilities?.find(c => c.name === capName)
return cap?.display_name || capName
}
// 获取模型支持的用户可配置能力 // 获取模型支持的用户可配置能力
function getModelUserConfigurableCapabilities(): CapabilityDefinition[] { function getModelUserConfigurableCapabilities(): CapabilityDefinition[] {
if (!props.model?.supported_capabilities || !props.userConfigurableCapabilities) return [] if (!props.model?.supported_capabilities || !props.userConfigurableCapabilities) return []
@@ -406,7 +400,7 @@ function isCapabilityEnabled(capName: string): boolean {
// 切换能力 // 切换能力
function handleToggleCapability(capName: string) { function handleToggleCapability(capName: string) {
if (!props.model) return if (!props.model) return
emit('toggle-capability', props.model.name, capName) emit('toggleCapability', props.model.name, capName)
} }
function handleClose() { function handleClose() {