refactor: 前端全面替换 any 为 unknown 并统一错误处理,后端用量记录补写请求头/体

- 前端 API 层、stores、conversation 解析器、组件全面替换 any 为 unknown/具体类型
- 错误处理统一使用 parseApiError/getErrorStatus 替代 err.response?.data?.detail 模式
- 后端 handler/TaskService/UsageLifecycle/StreamTracker 链路传递 request_headers/request_body
- streaming/pending 状态更新时可补写客户端和提供商的请求头及请求体
- 新增 TaskService 和 UsageService 相关测试
This commit is contained in:
fawney19
2026-02-22 00:43:41 +08:00
parent 98e60e8f74
commit cf2eee222e
121 changed files with 1652 additions and 1179 deletions
+7 -3
View File
@@ -174,10 +174,12 @@
class="flex items-center justify-between gap-3 rounded-lg border border-border bg-muted/30 p-4"
>
<div class="flex items-center gap-3 min-w-0 flex-1">
<!-- eslint-disable vue/no-v-html -->
<div
class="oauth-icon shrink-0"
v-html="getOAuthIcon(link.provider_type)"
/>
<!-- eslint-enable vue/no-v-html -->
<div class="min-w-0">
<div class="text-sm font-medium truncate">
{{ link.display_name }}
@@ -204,10 +206,12 @@
class="flex items-center justify-between gap-3 rounded-lg border border-dashed border-border p-4 hover:border-primary/50 transition-colors"
>
<div class="flex items-center gap-3 min-w-0 flex-1">
<!-- eslint-disable vue/no-v-html -->
<div
class="oauth-icon shrink-0"
v-html="getOAuthIcon(p.provider_type)"
/>
<!-- eslint-enable vue/no-v-html -->
<div class="min-w-0">
<div class="text-sm font-medium truncate">
{{ p.display_name }}
@@ -462,7 +466,7 @@ import { useToast } from '@/composables/useToast'
import { formatCurrency } from '@/utils/format'
import { getApiUrl } from '@/utils/url'
import { log } from '@/utils/logger'
import { getErrorMessage } from '@/types/api-error'
import { getErrorMessage, getErrorStatus } from '@/types/api-error'
const authStore = useAuthStore()
const route = useRoute()
@@ -601,8 +605,8 @@ async function loadOAuthBindings() {
])
oauthLinks.value = links
bindableProviders.value = providers
} catch (err: any) {
if (err?.response?.status === 503) {
} catch (err: unknown) {
if (getErrorStatus(err) === 503) {
oauthUnavailable.value = true
return
}