refactor: 用 EndpointFetchConfig 纯数据类替代 ORM 对象传递,统一上游模型缓存管理

- 引入 EndpointFetchConfig dataclass 替代直接传递 ProviderEndpoint ORM 对象,
  避免 DB session 关闭后 DetachedInstanceError
- 新增 build_format_to_config() 统一构建 api_format -> EndpointFetchConfig 映射
- KeyAllowedModelsDialog 改用 useUpstreamModelsCache composable 管理上游模型获取
- useUpstreamModelsCache 增加 error 字段透传部分格式获取失败的 warning
- 删除废弃的 queryProviderUpstreamModels API 函数
- ProviderCandidate 添加 __lt__ 方法支持排序比较
This commit is contained in:
fawney19
2026-02-09 12:47:47 +08:00
parent 8702786fa2
commit 8684548072
7 changed files with 71 additions and 55 deletions
@@ -54,6 +54,8 @@ export function useUpstreamModelsCache() {
if (response.success && response.data?.models) {
return {
models: response.data.models,
// 传递部分格式获取失败的 warning(后端 success=true 但仍可能附带 error)
error: response.data.error ? parseUpstreamModelError(response.data.error) : undefined,
fromCache: response.data.from_cache
}
} else {