mirror of
https://github.com/fawney19/Aether.git
synced 2026-01-03 00:02:28 +08:00
refactor(frontend): 补充优化剩余组件
- 优化 TooltipContent 组件 - 改进 ModelsTab 和 UserModelDetailDrawer 组件
This commit is contained in:
@@ -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',
|
||||||
|
|||||||
@@ -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')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 切换模型启用状态
|
// 切换模型启用状态
|
||||||
|
|||||||
@@ -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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user