mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
feat(pool): 引入 pro_first 调度预设、Pool 候选持久化跳过与诊断信息优化
- 新增 pro_first 调度预设(Pro 优先),更新 plus_first 仅针对 Plus 计划,移除 free_team_first - Pool 内部候选(pool_key_index 不为空)跳过 DB 持久化(available/skipped/unused 均适用) - LRU 排序新增 catalog_lru_score 回退:runtime 无记录时使用 last_used_at_unix_secs - 执行路径 miss 诊断消息细化为中文,按 reason 分类输出可读说明 - build_local_request_candidate_status_record 补充 extra_data 和 created_at_unix_ms 字段 - OpenAI CLI 计划构建流程补充候选评估进度跟踪与 terminal reason 设置 - 前端 PoolSchedulingDialog 增加 pro_first 预设展示,修复 LRU 默认预设检测逻辑
This commit is contained in:
@@ -302,6 +302,15 @@ pub fn build_local_request_candidate_status_record(
|
||||
.filter(|value| !value.is_empty())?;
|
||||
let metadata = parse_request_candidate_report_context(report_context)?;
|
||||
let candidate_index = metadata.candidate_index?;
|
||||
let extra_data = build_report_candidate_extra_data(
|
||||
metadata.client_api_format.clone(),
|
||||
metadata.provider_api_format.clone(),
|
||||
metadata.upstream_url.clone(),
|
||||
metadata.mapped_model.clone(),
|
||||
metadata.key_name.clone(),
|
||||
metadata.proxy.clone(),
|
||||
);
|
||||
let created_at_unix_ms = started_at_unix_ms.or(finished_at_unix_ms);
|
||||
|
||||
Some(UpsertRequestCandidateRecord {
|
||||
id: candidate_id.to_string(),
|
||||
@@ -323,9 +332,9 @@ pub fn build_local_request_candidate_status_record(
|
||||
error_message,
|
||||
latency_ms,
|
||||
concurrent_requests: None,
|
||||
extra_data: None,
|
||||
extra_data,
|
||||
required_capabilities: None,
|
||||
created_at_unix_ms: None,
|
||||
created_at_unix_ms,
|
||||
started_at_unix_ms,
|
||||
finished_at_unix_ms,
|
||||
})
|
||||
@@ -783,7 +792,12 @@ mod tests {
|
||||
"candidate_index": 1,
|
||||
"retry_index": 2,
|
||||
"user_id": "user-1",
|
||||
"api_key_id": "api-key-1"
|
||||
"api_key_id": "api-key-1",
|
||||
"client_api_format": "openai:chat",
|
||||
"provider_api_format": "openai:cli",
|
||||
"upstream_url": "https://example.com/v1/responses",
|
||||
"mapped_model": "gpt-5-upstream",
|
||||
"key_name": "primary"
|
||||
})),
|
||||
status_update: SchedulerRequestCandidateStatusUpdate {
|
||||
status: RequestCandidateStatus::Failed,
|
||||
@@ -802,6 +816,21 @@ mod tests {
|
||||
assert_eq!(record.retry_index, 2);
|
||||
assert_eq!(record.user_id.as_deref(), Some("user-1"));
|
||||
assert_eq!(record.status, RequestCandidateStatus::Failed);
|
||||
assert_eq!(record.created_at_unix_ms, Some(100));
|
||||
assert_eq!(
|
||||
record
|
||||
.extra_data
|
||||
.as_ref()
|
||||
.and_then(|value| value.get("provider_api_format")),
|
||||
Some(&json!("openai:cli"))
|
||||
);
|
||||
assert_eq!(
|
||||
record
|
||||
.extra_data
|
||||
.as_ref()
|
||||
.and_then(|value| value.get("mapped_model")),
|
||||
Some(&json!("gpt-5-upstream"))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user