Commit Graph
92 Commits
Author SHA1 Message Date
SmartUp Developer 5e99abcbc5 feat: 财务对账页面 — GET /api/finance/daily-summary + Finance.vue 2026-07-03 15:28:06 +08:00
SmartUp Developer 9997b9d56a fix: restore api_key from local key_value when syncing upstream models for apikey accounts 2026-07-02 23:38:57 +08:00
SmartUp Developer a0c96ed5da fix: close platform-check silent-success loophole — raise WebsiteError on None list, missing account, or stale platform after update 2026-07-02 23:28:28 +08:00
SmartUp Developer 2c976f4d48 fix: add active check post account platform update to prevent silent ignore by remote backend 2026-07-02 23:06:38 +08:00
SmartUp Developer 445f33a6b0 style: remove temporary probe and fix scripts from repository 2026-07-02 23:01:09 +08:00
SmartUp Developer fd2755d539 feat: resolve account platforms prioritizing structural snapshot values and correction on existing accounts 2026-07-02 22:58:15 +08:00
SmartUp Developer 1cb13e878e style: remove trailing whitespace in website_sync.py 2026-07-02 21:45:02 +08:00
SmartUp Developer fdbcca4d95 fix: delay binding.percent update until remote sync succeeds and update UI labels to 自动保底盈利 2026-07-02 21:27:52 +08:00
SmartUp Developer 0e77de31ae feat: implement automatic margin pricing and margin reverse engineering in sync 2026-07-02 21:22:37 +08:00
SmartUp Developer 9011c68b9d fix: use equal weight sharing for remaining 15% and quantize min_rate floor comparison to 2 decimal places 2026-07-02 20:45:40 +08:00
SmartUp Developer 8746068cd4 feat: implement priority_weighted_plus_percent pricing algorithm 2026-07-02 20:23:20 +08:00
SmartUp Developer d07ab62772 test: fix trailing whitespaces and add symmetric compact_model_mapping assertions 2026-07-02 19:48:47 +08:00
SmartUp Developer c20c9cfd26 fix: add stream close check, recover regression test assertions, and secure credentials type check 2026-07-02 19:18:10 +08:00
SmartUp Developer ece11d66e6 feat: sync upstream models with real-time streaming updates 2026-07-02 18:11:55 +08:00
liumangmang 852bf84246 fix: 优化同步上游模型,过滤克隆载荷中的敏感 credentials 字段,规避重写导致脱敏密钥丢失/清空的事故风险 2026-07-02 17:05:44 +08:00
liumangmang 316ef24188 fix: 优化同步上游模型的写回载荷,克隆并保留远端返回的所有非敏感 credentials,避免丢失 compact_model_mapping 等其它配置 2026-07-02 17:02:37 +08:00
liumangmang 4645460ff9 fix: 一键同步模型接口同步修复并携带上游 base_url,防止 sub2api 账号 base_url 被清空或置为默认值 2026-07-02 16:56:45 +08:00
SmartUp Developer 59be00bd11 chore: remove obsolete wangwang888 endpoint script 2026-07-02 16:09:35 +08:00
liumangmang 3c1fff2491 fix: 优化上游模型同步的写回逻辑,采用增量 JSONB merge,避免脱敏的 credentials 覆盖或丢失原有敏感字段 2026-07-02 15:47:34 +08:00
liumangmang 63cbdf4dca feat: 实现一键同步网站账号上游模型功能 2026-07-02 15:43:00 +08:00
SmartUp Developer c70b68d814 refactor: clean up unused variables in external api logs router 2026-07-02 15:17:05 +08:00
SmartUp Developer ea3fd64686 fix: optimize summary count query and refine row keys for external api logs 2026-07-02 15:07:32 +08:00
SmartUp Developer e2129d3796 fix: 防止分页漏读和上游异常快照误标 orphaned 2026-07-02 14:21:09 +08:00
SmartUp Developer 00af34c487 fix: Sub2ApiWebsiteClient.list_accounts 支持分页拉取,避免只拿到默认第一页 20 条导致误建重复账号 2026-07-02 11:04:46 +08:00
SmartUp Developer fe3f9f4a4c feat: 一键整理强制对齐分组逻辑,移除旧托管分组并优化统计消息区分 2026-07-02 10:42:18 +08:00
liumangmang c797aff773 fix: 修正设置并发数无候选时的文案拼写错误 2026-07-02 10:08:30 +08:00
liumangmang 274413bca7 fix: 优化并发数批量设置接口,引入 c.close() 资源管理并增加对 list_accounts() 返回 None 的拦截保护 2026-07-02 10:02:07 +08:00
liumangmang 608ef00920 feat: 实现设置账号并发数功能(支持 bulk-update 与 fallback 逐个更新) 2026-07-02 09:48:59 +08:00
SmartUp DeveloperandClaude Sonnet 4.6 a296525d4e fix: 将 refresh_path 加入 login_password auth_config 白名单
自定义 refresh 路径会被 normalize_auth_config 丢弃,导致只有默认
/auth/refresh 生效。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-02 09:34:53 +08:00
SmartUp DeveloperandClaude Sonnet 4.6 c96d55665d feat: 优化上游认证复用与 wangwang888 分组接口
## 上游认证优化

### 核心改进
- login_password 类型上游优先复用已保存 token,过期后自动 refresh,失败再重新登录
- 新增 ensure_authenticated() 方法替代直接调用 login(),减少不必要的登录请求
- 初始化时从 auth_config 自动加载已保存的 token 和 user_id
- 请求遇到 401 时自动尝试 refresh 或 login 并重试一次

