From b35dc36e274712c1251454fa4031b44b4fa29e07 Mon Sep 17 00:00:00 2001 From: argszero Date: Mon, 9 Nov 2026 17:06:41 +0800 Subject: [PATCH] chore(release): v0.7.34 Twenty-eight commits since v0.7.33, and most of them change what a request costs: the seven money fixes filed as #437 all ship here, plus cache-write billing end to end, GitHub sign-in, four international vendors and the current-generation models. schema 16 -> 18 across two idempotent migrations. cargo test 605/0, fmt and clippy clean. --- CHANGELOG.md | 32 ++++++++++++++++++++++++++++++-- Cargo.lock | 2 +- Cargo.toml | 2 +- Dockerfile | 6 +++--- docker-compose.yml | 4 ++-- 5 files changed, 37 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f04b75a..411e125 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,37 @@ All notable changes are recorded here. Versions follow [SemVer](https://semver.org/). -## Unreleased +## v0.7.34 (2026-11-09) -**schema 17 → 18**;新增可选 `[github]` 段(`client_id` / `client_secret`,留空 = 未启用,端点答 503「未启用」而非 500);**GitHub 登录**(设备码流程 + 网页登录页「使用 GitHub 登录」+ 身份即账号,rant 2026-11-09T14:43:55);`cargo test` 590 → 605。 +自 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**。 + +### 计费与定价(#437 的七项,全部在本版) + +- **周末与配置的节假日不再按高峰价计费(#412,`ada9043`)** — `is_peak_hour` 对周末直接判空闲,并新增可缺省的 `[billing] holidays` 表(空表=只豁免周末;畸形日期启动即报错)⇒ 原来是**多收**。 +- **四家目录价改对,补上 grok-4.7 / qwen3.8-flash(#413,`eadfb9f`)** — 其中一条缓存命中价原本被写成 `0`。 +- **按输入长度选档,而不是一律按第一档结算(#417,`544cf86`)** — 长输入原被按最低档结算 ⇒ **少收**。 +- **缓存写入(cache-creation)token 入账(#433,`357ab01`)** — 原来按 0 计,平台自己吸收那部分成本。 +- **管理端模型编辑器接受 `cache_write_input_per_m`(#434,`41ca047`)** — 否则运维连「选择开启」都做不到。 +- **Anthropic 流式不再把缓存命中量从 `input_tokens` 里减掉(#436,`a49f130`)** — 未命中的输入段因此被算成 0,缓存占比越高差得越多。 +- **`config.toml` 可以表达分档价与缓存写入价(#416,`496a723`)** — 此前这两个字段在配置里**根本没有位置**。 +- **#442(`405f078`)** 用端到端测试把「缓存写入 token 真的走到账本」钉住:两处缝各一条测试,变异后必红。 + +### 登录 + +- **支持 GitHub 登录注册,桌面端一次拿到 API Key(#443,`149297b`)** — 两条流程共用一个身份落库函数:无浏览器回调的客户端走**设备码**(`POST /api/auth/github/device/code` → `device/token`,中间态 202/429/410/403,pending 绝不发 key),网页登录页加「**使用 GitHub 登录**」走**授权码**(`GET /api/auth/github/authorize` → `POST /api/auth/github/exchange`,state 绑 HttpOnly cookie,不匹配答 400 且不打上游、不落库)。身份只认 GitHub 的**稳定数字 `id`**(`login` 可改名,认它会开第二个账号);已有 key 复用,成功响应与邮箱登录逐字同形(`api_key` + `user_id`)。**注册即已验证**:不走邮箱验证码、不依赖邮箱。配置项只有两个(`[github] client_id` / `client_secret`),留空答 **503「未启用」**而不是 500。`users` 增 `github_id` / `github_login`,`github_id` 上一条**部分唯一索引排除空串** ⇒ 纯邮箱账号不受影响。 + +### 目录与配置 + +- **四家国际厂商可在上架表单里选(#414,`983111c`)** — OpenAI / Anthropic / Google / xAI 各带一个按量 plan,上架集合 6 厂商 12 plan → **10 厂商 16 plan**。 +- **补上当季模型(#415,`b7d19ea`)**。 +- **`config.toml` 里拼错或不认识的键直接报错(#439,`db0160f`)** — 此前静默忽略,配置写了等于没写。 +- **模型编辑不跨重启存活这件事被明说,且每次覆盖都记日志(#441,`a6588f8`)** — 设置页/编辑器与 `config.toml` 的关系不再靠猜。 + +### 文档 + +- **十五条文档提交(#411、#418–#431)** 把散文与实际代码对齐:档位计费口径、密钥选择顺序、认证端点名册与各自真实动词、SMTP 重试次数、UI 实际有几个视图、运营充值能力、上架密钥可编辑等。这一批的共同点是:**断言写在散文里,而代码已经走在前面**。 + +`cargo test` **605/0**(v0.7.33 为 590);`cargo fmt --check` 与 `cargo clippy --all-targets -- -D warnings` 干净;UI 资产令牌随改动词表的提交一并更新(`app.js?v=20261109-1`、`i18n.js?v=20261109-1`)。 ## v0.7.33 (2026-10-15) diff --git a/Cargo.lock b/Cargo.lock index 5d888ed..6a5cf4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -51,7 +51,7 @@ dependencies = [ [[package]] name = "aitokenpool" -version = "0.7.33" +version = "0.7.34" dependencies = [ "aes-gcm", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index aff1e6d..7ac3254 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aitokenpool" -version = "0.7.33" +version = "0.7.34" edition = "2021" description = "AI Token 共享池 — 企业 key 池 + 公共共享市场" license = "MIT" diff --git a/Dockerfile b/Dockerfile index ba9e84e..c697fe9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ -# AITokenPool — multi-stage release image (v0.7.33) +# AITokenPool — multi-stage release image (v0.7.34) # -# Build: docker build -t aitokenpool:0.7.33 . +# Build: docker build -t aitokenpool:0.7.34 . # Run: docker run -p 8080:8080 -v "$PWD/atp-data:/data" \ # -e ATP_MASTER_KEY="$(openssl rand -hex 32)" \ -# aitokenpool:0.7.33 +# aitokenpool:0.7.34 # # Notes: # - unified data dir (rant 2026-08-19T20:53:23): ATP_DATA_DIR=/data holds diff --git a/docker-compose.yml b/docker-compose.yml index 5c158b9..6834a2a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -# AITokenPool — Docker Compose 一键部署(v0.7.33) +# AITokenPool — Docker Compose 一键部署(v0.7.34) # # 快速开始: # export ATP_MASTER_KEY=$(openssl rand -hex 32) # 必填,见下方说明 @@ -16,7 +16,7 @@ services: aitokenpool: build: . - image: aitokenpool:0.7.33 + image: aitokenpool:0.7.34 ports: - "8080:8080" volumes: