fix(ui): 优化提供商详情页的交互体验

- 模型列表删除按钮仅在 hover 时显示红色
- 批量关联模型对话框:只有全局模型时展开,有多个分组时全部折叠
This commit is contained in:
fawney19
2026-01-08 11:25:52 +08:00
parent 60c77cec56
commit bf09e740e9
2 changed files with 11 additions and 8 deletions

View File

@@ -531,20 +531,23 @@ watch(() => props.open, async (isOpen) => {
// 加载数据 // 加载数据
async function loadData() { async function loadData() {
await Promise.all([loadGlobalModels(), loadExistingModels()]) await Promise.all([loadGlobalModels(), loadExistingModels()])
// 默认折叠全局模型组
collapsedGroups.value = new Set(['global'])
// 检查缓存,如果有缓存数据则直接使用 // 检查缓存,如果有缓存数据则直接使用
const cachedModels = getCachedModels(props.providerId) const cachedModels = getCachedModels(props.providerId)
if (cachedModels) { if (cachedModels && cachedModels.length > 0) {
upstreamModels.value = cachedModels upstreamModels.value = cachedModels
upstreamModelsLoaded.value = true upstreamModelsLoaded.value = true
// 折叠所有上游模型组 // 有多个分组时全部折叠
const allGroups = new Set(['global'])
for (const model of cachedModels) { for (const model of cachedModels) {
if (model.api_format) { if (model.api_format) {
collapsedGroups.value.add(model.api_format) allGroups.add(model.api_format)
} }
} }
collapsedGroups.value = allGroups
} else {
// 只有全局模型时展开
collapsedGroups.value = new Set()
} }
} }
@@ -585,8 +588,8 @@ async function fetchUpstreamModels(forceRefresh = false) {
} else { } else {
upstreamModels.value = result.models upstreamModels.value = result.models
upstreamModelsLoaded.value = true upstreamModelsLoaded.value = true
// 折叠所有上游模型组 // 有多个分组时全部折叠
const allGroups = new Set(collapsedGroups.value) const allGroups = new Set(['global'])
for (const model of result.models) { for (const model of result.models) {
if (model.api_format) { if (model.api_format) {
allGroups.add(model.api_format) allGroups.add(model.api_format)

View File

@@ -178,7 +178,7 @@
<Button <Button
variant="ghost" variant="ghost"
size="icon" size="icon"
class="h-8 w-8 text-destructive hover:text-destructive" class="h-8 w-8 hover:text-destructive"
title="删除" title="删除"
@click="deleteModel(model)" @click="deleteModel(model)"
> >