mirror of
https://github.com/fawney19/Aether.git
synced 2026-01-11 20:18:30 +08:00
fix(ui): 优化提供商详情页的交互体验
- 模型列表删除按钮仅在 hover 时显示红色 - 批量关联模型对话框:只有全局模型时展开,有多个分组时全部折叠
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
@@ -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)"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user