### 实现细节
- UpstreamClient.__init__: 初始化时加载 auth_config 中的 token/new_api_user
- _is_login_password_with_refresh(): 判断是否支持 refresh
- _token_is_expired(): 检查 token 是否过期(提前 60 秒)
- _refresh_login_password_token(): 刷新 login_password 类型的 token
- ensure_authenticated(): 优先复用 token,过期后 refresh,失败再 login
- _send_request(): 401 时针对 login_password 类型先 refresh 再 login 并重试

### 调用点更新
- scheduler.py: _check_upstream, _sync_upstream_keys
- website_sync.py: reconcile_upstream_keys_full
- upstreams.py: list_generated_keys, generate_keys_by_groups, test_all, check_now

## wangwang888 分组接口优化

- 提供数据库更新脚本 update_wangwang888_groups_endpoint.py
- 将 wangwang888 的 groups_endpoint 从 /groups 改为 /groups/all
- 减少不必要的 /api/v1/admin/groups 统计开销
- website_client 已有 fallback 逻辑保证兼容性

## 测试
- 新增 test_upstream_login_password_refresh.py(7 个测试用例)
- 验证 token 复用、refresh、401 重试等逻辑
- 更新 test_upstream_key_sync.py 的 FakeClient 增加 ensure_authenticated
- 所有现有测试保持通过(87 passed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-02 09:26:19 +08:00
liumangmang 9c9a4b3423 fix: 对齐 test_account 在 404 响应下的日志成功标志及错误类型口径,与标准接口行为一致 2026-07-02 00:28:34 +08:00
liumangmang 3b23f21ef3 fix: 优化清理失效账号执行响应的 success 标志,对 test_account/delete_account 引入外部 API 日志审计,并对账号 ID 进行安全转义 2026-07-02 00:25:24 +08:00
liumangmang 536c0aa3d4 feat: 实现清理失效账号安全方案(包含预览、SSE测试、安全删除以及本地标记清空) 2026-07-02 00:19:26 +08:00
liumangmang 1ef6188c02 fix: 修正 websites router 中错误的 website.accounts_endpoint 属性调用为默认值,并增加对已存在账号名称回显与默认端点引用的单元测试 2026-07-01 21:15:55 +08:00
liumangmang 94d9550f77 feat: 调整新建/重建账号命名格式为 {上游网站名}-{上游分组名/ID}-{KeyID} 2026-07-01 21:11:37 +08:00
liumangmang 7ae9ad9292 fix: 删除 routers/websites 中残留的死代码函数 _build_rate_priority_map,并为 build_target_group_priority_map 引入严格的分组倍率解析,防止非法/缺失倍率的分组以 1.0 的降级值参与排序 2026-07-01 20:26:23 +08:00
liumangmang dd3649a6ad feat: 修正优先级自动计算算法为分目标分组独立排序,并优化一键分组整理完成后仅触发一次网站级优先级重排 2026-07-01 20:19:54 +08:00
liumangmang fd46492012 test: 补充基于 TestClient 的路由级集成测试,锁死并验证 group_id 包含斜杠时的路径转换器匹配行为 2026-07-01 18:02:10 +08:00
liumangmang ef14382e5f fix: 后端路由 group_id 启用 path 路径匹配转换器,完美兼容带斜杠的远端分组 ID 2026-07-01 17:58:56 +08:00
liumangmang 3172ab18bf fix: 修改目标分组名称后自动同步更新本地绑定表中的名称缓存,并为前端更新分组 URL 中的 groupId 进行 Url 编码 2026-07-01 17:55:53 +08:00
liumangmang 8c2f1c13bb feat: 支持网站目标分组轻量管理(新增、编辑、描述展示),不修改和不提交倍率 2026-07-01 17:47:36 +08:00
liumangmang 8abfa4c5ef feat: 重构接口日志页面与接口监控看板,支持HTTP方法过滤和实时轮询 2026-07-01 15:04:32 +08:00
liumangmang 397a14c978 feat(website): 支持基于现有绑定一键整理分组,支持账号校验补齐、自愈重建与缺失 Key 提示 (含异常保守跳过及名称层级匹配) 2026-07-01 11:21:20 +08:00
liumangmang bf5470caf3 fix(sync): 优先级同步前置过滤远端失效账号防排序污染,移除 locals 隐患,并将自愈结果纳入本地日志与摘要统计 2026-07-01 10:20:13 +08:00
liumangmang efd0a88249 perf(import): 优化账号导入弹窗为秒开体验并支持批量回查校验 2026-07-01 10:00:40 +08:00
liumangmang d92537688a fix(priority): keep readable priority sync details 2026-07-01 09:12:39 +08:00
liumangmang fe40fcd4c9 feat(priority): group priority changed notifications by target group and fetch remote account details 2026-07-01 09:00:29 +08:00
liumangmang 6065e824e3 fix(upstreams): add db.rollback() on exception to prevent dirty replaced status leak 2026-06-30 17:33:43 +08:00
liumangmang edc00444dc fix(nox-api): address duplicate creation risks, pending upgrading issues, cache warm error handling, test speedups, and frontend display support for pending keys 2026-06-30 17:25:18 +08:00
liumangmang 4fa6a79c5a feat(nox-api): implement batch creation rate limit resilience and pending backfilling 2026-06-30 17:00:26 +08:00