Commit Graph

962 Commits

Author SHA1 Message Date
boos eddf3eff4e fix(deps): declare url crate so digital_human compiles
digital_human.rs uses url::Url::parse but the crate was only a transitive
dependency, not declared in Cargo.toml, so the lib failed to compile with
E0433. Add the explicit dependency (url 2.x was already in Cargo.lock).
2026-06-22 09:37:18 +08:00
boos 4d093548de feat(proxy): wire Gemini native v1beta endpoints through the conductor
Implement the four Gemini native inbound endpoints so Gemini CLI / Google
GenAI SDKs can point their base URL at the gateway:

- GET  /v1beta/models — directory listing in Gemini shape, built from
  configured routes (like /v1/models); no upstream call, no billing.
- POST /v1beta/models/{model}:generateContent — non-streaming, routed
  through ProxyConductor with failover + usage_logs + billing.
- POST /v1beta/models/{model}:streamGenerateContent — SSE passthrough via
  open_stream_with_failover + sse_passthrough_response.
- POST /v1beta/models/{model}:countTokens — metadata call, routed for a
  channel but not billed.

Auth accepts the gateway key from ?key= or x-goog-api-key (Gemini
convention) and reuses the downstream-key authorization + limits.

Billing closes the loop: gemini_extract_usage reads usageMetadata
(promptTokenCount / candidatesTokenCount) for non-streaming, and
gemini_stream_usage_from_line feeds the shared StreamUsageAccumulator so
streamed usageMetadata is billed too.

Unit tests cover model:action parsing, usage extraction, the stream usage
parser, and query forwarding (key/alt dropped).
2026-06-22 08:39:38 +08:00
boos aaa593ac31 feat(proxy): add Gemini native upstream executors
Add Gemini-shaped upstream calls that mirror AQBot's native passthrough
and BoosAPI's /v1/responses forwarding: the model lives in the URL path
(/v1beta/models/{model}:{op}) and the key in ?key=, so the body is sent
verbatim with no model rewrite.

- gemini_base_url / gemini_operation_url normalize the v1beta root and
  build {base}/v1beta/models/{model}:{op}?key=...&{extra}, stripping a
  leading models/ prefix and handling the no-key case.
- execute_gemini_operation runs non-streaming ops (generateContent /
  countTokens) and returns upstream JSON verbatim.
- execute_gemini_stream_response opens streamGenerateContent for SSE
  passthrough, enforcing alt=sse via merge_alt_sse.

Unit tests cover URL building and alt=sse merging.
2026-06-22 08:39:26 +08:00
boos 24a8dec151 fix: define DEFAULT_NEW_USER_MAX_COST_USD and repair test AppConfig initializers
Pre-existing breakage on this branch (introduced by the billing commits),
unrelated to the Gemini work but blocking both `cargo build` and
`cargo test`:

- admin/users.rs imported routes::auth::DEFAULT_NEW_USER_MAX_COST_USD,
  which was never defined. Add it to auth.rs as $1.0 (the billing design's
  "new users default to $1" starter allowance).
- AppConfig gained `payment` and `pixelle_video` fields but several test
  helpers still used struct literals missing them. Initialize both with
  Default::default() at each affected test site.
2026-06-22 08:39:17 +08:00
boos 9078b8d41a feat(gateway): client integration templates endpoint
Add GET /api/cli-profiles/templates returning copy-ready config snippets
for pointing common AI clients at this gateway: Cursor, VS Code Continue,
Claude Code, and a generic OpenAI-compatible blob.

Ported from AQBot's list_gateway_templates (a desktop app that hardcodes
localhost:8080). Adapted for server-side use: the gateway origin is resolved
per request — ?base_url= override, then X-Forwarded-Proto + Host (correct
behind a TLS-terminating proxy), then config server.host:port fallback
(0.0.0.0/:: rewritten to 127.0.0.1, matching the comfyui-agent local-base
convention). OpenAI-compatible clients get the /v1 base; Claude Code gets
the bare origin since it appends /v1/messages itself.

