Commit Graph
100 Commits
Author SHA1 Message Date
fawney19 627eb4f335 Merge pull request #371 from Kayphoon/feature/embedding-model-support
feat: add embedding and rerank support
2026-05-04 12:56:11 +08:00
fawney19 8dd4135f7c Fix provider key insert placeholder order 2026-05-04 12:21:54 +08:00
fawney19 099653f732 Cap Codex pool cooldowns and add key circuit breaker 2026-05-04 02:15:32 +08:00
fawney19 1d62722d47 Improve Codex model fetching 2026-05-04 01:16:56 +08:00
fawney19 fb642f7d62 feat: improve OAuth provider configuration 2026-05-04 00:18:05 +08:00
fawney19 cb5b8ee1ee Use Rust build metadata for system version 2026-05-03 22:06:16 +08:00
fawney19 b4a8c5dde2 Format execution runtime transport imports 2026-05-03 21:52:15 +08:00
fawney19 53a5e18b20 Merge pull request #370 from yao177/aether-rust-pioneer
fix(proxy): record manual proxy node traffic
2026-05-03 21:40:20 +08:00
fawney19 6f00cabe96 Lazy load requested model candidates 2026-05-03 20:56:31 +08:00
fawney19 a24e4a793d Refactor pool candidate scheduling 2026-05-03 20:14:29 +08:00
fawney19 8ebee9922c fix: return auth mismatch key setting in provider key list 2026-05-03 20:11:49 +08:00
fawney19 c4ea042eb4 feat: add model directive management 2026-05-03 14:48:25 +08:00
fawney19 11c5884d4f Remove API format rate multiplier field 2026-05-03 00:55:59 +08:00
fawney19 e3ea2d1451 feat: configure auth channel mismatch formats 2026-05-03 00:49:22 +08:00
fawney19 3a770306cc refactor: separate request auth channel from route kind
Extract request_auth_channel as a distinct routing dimension to distinguish
between api_key and bearer_like authentication methods. This improves routing
clarity by decoupling authentication mechanism from route classification.
2026-05-02 21:23:33 +08:00
fawney19 47ee8b9c13 refactor: fold ai surfaces into formats 2026-05-02 18:19:39 +08:00
fawney19 c130d0e2c9 refactor ai serving modules and crates 2026-05-02 13:23:54 +08:00
fawney19 4fc7cecf30 Fix OAuth token import and table filters 2026-05-01 02:14:49 +08:00
fawney19 9570e5c2c1 Fix legacy Claude and Gemini auth migration 2026-04-30 18:01:58 +08:00
fawney19 33aa70c22b fix scheduler affinity candidate selection 2026-04-30 16:27:24 +08:00
fawney19 558abfcfa3 Route request origin through ai pipeline facade 2026-04-30 12:15:51 +08:00
fawney19andRWDai 7fcb9e6292 feat(usage): record request origin metadata (#362)
Record client IP and User-Agent in usage request_metadata for local execution requests without adding schema, API, or table fields.

References #357 and supersedes #358.

Co-authored-by: RWDai <27391645+RWDai@users.noreply.github.com>
2026-04-30 11:26:56 +08:00
fawney19 fa47e8a3c0 feat: add select all to access limit dropdowns 2026-04-30 00:45:53 +08:00
fawney19 9e2faa7e5b Tighten local auth allow-list matching 2026-04-30 00:26:33 +08:00
fawney19 37392d8774 fix(ai): allow null OpenAI Responses error fields 2026-04-29 21:12:14 +08:00
fawney19 a16550249b fix: allow empty provider secrets to attempt requests 2026-04-29 18:55:52 +08:00
fawney19 d6de917878 Fix key API format auth help 2026-04-29 17:35:16 +08:00
fawney19 e751289dfb Support per-format provider key auth 2026-04-29 15:46:50 +08:00
fawney19 07a319259b Normalize canonical API formats 2026-04-29 10:20:41 +08:00
fawney19 02ad67fe33 fix(test): update openai format identifier from cli to responses 2026-04-28 21:04:38 +08:00
fawney19 a9b809a32c chore(proxy): bump version to 0.3.3 2026-04-28 19:57:29 +08:00
fawney19 230e7d6259 Normalize management token prefixes 2026-04-28 19:46:38 +08:00
fawney19 3d20c05ef7 Fix OAuth refresh through tunnel proxy 2026-04-28 19:45:34 +08:00
fawney19 9194f78e56 OAuth refresh 隧道代理统一启用 follow-redirects 2026-04-28 17:47:28 +08:00
fawney19 70f747d406 Add shared OAuth flows 2026-04-28 15:46:21 +08:00
fawney19 0c9b5ddd77 Fix usage terminal state regression 2026-04-28 10:31:16 +08:00
fawney19 3f1abb6906 Format OAuth refresh consistency changes 2026-04-28 09:54:35 +08:00
fawney19 29fc0be121 Tighten OAuth refresh consistency 2026-04-28 09:36:42 +08:00
fawney19 321f21ad49 Fix provider OAuth refresh token reuse 2026-04-28 02:00:35 +08:00
fawney19 639f26ed5d fix: force http1 for tunnel oauth refresh 2026-04-28 01:37:40 +08:00
fawney19 032dcf40e7 fix: filter candidate rows to resolved global model name only 2026-04-28 01:12:27 +08:00
fawney19 9a67497d8c fix: align oauth tunnel refresh transport 2026-04-28 01:10:34 +08:00
fawney19 6426b5d80e chore: add oauth refresh diagnostics 2026-04-28 00:18:51 +08:00
fawney19 83e1f99ccf fix: invalidate oauth transport cache after refresh 2026-04-27 23:35:05 +08:00
fawney19 05b8b8a442 fix: bypass oauth cache for forced refresh 2026-04-27 23:04:31 +08:00
fawney19 ed17147281 fix: align provider oauth refresh redirects 2026-04-27 22:08:02 +08:00
fawney19 a7a3c9f023 Fix OAuth import proxy handling 2026-04-27 20:05:43 +08:00
fawney19 4c16b11cb4 Align runtime miss tests with skipped candidates 2026-04-27 18:09:56 +08:00
fawney19 17f09fc8c1 Expose ranking metadata in request trace 2026-04-27 17:24:32 +08:00
fawney19 3e0293ac28 Rename local candidate resolution entrypoints 2026-04-27 17:24:32 +08:00
fawney19 07fba70a90 Guard pool scheduler ranking boundary 2026-04-27 17:24:32 +08:00
fawney19 da0e968975 Update transport ranking architecture guard 2026-04-27 17:24:32 +08:00
fawney19 98e4e91a98 Rename transport ordering facts 2026-04-27 17:24:32 +08:00
fawney19 218e73e324 Use core affinity helpers directly 2026-04-27 17:24:32 +08:00
fawney19 51c3beb614 Narrow core ranking public surface 2026-04-27 17:24:32 +08:00
fawney19 9da47ceb22 Remove duplicate capability candidate sorting 2026-04-27 17:24:32 +08:00
fawney19 e9f03d8d29 Remove ranked minimal selection compatibility helper 2026-04-27 17:24:32 +08:00
fawney19 e5e09b49f4 Remove ranked candidate data read wrappers 2026-04-27 17:24:32 +08:00
fawney19 dda6f34a07 Rename ranked minimal candidate reads 2026-04-27 17:24:32 +08:00
fawney19 44930532dc Align ranked candidate selection test names 2026-04-27 17:24:32 +08:00
fawney19 f10f5f071d Clarify ranked minimal candidate selection 2026-04-27 17:24:32 +08:00
fawney19 517e84e5ae Move local ranking test helper into tests 2026-04-27 17:24:31 +08:00
fawney19 2101a4ecc7 Drop legacy candidate ordering helpers 2026-04-27 17:24:31 +08:00
fawney19 8d2cbf32df Remove legacy tunnel-only candidate ordering 2026-04-27 17:24:31 +08:00
fawney19 a23758808d Isolate core candidate selection helpers 2026-04-27 17:24:31 +08:00
fawney19 91db4eefd0 Persist ranking metadata through request traces 2026-04-27 17:24:31 +08:00
fawney19 f52220a8ec Clean up planner candidate modules 2026-04-27 17:24:31 +08:00
fawney19 1d23bf4ecb Isolate standalone key wallet handling 2026-04-27 17:24:31 +08:00
fawney19 3b542434a2 Unify candidate ranking pipeline 2026-04-27 17:24:31 +08:00
fawney19 488bd08f04 Stabilize Kiro Claude CLI sync tests 2026-04-27 00:45:48 +08:00
fawney19 3991d47166 Fix format checks and local error messages 2026-04-27 00:27:03 +08:00
fawney19 0c73f245ab shrink formats conversion to compatibility facades 2026-04-26 23:59:53 +08:00
fawney19 989b27426b refactor formats adapters and matrix ownership 2026-04-26 23:59:53 +08:00
fawney19 c10cd8240e refactor ai formats registry adapters 2026-04-26 23:59:53 +08:00
fawney19 5cd2244bc2 fix frontend openai responses alias display 2026-04-26 23:59:53 +08:00
fawney19 0ec4b4c8a4 guard legacy openai alias compatibility 2026-04-26 23:59:53 +08:00
fawney19 4ec591fbf2 centralize openai responses alias handling 2026-04-26 23:59:53 +08:00
fawney19 ea3dc3257e clean up legacy openai cli adapter names 2026-04-26 23:59:53 +08:00
fawney19 5b914aa78c migrate ai format conversion to responses adapters 2026-04-26 23:59:53 +08:00
fawney19 baa0ddd787 Improve runtime miss usage diagnostics 2026-04-26 01:44:54 +08:00
fawney19 1d3ea3232d Add unified candidate failure diagnostics 2026-04-26 01:38:37 +08:00
fawney19 429fdb47e6 fix(usage): 简化本地执行错误提示 2026-04-25 20:46:22 +08:00
fawney19 912a92cd1a refactor(rules): 规则引擎容错优化,无效规则条目跳过而非中止整个规则集
- header/body rules 的 _are_locally_supported 简化为仅检查是否为数组
- apply 逻辑中遇到格式错误/不支持的规则条目改为 continue 跳过,而非 return false
- 允许非字符串 header value,自动序列化为 JSON 字符串
- 宽松处理无效 regex flag,不再拒绝整条规则

fix(gateway): Claude CLI 路由仅检查 bearer 头,不排斥同时携带 x-api-key 的请求

feat(observability): 监控链路候选展示解密 auth_config 的账号标签和 OAuth 计划类型
2026-04-25 19:46:52 +08:00
fawney19 00744c0ce5 feat(observability): 引入错误链路 error_flow 元数据并区分上游/客户端错误
- 网关在本地 failover 时构建 error_flow 元数据(分类/决策/传播策略),写入 report_context
- scheduler-core 解析并透传 error_flow 至候选 extra_data
- admin usage 详情拆分 request/upstream/client/failure_summary 错误域,敏感上游错误标记为 suppressed
- 前端 RequestDetailDrawer 拆出"返回客户端"与"上游响应"双错误卡片
- HorizontalRequestTimeline 节点详情展示真实请求错误及 error_flow 标签
2026-04-25 17:01:07 +08:00
fawney19 cef7dcac71 refactor(usage): 抽取 JsonContentPanel 通用 JSON 展示组件
请求详情抽屉与时间线统一复用工具栏(展开/收缩、复制)和 JSON 视图,时间线的额外信息也由 pre 改为可交互面板
2026-04-25 11:44:01 +08:00
fawney19 61e12e2c17 feat(scheduler): candidate report 携带 header_rules 与 body_rules
各 planner 在构造 report context 时附带端点的 header/body 改写规则,scheduler 解析后写入 candidate extra_data,便于追踪请求实际应用的透传规则
2026-04-25 11:43:53 +08:00
fawney19 65e915fd1d refactor(api-keys): 网关 API Key 改为 32 位字母数字随机串
由 UUID 拼接(48 位 hex)改为 base62 字母数字,缩短长度并提升可读性
2026-04-25 10:04:04 +08:00
fawney19 1761921670 fix(usage): 移动端缓存 token 拆分为读/写两列展示
cache_read 与 cache_creation 原本被合并为单值,现分别显示并补充测试
2026-04-25 09:53:32 +08:00
fawney19 e5bbc797e0 chore(gateway): 调小 Postgres 连接池默认值
- max_connections 100 → 20
- idle_timeout 60s → 30s
- .env.example 补充连接池相关变量注释
2026-04-25 09:53:21 +08:00
fawney19 f30b1f3f6b fix(usage): 流式终端 usage 以更完整值为准,Codex CLI 显式选择 response 解析器
- 新增 StandardizedUsage::signal_score/is_more_complete_than/choose_more_complete,流式合并与终端落库均按信号完整度择优
- OpenAI Chat/CLI 解析器支持仅 usage 的终结 chunk 与 response.completed usage
- Codex provider 注入 provider_stream_event_api_format=openai:cli,解析器选择改由 report_context 显式决定
- usage_mapper 扩展嵌套 response/message/item 兼容 Claude message_start/message_delta 及 Gemini stream chunks
- usage SQL upsert 在终态(completed/failed/cancelled)时按 GREATEST 写入 token/费用镜像列
2026-04-25 00:57:01 +08:00
fawney19 2c6209277f fix(usage): Claude 流式合并 message_start/delta usage,前端移动端缓存 token 合并展示
- Claude provider state 在 message_start 记录基础 usage,message_delta 合并 output_tokens
- 前端 UsageRecordsTable 移动端缓存列改为 cache_creation + cache_read 合计展示
2026-04-24 22:28:04 +08:00
fawney19 5b3593038d fix(usage): OpenAI 缺失 input_tokens 时从 total 回推
- 同步与流式两条路径均在 input_tokens 为 0 且 total > output 时用 total - output 兜底
- 补充对应单元测试
2026-04-24 22:08:23 +08:00
fawney19 db1059e73b fix(usage): 修复 Gemini total 重复累加 cache_read 并补充测试
- write.rs: Gemini usage 提取 total 时不再叠加 cachedContentTokenCount
- 补充 Claude 大 cache_read 场景下 input_tokens 不被扣减的测试
- 补充前端 getEffectiveInputTokens 对 Claude 格式不减 cache_read 的测试
2026-04-24 21:20:45 +08:00
fawney19 e265475c17 fix(usage): 修正 input_tokens 统计与显示
- SQL 查询不再用 settlement snapshot 的 billing_input_tokens 覆盖原始 input_tokens
- usage_mapper 针对 OpenAI 格式在 input_tokens 缺失时从 total_tokens - output_tokens 推导
- 前端轮询合并优先采用最新 record 的 input_tokens / effective_input_tokens
2026-04-24 20:59:12 +08:00
fawney19 657fcd595c refactor(rust): 拆分 usage sql 仓储为模块并外置 SQL 文件
- 将 usage/sql.rs 拆分为 sql/mod.rs 与 sql/tests.rs
- 将内联 SQL 抽离到 sql/queries/ 目录下的独立 .sql 文件
- 前端用量记录表格移除缓存创建 token 展示,保留 cache read 列
2026-04-24 20:22:24 +08:00
fawney19 d0d71aa51a fix(gateway): OpenAI 图像 finalize 统一返回 b64_json 并对齐 codex CLI 候选流式上游
- finalize 移除 response_format=url 的 data URL 分支,统一输出 b64_json
- image planner decision 依据请求体中的 stream 字段决定 upstream_is_stream
- openai chat sync plan 对 codex+openai:cli 候选强制上游流式
- 扩充 conversion registry 与 standard matrix 的全量 surface 对端测试
2026-04-24 19:01:11 +08:00
fawney19 3cc54deb9c fix(gateway): SSE 流跳过成功探测与 prefetch,统计聚合 SQL 显式 CAST BIGINT
- stream: event-stream 响应跳过 direct finalize prefetch 与成功失败转移探测,避免消费流首帧
- stream_pump: 仅在已知 content-length 时缓冲非 SSE 响应
- maintenance: usage_billing_facts 聚合列显式 CAST 为 BIGINT,避免类型不匹配
2026-04-24 18:14:59 +08:00
fawney19 f695238e8a feat(billing): 引入 billing v3 settlement snapshot 及 usage_billing_facts 视图
- 新增迁移 20260424000000:为 usage_settlement_snapshots 添加 settlement_snapshot、
  billing_dimensions、billing_input/output/cache tokens、billing_total_cost_usd 等列,
  并创建 usage_billing_facts 视图(从 settlement snapshot 覆盖原始 usage token/cost 字段)
- event_enrichment:构建结构化 settlement_snapshot(含 pricing_snapshot、billing_plan_snapshot、
  resolved_dimensions、cost_breakdown 等),写入 request_metadata
- pricing:新增 pricing_source() 方法区分 provider_override / global_default / unpriced
- sql.rs:settlement snapshot 写入新列;用量汇总查询改用 usage_billing_facts 视图
- maintenance/runtime:所有统计查询的 FROM usage 替换为 FROM usage_billing_facts
- admin observability:在 settlement 响应中暴露 settlement_snapshot / billing_dimensions,
  并从 metadata 中剥离对应字段
- request_metadata:允许 settlement_snapshot / billing_dimensions 字段传播
- stream execution:在首个数据帧到达时记录 TTFB,补全流式请求的 streaming 事件
2026-04-24 17:52:33 +08:00
fawney19 e0c928fbe8 feat(auth): /me 接口返回 has_password 字段,前端 Profile 类型同步调整 2026-04-24 14:52:49 +08:00
fawney19 780f09c1a2 feat(billing): 引入 model_id 精确计费查找路径,传播模型 ID 至用量事件与 report context
- UsageEventData 新增 model_id / global_model_id 字段,write.rs seed 结构体同步补充
- report_context 新增 model_id / global_model_id / global_model_name,各 payload 构建时从 candidate 传入
- event_enrichment 优先按 model_id 精确查找计费上下文,回退为按名称多轮查找(保留 NoRule 结果降级逻辑)
- BillingReadRepository 新增 find_model_context_by_model_id,memory/sql 分别实现;SQL 查询重构支持按 provider_model_name 和 mappings 匹配并按优先级排序
- pricing.rs 修复:model_tiered_pricing 为空 tiers 时回退到 default_tiered_pricing
- request_metadata 允许字段列表补充 model_id / global_model_id / global_model_name
- admin usage 路由信息输出及脱敏字段列表同步新增三个 model 相关字段
2026-04-24 14:40:28 +08:00