Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes are recorded here. Versions follow [SemVer](https://semver.org/).

## v0.7.35 (2026-11-12)

自 v0.7.34 起累计 2 个提交(#445–#446)。**无 schema 变更(仍 18)**。这一版补上两处「数据都在,就是看不见」的缺口:API Key 只能一撤到底、交易页看不出哪把 key 花了多少。

- **API Key 可以暂停与恢复(#445,`59bb0c6`)** — `api_keys.status` 此前只有两个写入值:建/取时硬写 `active`、软删写 `revoked`,而设置页列表的查询带 `AND status = 'active'` ⇒ 状态列永远只印「启用」,那条「非 active → 灰药丸」的分支不可达。撤销又是不可逆的,撤销后该行连列表都不再出现,用户既看不见也开不回来。本版新增 `paused`:`PATCH /api/api-keys/:id` 接受 `status: active | paused`(取值集合与非法值 400 的文案从一处派生),列表改列 `active + paused`(`revoked` 仍不列),**鉴权仍只认 `active`** —— 暂停即拒绝服务,正是要的语义。⚠️ 一处刻意的不对称:**正被当作会话凭据的那把 key 不许暂停自己**。分发 key 与会话凭据共用同一个查询(`find_api_key_user_and_id`),暂停自己会 401 → 重新登录 → `get_or_create_api_key` 另发一把 active 的新 key,那次暂停什么也没停住;反过来若登录不再发新 key,用户就再也进不来。所以拒绝放在入口,`get_or_create_api_key` 一行没动。前端按当前 status 派生下一动作(三态映射,不是两值判别式 —— 否则「已撤销」会被报成「暂停」)。
- **交易页按 API Key 拆解汇总(#446,`411429e`)** — 页面顶部五张汇总卡只给一个总数,无论怎么筛选都看不出「哪把 key 花了多少」;明细表每行带 key 名,但那是**逐行**的,全仓唯一的按 key 聚合在共享页(算的是上架收益,不是消费用量)。本版在 `GET /api/transactions` 的响应里加一个 `by_key` 数组 —— **不另开端点**:分组必须与明细表同一套筛选(时间档、自定义起止、类型 tab、六个列筛选),并进同一响应才共用同一个 `where_sql` 与同一份绑定,「各组之和 == `summary`」于是是**结构上只有一份口径**,而不是两份参数对齐出来的。三条口径坑各有测试盯着:读 `tx_facts` 视图而非裸表(明细只留 `retain_minutes`)、分组键用**视图的** `api_key_id`(汇总表拿 `0` 当 NULL 哨兵)、条数是 `SUM(row_count)` 而非 `COUNT(*)`(后者数的是分钟桶)。没有 api-key 的交易(供应商侧 earn / topup / expire / withdraw)**显式成组并排在末行** —— 静默丢掉它正是会让各组之和与汇总卡对不上的那件事。key 名走标量子查询而非第四个 `LEFT JOIN`:`tx_joins()` 里任一 JOIN 出现,SQLite 就弃用覆盖索引,逐行回表(dev 库 18.6 万行实测 0.21s → 22.6s)。前端这张卡读同一份载荷,切筛选不发额外请求。

`cargo test` **605 → 614**。UI 资产令牌:`app.js` `?v=20261112-2`、`i18n.js` `?v=20261112-2`、`style.css` `?v=20261012-1`、`api.js` `?v=20261012-1`、`data.js` `?v=20261017-2`。

## v0.7.34 (2026-11-09)

自 v0.7.33 起累计 **28 个提交(#411–#443)**。**schema 16 → 18**(两跳:#417 升到 17、#443 升到 18,两者都是幂等迁移 `ensure_column`,老库原地升级)。**这一版主要是一版「账」** —— #437 记录的七项金额修复全部随本版落地:一个仍跑 v0.7.33 的部署,到今天为止都按任何一项修复之前的算法计费。此外新增 **GitHub 登录**(桌面端/CLI/agent 一次拿到 API Key),并补上四家国际厂商与当季模型。`cargo test` **605/0**。
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aitokenpool"
version = "0.7.34"
version = "0.7.35"
edition = "2021"
description = "AI Token 共享池 — 企业 key 池 + 公共共享市场"
license = "MIT"
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# AITokenPool — multi-stage release image (v0.7.34)
# AITokenPool — multi-stage release image (v0.7.35)
#
# Build: docker build -t aitokenpool:0.7.34 .
# Build: docker build -t aitokenpool:0.7.35 .
# Run: docker run -p 8080:8080 -v "$PWD/atp-data:/data" \
# -e ATP_MASTER_KEY="$(openssl rand -hex 32)" \
# aitokenpool:0.7.34
# aitokenpool:0.7.35
#
# Notes:
# - unified data dir (rant 2026-08-19T20:53:23): ATP_DATA_DIR=/data holds
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# AITokenPool — Docker Compose 一键部署(v0.7.34)
# AITokenPool — Docker Compose 一键部署(v0.7.35)
#
# 快速开始:
# export ATP_MASTER_KEY=$(openssl rand -hex 32) # 必填,见下方说明
Expand All @@ -16,7 +16,7 @@
services:
aitokenpool:
build: .
image: aitokenpool:0.7.34
image: aitokenpool:0.7.35
ports:
- "8080:8080"
volumes:
Expand Down
Loading