Scope guard: this only returns config strings + copy hints. It deliberately
does not rewrite local CLI config files (AQBot's desktop cli_config behavior),
which has no meaning on a server.

New module proxy::cli_profiles::templates holds the snippet content; the admin
handler resolves the origin. Covered by 9 unit tests.
2026-06-22 06:31:14 +08:00
boos d548525ef2 refactor(workflow_ui): 抽出 bootstrap 子模块
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 22:52:59 +08:00
boos 3aa1468fbb refactor(workflow_ui): 抽出 ws 子模块
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 22:44:53 +08:00
boos f7f9a9ca09 refactor(workflow_ui): 抽出 run_convert 子模块
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 22:32:51 +08:00
boos a37546cb2d refactor(workflow_ui): 抽出 native_proxy 子模块
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 22:22:19 +08:00
boos f43daed3ee refactor(workflow_ui): 抽出 repair 子模块
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 22:05:30 +08:00
boos 35f63c46f1 refactor(workflow_ui): 抽出 model_inject 子模块
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 21:55:27 +08:00
boos e296c01b4b docs: workflow_ui/mod.rs 续拆(6 子模块)设计
把 mod.rs 残留 4095 行按职责再拆 6 组(model_inject/repair/native_proxy/
run_convert/ws/bootstrap),mod.rs 瘦到 ~1000-1200。纯机械移动,编译器+5测试验证。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 21:33:55 +08:00
boos a6c4db64c4 refactor(workflow_ui): 抽出 queue 子模块
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 15:15:17 +08:00
boos 7a02545fb8 refactor(workflow_ui): 抽出 validate 子模块
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 14:58:58 +08:00
boos 9cad69b88c refactor(workflow_ui): 抽出 comfy_proxy 子模块
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 14:47:24 +08:00
boos bbf0a3b81a refactor(workflow_ui): 抽出 assets 子模块
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 14:34:46 +08:00
boos 334ed04a6a refactor(workflow_ui): 抽出 models 子模块
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 14:23:17 +08:00
boos 7b1167bd75 refactor(workflow_ui): 抽出 node_defs 子模块
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 14:13:27 +08:00
boos 8a55efbfb6 refactor(workflow_ui): 抽出 auth 子模块
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 14:05:15 +08:00
boos fd4c1f0ac1 refactor(workflow_ui): 文件转目录模块(mod.rs,内容不变)
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 13:59:03 +08:00
boos 60ecd8a13c docs: workflow_ui.rs 拆分实现计划(Task0转目录 + 7子模块抽取)
每任务抽1组函数(纯搬运)+cargo编译+测试验证+独立提交。通用6步流程统一。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 13:52:26 +08:00
boos 441adcf489 docs: workflow_ui.rs 拆分(8 子模块)设计 spec
把 6181 行单文件按职责拆成 workflow_ui/ 目录 8 子模块(assets/auth/node_defs/
models/comfy_proxy/validate/queue/mod)。纯机械移动零逻辑改动,编译器+5测试验证。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 13:48:18 +08:00
boos 7e824a6d45 feat(digital-human): 副标题保留,仅去掉「基于 Pixelle-Video」前缀
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 13:35:08 +08:00
boos b2f6b875a0 feat(digital-human): 头部标题改为「短视频工厂/数字人」,去掉 Pixelle 副标题
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 13:34:14 +08:00
boos 86a2c51b31 feat(digital-human): 脚本模型选择器移到「文案与 BGM」区
脚本生成属文案环节,把脚本模型(可选)下拉从「语音与画面」移到「文案与 BGM」区。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 13:27:08 +08:00
boos edc125f79c feat(nav): 移除短视频工厂菜单,数字人改名为「短视频工厂/数字人」
admin/user 两区导航去掉 money-printer 入口,digital-human 菜单标签改为
「短视频工厂/数字人」。路由与页面保留(直链 /money-printer 仍可达,只是不在导航)。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 13:21:40 +08:00
boos 1d19401424 feat(pixelle): 连接管理页加 Pixelle 连接卡片
Accounts 页加 Pixelle 连接卡片(URL+2key+保存),api.ts adminApi 加 get/savePixelleConnection。
api.ts 一并带入此前累积的 files URL 改写改动。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 13:13:57 +08:00
boos 92d38bb309 feat(pixelle): 连接凭证 admin 端点(GET/PUT 掩码 + 重启)
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 11:57:23 +08:00
boos 55188e51ff feat(pixelle): 连接凭证 service(settings 读写 + config.yaml 同步)
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 11:51:47 +08:00
boos 96b8d2c399 feat(pixelle): 加 serde_yaml + Pixelle config 路径配置项
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 11:43:55 +08:00
boos 284cf84a47 docs: Pixelle 连接凭证管理实现计划(5 任务)
serde_yaml+config路径 → service(settings读写+yaml同步+restart) → admin端点(掩码)
→ 前端连接管理卡片 → 部署联调。写文件+重启容器同步机制。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 11:33:05 +08:00
boos 973396aac4 feat(digital-human): 后端转发 llm_model 给 Pixelle
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 11:23:23 +08:00
boos 1598e6c758 feat(digital-human): 前端加脚本模型选择器(llm_model)
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 11:23:19 +08:00
boos 07e31e0f7c docs: Pixelle 连接凭证纳入 BoosAPI 管理 设计 spec
连接管理页加 Pixelle 连接卡片(runninghub key/comfy url/comfy key),
写 settings 表 + 同步 config.yaml + 重启容器生效。只管3凭证,写文件+重启机制。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 11:19:39 +08:00
boos bfafc8f226 docs: 数字人脚本默认模型改为 deepseek-v4-flash
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 11:05:26 +08:00
boos 230eef96ed docs: 数字人脚本 LLM 模型可选 设计 spec
数字人页加脚本模型下拉(只列文本模型,默认 gpt-5.5),三层:
前端选择器(getModelsMarketplace过滤)+ 后端转发 llm_model + Pixelle 脚本步传 model。
生图模型已由图片工作流下拉覆盖,不在范围。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 04:50:05 +08:00
boos 054343f489 feat(digital-human): 后端转发 api_video_workflow 给 Pixelle
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 03:05:29 +08:00
boos 3524a165e3 feat(digital-human): 前端加视频工作流选择器(api_video_workflow)
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 02:57:44 +08:00
boos 53f99affec docs: 数字人 Comfy 视频入口实现计划(4 任务三层)
前端视频工作流选择器 → 后端转发 api_video_workflow → Pixelle comfy 注入 audio_path
→ 部署联调。视频入口可选、默认不启用、向后兼容。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 02:54:26 +08:00
boos 30b7b12682 docs: 数字人接入 Comfy Cloud 视频工作流(完整视频入口)设计
调查确认 BoosAPI 数字人 UI 无视频工作流入口、后端不转发 api_video_workflow、
Pixelle 仅给 api/ 通道注入 audio_path。设计贯穿三层补齐:
前端加视频工作流选择器 + 后端转发 api_video_workflow + Pixelle 给 comfy 工作流注入 audio_path。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 02:48:49 +08:00
boos 937442df04 docs: LTX2.3 数字人工作流实现计划(5 任务)
获取API导出 → 改造工作流(标记+删RecordAudio) → 补 media.py image_path 转发
→ 校验探测 → 真实联调。硬依赖用户导出 API 格式 JSON。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 02:20:36 +08:00
boos 79ade45c25 docs: LTX2.3 数字人 spec 补充 media.py image_path 转发缺口
writing-plans 阶段发现:media.py 只给 api/ 通道转发 image_path,comfy/ 通道收不到肖像图。
增加 media.py 一行级改动(非 api 分支把 image_path 加入 workflow_params),
标记名对齐为 $~image_path! / $~audio_path! / $prompt!。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 02:17:12 +08:00
boos ff514061d7 docs: LTX2.3 数字人工作流(Comfy Cloud)设计 spec
用官方模板 video_ltx2_3_id_lora(LTX2.3 身份保持+音频驱动)做 Pixelle comfy/ 数字人工作流,
经 comfy-cloud 适配器执行。模型/节点已验证在 Comfy Cloud 托管齐全。
comfykit _meta.title 标记注入(image/audio/prompt)。硬依赖:用户导出 API 格式 JSON。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 02:12:03 +08:00
boos 8ca6c2ad4f feat(comfy-cloud): Comfy Cloud 预设移到首位 + 新增站点默认选中
预设数组把 comfy-cloud 排第一;站点管理 openAdd 默认选 Comfy Cloud 预设
(预填 url+platform,只需贴 X-API-Key)。detect-race 测试补平台重置以保留竞态覆盖。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 00:38:32 +08:00
boos d850da64c3 feat(comfy-cloud): 站点预设模板新增 Comfy Cloud
siteInitializationPresets 共享契约(ts/js/d.ts)加 comfy-cloud 预设:
platform=comfy_cloud, defaultUrl=https://cloud.comfy.org, 自动填充官方地址。
platform 联合类型扩 'comfy_cloud';urlMatcher + Rust detect_site_platform 同步识别。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-18 00:21:44 +08:00
boos 08a2980f5f fix(comfy-cloud): /history 完成分支校验 jobs 详情状态码
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-17 23:39:18 +08:00
boos 7758858141 feat(comfy-cloud): 挂载适配路由 + 站点管理 comfy_cloud 平台选项
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-17 23:30:46 +08:00
boos 8676b5486b feat(comfy-cloud): /view 产出文件透传
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-17 23:26:07 +08:00
boos e90beda1a5 feat(comfy-cloud): /history 轮询翻译(status+jobs→history)
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-17 23:21:44 +08:00
boos 03eea2e267 feat(comfy-cloud): 适配端点骨架 + POST /prompt 转发
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-17 23:18:34 +08:00