feat: Provider 异步删除、可配置密码策略、Hub 超时优化及多项改进

- 新增 Provider 异步删除任务系统,后台分阶段删除子资源并清理残留引用
- 新增可配置密码策略等级(weak/medium/strong),支持系统设置面板调整
- aether-hub 升级至 0.1.4,idle timeout 支持禁用(设为 0),worker 默认超时调整为 120s
- OAuth 手动续期增加 Redis 分布式锁,防止并发刷新冲突
- ProxyNode 心跳检测改为 asyncio.to_thread,避免阻塞事件循环
- 删除 ModelMultiSelect 和 useInvalidModels,MultiSelect 组件通用化
- 明确 allowed_providers/allowed_api_formats 的 NULL 与空数组语义
- 前端 StandaloneKeyFormDialog、UserFormDialog 等多处 UI 优化
- 新增 Alembic 迁移脚本清理 Provider 删除后的残留引用
- 补充相关测试用例
This commit is contained in:
fawney19
2026-03-12 01:11:35 +08:00
parent 0d770d1c4d
commit 6e51a3f45d
55 changed files with 3219 additions and 862 deletions
+48 -4
View File
@@ -4,7 +4,8 @@
type="button"
:class="
cn(
'flex h-10 w-full items-center justify-between rounded-lg border bg-background px-3 text-left transition-colors hover:bg-muted/50',
'flex h-10 w-full items-center justify-between rounded-lg border bg-background px-3 text-left transition-colors',
disabled ? 'cursor-not-allowed opacity-60 hover:bg-background' : 'hover:bg-muted/50',
triggerClass,
)
"
@@ -16,6 +17,10 @@
class="truncate text-sm"
>
{{ displayText }}
<span
v-if="invalidItems.length"
class="text-destructive"
>({{ invalidItems.length }} 个已失效)</span>
</span>
<ChevronDown
class="h-4 w-4 shrink-0 text-muted-foreground transition-transform"
@@ -50,6 +55,23 @@
</div>
<div class="max-h-48 overflow-y-auto">
<div
v-for="item in filteredInvalidItems"
:key="'invalid-' + item"
class="flex cursor-pointer items-center gap-2 bg-destructive/5 px-3 py-2 hover:bg-muted/50"
@click="remove(item)"
>
<input
type="checkbox"
:checked="true"
class="h-4 w-4 shrink-0 cursor-pointer rounded border-gray-300"
@click.stop
@change="remove(item)"
>
<span class="min-w-0 truncate text-sm text-destructive">{{ item }}</span>
<span class="shrink-0 text-xs text-destructive/70">(已失效)</span>
</div>
<div
v-for="item in filteredOptions"
:key="item.value"
@@ -66,7 +88,7 @@
<span class="min-w-0 truncate text-sm">{{ item.label }}</span>
</div>
<div
v-if="filteredOptions.length === 0"
v-if="filteredOptions.length === 0 && filteredInvalidItems.length === 0"
class="px-3 py-2 text-sm text-muted-foreground"
>
{{ searchQuery.trim() ? noResultsText : emptyText }}
@@ -122,9 +144,27 @@ const emit = defineEmits<{
const isOpen = ref(false)
const searchQuery = ref('')
const showSearch = computed(
() => props.searchable && props.options.length >= props.searchThreshold,
const validValues = computed(() => new Set(props.options.map(o => o.value)))
const invalidItems = computed(() =>
props.modelValue.filter(v => !validValues.value.has(v)),
)
const totalCount = computed(() => props.options.length + invalidItems.value.length)
const showSearch = computed(
() => props.searchable && totalCount.value >= props.searchThreshold,
)
const filteredInvalidItems = computed(() => {
if (!showSearch.value || !searchQuery.value.trim()) {
return invalidItems.value
}
return invalidItems.value.filter((item) =>
matchesSearchQuery(searchQuery.value, item),
)
})
const filteredOptions = computed(() => {
if (!showSearch.value || !searchQuery.value.trim()) {
return props.options
@@ -161,4 +201,8 @@ function toggle(value: string) {
}
emit('update:modelValue', newValue)
}
function remove(value: string) {
emit('update:modelValue', props.modelValue.filter(v => v !== value))
}
</script>