mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
feat: 使用量轮询接口添加 API 格式转换字段
- 前端:添加 api_format、endpoint_api_format、has_format_conversion 类型定义 - 前端:轮询时同步更新格式转换相关字段 - 后端:查询时返回格式转换字段,包含历史数据兼容逻辑 - 后端:优化 import 位置提升性能
This commit is contained in:
@@ -223,6 +223,9 @@ export const meApi = {
|
||||
rate_multiplier?: number | null
|
||||
response_time_ms: number | null
|
||||
first_byte_time_ms: number | null
|
||||
api_format?: string | null
|
||||
endpoint_api_format?: string | null
|
||||
has_format_conversion?: boolean | null
|
||||
}>
|
||||
}> {
|
||||
const params = ids ? { ids } : {}
|
||||
|
||||
@@ -201,6 +201,9 @@ export const usageApi = {
|
||||
first_byte_time_ms: number | null
|
||||
provider?: string | null
|
||||
api_key_name?: string | null
|
||||
api_format?: string | null
|
||||
endpoint_api_format?: string | null
|
||||
has_format_conversion?: boolean | null
|
||||
}>
|
||||
}> {
|
||||
const params = ids?.length ? { ids: ids.join(',') } : {}
|
||||
|
||||
@@ -290,6 +290,10 @@ async function pollActiveRequests() {
|
||||
record.rate_multiplier = update.rate_multiplier ?? undefined
|
||||
record.response_time_ms = update.response_time_ms ?? undefined
|
||||
record.first_byte_time_ms = update.first_byte_time_ms ?? undefined
|
||||
// API 格式/格式转换:streaming 时已可确定,轮询时同步更新
|
||||
if (update.api_format !== undefined) record.api_format = update.api_format
|
||||
if (update.endpoint_api_format !== undefined) record.endpoint_api_format = update.endpoint_api_format
|
||||
if (update.has_format_conversion !== undefined) record.has_format_conversion = update.has_format_conversion
|
||||
// 管理员接口返回额外字段
|
||||
if ('provider' in update && typeof update.provider === 'string') {
|
||||
record.provider = update.provider
|
||||
|
||||
Reference in New Issue
Block a user