feat(gateway): harden failover and payload handling

Retry pre-response transport failures across candidates with an explicit stop policy, and propagate end-to-end timing into usage records and UI diagnostics.

Remove legacy body, import, cookie, PII, and tunnel replay caps while preserving optional operator-configured gateway limits.
This commit is contained in:
elky
2026-07-30 01:03:27 +08:00
parent a97acc07fc
commit a04673a90d
80 changed files with 3640 additions and 1236 deletions
+2
View File
@@ -266,6 +266,8 @@ export interface RequestDetail {
scheduling_failure?: RequestSchedulingFailure | null
response_time_ms: number
first_byte_time_ms?: number | null
end_to_end_time_ms?: number | null
end_to_end_first_byte_time_ms?: number | null
created_at: string
updated_at?: string | null
request_headers?: Record<string, unknown>
@@ -846,6 +846,7 @@ export interface FailoverRuleItem {
export interface FailoverRulesConfig {
max_retries?: number
stop_on_transport_errors?: boolean
stop_status_codes?: number[]
stop_on_status_codes?: number[]
early_stop_status_codes?: number[]
+4
View File
@@ -68,6 +68,8 @@ export interface UsageRecordDetail {
rate_multiplier?: number // 成本倍率(仅管理员可见)
response_time_ms?: number | null
first_byte_time_ms?: number | null
end_to_end_time_ms?: number | null
end_to_end_first_byte_time_ms?: number | null
updated_at?: string | null
response_time_updated_at?: string | null
is_stream: boolean
@@ -357,6 +359,8 @@ export const meApi = {
rate_multiplier?: number | null
response_time_ms: number | null
first_byte_time_ms: number | null
end_to_end_time_ms?: number | null
end_to_end_first_byte_time_ms?: number | null
updated_at?: string | null
response_time_updated_at?: string | null
status_code?: number | null
+6
View File
@@ -29,6 +29,10 @@ export interface UsageRecord {
total_tokens: number
cost?: number
response_time?: number
response_time_ms?: number | null
first_byte_time_ms?: number | null
end_to_end_time_ms?: number | null
end_to_end_first_byte_time_ms?: number | null
created_at: string
updated_at?: string | null
response_time_updated_at?: string | null
@@ -554,6 +558,8 @@ export const usageApi = {
rate_multiplier?: number | null
response_time_ms: number | null
first_byte_time_ms: number | null
end_to_end_time_ms?: number | null
end_to_end_first_byte_time_ms?: number | null
updated_at?: string | null
response_time_updated_at?: string | null
status_code?: number | null