From 524f13ac8a772bc04cb67f685ec07fc04495d751 Mon Sep 17 00:00:00 2001 From: api-gateway Date: Wed, 16 Sep 2026 10:11:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=9B=86=E6=88=90=E6=99=BA=E8=B0=B1=20?= =?UTF-8?q?CogView-3-Flash=20=E6=96=87=E7=94=9F=E5=9B=BE=20+=20CogVideoX-F?= =?UTF-8?q?lash=20=E6=96=87=E7=94=9F=E8=A7=86=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 29 ++++++++++++ README.md | 2 +- app/adapters/openai_compat.py | 32 +++++++++++++ app/config.py | 6 ++- app/main.py | 76 ++++++++++++++++++++++++++----- app/settings.py | 2 + data/gateway.yaml | 21 ++++++++- frontend/src/lib/media.ts | 2 +- frontend/src/locales/en.ts | 7 +++ frontend/src/locales/zh.ts | 7 +++ frontend/src/views/Images.vue | 24 ++++++++-- frontend/src/views/Videos.vue | 86 ++++++++++++++++++++++++++++------- tests/test_gateway.py | 33 ++++++++++---- 13 files changed, 278 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccef8cd..870d433 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,35 @@ --- +## 2026-09-16 · 集成智谱 CogView-3-Flash(文生图)+ CogVideoX-Flash(文生视频) + +**一句话**:给上一轮的智谱供应商补上媒体生成——图像页用 `cogview-3-flash`、视频页用 `cogvideox-flash`,前后端按「选到的供应商」自动切到智谱契约(不动 Agnes)。 + +### 契约(官网 + 真 Key 实测确认) +- **图像 cogview-3-flash**:`POST {base}/images/generations`,`{model, prompt, size}`(size 为像素档:1024x1024/768x1344/864x1152/1344x768/1152x864/1440x720/720x1440)→ 返回 `data[].url`;**无 ratio、不支持图生图**。 +- **视频 cogvideox-flash**:`POST {base}/videos/generations`(**异步**)`{model, prompt, quality, with_audio, size, fps:30/60}` → 返回 `task_status:PROCESSING`;再 `GET /async-result/{id}` 轮询到 `SUCCESS` 取 `video_result[].url`。仅文生视频。 + +### 后端 +- `data/gateway.yaml` bigmodel 加 `media`(图像端点+像素档、视频 `/videos/generations`+`/async-result/{id}`,新增 `video_style:"zhipu"`),并注册 `cogview-3-flash`(image)、`cogvideox-flash`(video)(顺带修复本轮早前编辑误吞的 `server:` 顶层键)。 +- `config.py`:`MediaConfig` 新增 `video_style` / `video_default_size`。 +- 适配器 `create_video` / `poll_video`:按 `video_style=="zhipu"` 走智谱异步契约(fps/quality/with_audio + 路径参数轮询);Agnes 分支不变(`__init__.py` docstring 改四家)。 +- `main.py`:新增 `_video_status`(兼容 `task_status`,智谱才识得 `SUCCESS/FAIL` 终态)与 `_video_terminal`,替换 3 处视频状态判定;`_validate_video_request` 按供应商分流(智谱仅 text 文生视频,size/quality/fps 合规校验,非法回干净 400 不进熔断);`videos_create` 改为先 `_resolve_media_model` 再按供应商校验。 +- `settings.py`:面板 `MEDIA_KEYS` 补 `video_style`/`video_default_size`(否则「网关配置」面板往返会丢这两个字段)。 +- 顺带修正 `DELETE /feedback` 过时 docstring(admin 可真删 admin_delete)。 + +### 前端(按所选模型 `provider==='bigmodel'` 自动切) +- `Videos.vue`:选智谱视频模型显示专用表单(分辨率/质量 speed·quality/帧率 30·60/配音 switch,固定文生视频),body 用 `extra:{quality,fps,with_audio}`;选 Agnes 原表单不变;切智谱模型时强制 `mode='text'`。 +- `Images.vue`:选 cogview 时 size 换成像素档、隐藏 ratio 与参考图(cogview 无图生图)。 +- `media.ts`:`findVideoUrl` 优先键补 `video_result`。 +- i18n:新增 `videos.zSize/zQuality/zSpeed/zQualityHigh/zFps/zAudio/zTip` 7 键,中英对称。 + +### 验证 +- 单测:新增/修正 bigmodel 媒体契约断言、视频轮询必经 `?model=`(现两家视频供应商)、配置往返含新 media 键 → **155 passed / 0 failed**;前端 `npm run build` 过(typecheck + i18n 对称),新入口 `index-CxdHy_Sw.js`。 +- 真机隔离(uvicorn:8899 临时 users/history,连真实智谱):`/v1/models` 列出 8 个智谱模型;图像 → 200 `data[].url`;视频创建 → `video_id`+`task_status:PROCESSING`;轮询 → `status:processing`;非法参数(`mode=keyframe`)→ 400 干净拒绝。 +- 上线:`supervisorctl restart api-gateway:api-gateway_00`(代码改动需重启),前端 dist 已 build 覆盖。 + +--- + ## 2026-09-16 · 新增智谱 GLM(open.bigmodel.cn)供应商 **一句话**:接入智谱开放平台作为新的 OpenAI 兼容供应商,收录 6 个 Flash 模型(3 文本 + 3 视觉),密钥走 `data/.env` 的 `ZHIPU_API_KEY`,真图实测确认 3 个 V 型号支持图像输入。 diff --git a/README.md b/README.md index 2c11bd0..2b8f328 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ api-gateway/ | Agnes AI | `https://api.agnes-ai.cn/v1` | Bearer | `agnes-3.0-flash`(text)、`agnes-image-2.5-flash`(image)、`agnes-video-2.5-flash`(video) | | b.ai | `https://api.b.ai/v1` | Bearer | `qwen3.8-flash`、`hy3`(text) | | 火山方舟 Coding | `https://ark.cn-beijing.volces.com/api/coding/v3` | Bearer | `ark-code-latest`(text) | -| 智谱 GLM | `https://open.bigmodel.cn/api/paas/v4` | Bearer | `GLM-4.7-Flash`、`GLM-4-Flash-250414`、`GLM-Z1-Flash`、`GLM-4.6V-Flash`、`GLM-4V-Flash`、`GLM-4.1V-Thinking-Flash`(text;其中 `GLM-4.6V-Flash`/`GLM-4V-Flash`/`GLM-4.1V-Thinking-Flash` 支持图像输入) | +| 智谱 GLM | `https://open.bigmodel.cn/api/paas/v4` | Bearer | 文本:`GLM-4.7-Flash`、`GLM-4-Flash-250414`、`GLM-Z1-Flash`、`GLM-4.6V-Flash`、`GLM-4V-Flash`、`GLM-4.1V-Thinking-Flash`(其中 3 个 V 型号支持图像输入);图像:`cogview-3-flash`;视频:`cogvideox-flash`(文生视频,异步 `/videos/generations` + `/async-result/{id}` 轮询) | > Agnes 的图像/视频走自有端点,通过供应商配置里的 `media` 段指定。 diff --git a/app/adapters/openai_compat.py b/app/adapters/openai_compat.py index be7ff56..003fc31 100644 --- a/app/adapters/openai_compat.py +++ b/app/adapters/openai_compat.py @@ -12,6 +12,7 @@ from __future__ import annotations import json from typing import Any, AsyncIterator +from urllib.parse import quote from app.adapters.base import BaseAdapter, json_or_raise @@ -184,6 +185,26 @@ class OpenAICompatAdapter(BaseAdapter): size: str = "720P", extra: dict[str, Any] | None = None, ) -> dict[str, Any]: + # 智谱视频契约:POST /videos/generations(异步)——参数为 quality/with_audio/fps/像素 size, + # 不需要 agnes 的 seconds/mode/aspect_ratio/n。 + if self.media.video_style == "zhipu": + endpoint = self.media.video_create_endpoint or "/videos/generations" + x = extra or {} + payload: dict[str, Any] = { + "model": model, + "prompt": prompt, + "size": size or self.media.video_default_size or "1920x1080", + "quality": x.get("quality") or "speed", + "fps": int(x.get("fps") or 30), + "with_audio": bool(x.get("with_audio") or False), + } + async with self._lease() as client: + resp = await client.post(endpoint, json=payload, headers=self._headers) + resp.raise_for_status() + data = json_or_raise(resp) + return {"video_id": data.get("id") or data.get("request_id") or data.get("task_id"), + "raw": data} + # ── Agnes 风格(默认):POST {base}/videos,seconds/mode/size/aspect_ratio/n ── endpoint = self.media.video_create_endpoint or "/videos" payload: dict[str, Any] = { "model": model, @@ -211,6 +232,17 @@ class OpenAICompatAdapter(BaseAdapter): # ── 视频轮询 ──────────────────────────────────── async def poll_video(self, video_id: str, model: str = "", extra: dict[str, Any] | None = None) -> dict[str, Any]: + # 智谱视频异步查询:GET {poll_base}/async-result/{video_id}(路径参数,无 query) + if self.media.video_style == "zhipu": + pb = (self.media.video_poll_base or self.base_url).rstrip("/") + pp = (self.media.video_poll_path or "/async-result").rstrip("/") + url = f"{pb}{pp}/{quote(str(video_id), safe='')}" + async with self._lease() as client: + resp = await client.get(url, headers=self._headers) + resp.raise_for_status() + data = json_or_raise(resp) + return {"raw": data} + mname = self.media.video_model_name or model or "" poll_base = self.media.video_poll_base or self.base_url poll_path = self.media.video_poll_path or "/agnesapi" diff --git a/app/config.py b/app/config.py index 6f80da9..c874776 100644 --- a/app/config.py +++ b/app/config.py @@ -54,7 +54,9 @@ class MediaConfig: video_create_endpoint: str | None = None # 相对 base_url,默认 /videos video_poll_base: str | None = None # 绝对 base(视频查询,默认同 base_url 去掉 /v1) video_poll_path: str | None = None # 默认 /agnesapi(Agnes) - video_model_name: str | None = None # 轮询用的 model_name 参数 + video_model_name: str | None = None # 轮询用的 model_name 参数(Agnes) + video_style: str | None = None # 视频契约风格:"zhipu"=智谱异步(videos/generations + /async-result/{id});None=Agnes 风格 + video_default_size: str | None = None # 视频默认尺寸(智谱为像素串如 1920x1080;Agnes 用 size 档位) @property def supports_image(self) -> bool: @@ -304,6 +306,8 @@ def _parse_media(pval: dict[str, Any]) -> MediaConfig: video_poll_base=m.get("video_poll_base"), video_poll_path=m.get("video_poll_path"), video_model_name=m.get("video_model_name"), + video_style=m.get("video_style"), + video_default_size=m.get("video_default_size"), ) diff --git a/app/main.py b/app/main.py index fc5011d..82a97b4 100644 --- a/app/main.py +++ b/app/main.py @@ -1729,8 +1729,8 @@ async def _video_wait_and_callback(cfg, pkey, pconfig, pmodel_id, video_id, wait await asyncio.sleep(2) continue raw = final.get("raw") or {} - status = raw.get("status") or raw.get("state") - if status in ("completed", "failed", "succeeded", "success"): + status = _video_status(raw) + if _video_terminal(status): break await asyncio.sleep(2) # Webhook 回调 @@ -1745,8 +1745,8 @@ async def _video_wait_and_callback(cfg, pkey, pconfig, pmodel_id, video_id, wait try: # Bug 2 修复: 按真实状态上报,failed 不再误标成 completed raw = (final.get("raw") if final else None) or {} - status = str(raw.get("status") or raw.get("state") or "") - if status not in ("completed", "failed", "succeeded", "success"): + status = _video_status(raw) + if not _video_terminal(status): status = "timeout" payload = {"video_id": video_id, "provider": pkey, "status": status, "result": raw, "x_request_id": rid} @@ -1764,12 +1764,63 @@ _VIDEO_SIZES = ("720P",) _VIDEO_ASPECTS = ("21:9", "16:9", "4:3", "1:1", "3:4", "9:16") -def _validate_video_request(req) -> None: +def _video_status(raw: dict | None) -> str: + """视频原始返回的状态取法(统一小写)。 + + 智谱异步结果是 task_status(PROCESSING/SUCCESS/FAIL),Agnes 用 status / state。 + """ + if not raw: + return "" + return str(raw.get("task_status") or raw.get("status") or raw.get("state") or "").lower() + + +def _video_terminal(status: str) -> bool: + """是否已到终态(成功或失败),用于结束轮询。""" + s = status.lower() + return s in ("success", "succeeded", "completed", "done", "finished", + "failed", "fail", "error", "cancelled", "canceled") + + +# 智谱 CogVideoX-Flash 支持的分辨率(像素串),与 Agnes 的 720P 档位语义不同。 +_ZHIPU_VIDEO_SIZES = { + "720x480", "1024x1024", "1280x960", "960x1280", + "1920x1080", "1080x1920", "2048x1080", +} + + +def _validate_video_request(req, media=None) -> None: """第十一轮 #3:按 Agnes Video 2.5 契约做**入站校验**,把明显不合法的 mode/媒体/时长 组合在网关挡下并回**干净 400**(不再白发上游浪费限流额度,也不进熔断)。 第十三轮补齐 size / aspect_ratio / n / videos 四项(文档「Flash 专属错误」与 「生成模式规则」里明确列出的限制),并保留原有 mode/媒体/时长校验。 目前只有 Agnes 配了视频,字段语义按它的文档来;接入其它视频供应商时需按各家契约放宽。""" + + # ── 智谱 CogVideoX(CogVideoX-Flash):仅 text 文生视频;quality/fps/with_audio 走 req.extra ── + if media is not None and media.video_style == "zhipu": + if (req.mode or "text") != "text": + raise HTTPException(400, "智谱视频(CogVideoX)仅支持 text 文生视频模式") + if int(req.n or 1) != 1: + raise HTTPException(400, "视频接口一次只提交 1 个任务(n 必须为 1,收到 %s)" % req.n) + if req.videos or req.images or req.audios or req.first_frame or req.last_frame: + raise HTTPException(400, "智谱视频不支持首尾帧 / 参考图 / 参考音频(文生视频只填 prompt)") + if req.size and req.size not in _ZHIPU_VIDEO_SIZES: + raise HTTPException(400, "智谱视频 size 仅支持 %s,收到 %r" % + ("/".join(sorted(_ZHIPU_VIDEO_SIZES)), req.size)) + _x = req.extra or {} + _q = _x.get("quality") + if _q is not None and _q not in ("speed", "quality"): + raise HTTPException(400, "智谱视频 quality 仅支持 speed / quality,收到 %r" % _q) + _f = _x.get("fps") + if _f is not None: + try: + _fi = int(_f) + except (TypeError, ValueError): + _fi = -1 + if _fi not in (30, 60): + raise HTTPException(400, "智谱视频 fps 仅支持 30 / 60,收到 %r" % _f) + return + + # ── Agnes 契约(默认)─────────────────────────────── mode = req.mode or "text" if mode not in _VIDEO_MODES: raise HTTPException(400, f"视频 mode 仅支持 {'/'.join(_VIDEO_MODES)},收到 {mode!r}") @@ -1811,12 +1862,13 @@ async def videos_create(request: Request, req: VideoCreateRequestExtended, _auth cfg = _cfg() rid = getattr(request.state, "rid", "-") caller = getattr(request.state, "caller", "anonymous") - _validate_video_request(req) # 第十一轮 #3:入站按上游契约校验 mode/媒体/时长 - # Bug 4: 支持路由别名(如 wjd)→ 解析到第一个 type==video 的模型 + # Bug 4: 支持路由别名(如 wjd)→ 解析到第一个 type==video 的模型。 + # 解析放在入站校验之前,好让 _validate_video_request 按供应商媒体契约(Agnes / 智谱)分流。 resolved = _resolve_media_model(cfg, req.model, "video") if resolved is None: raise HTTPException(404, f"未知视频模型/路由: {req.model}(没有可用的 video 类型模型)") pkey, pconfig, minfo, token, real_model = resolved + _validate_video_request(req, pconfig.media) # 入站按供应商媒体契约校验 # 顺序修复(本轮):先能力检查(501),再校验回调地址(400),最后限流 —— 避免无效请求白扣 token。 if not pconfig.media.supports_video: raise HTTPException(501, f"供应商 {pconfig.name} 不支持视频创建") @@ -1872,7 +1924,7 @@ async def videos_create(request: Request, req: VideoCreateRequestExtended, _auth # 本轮修复: status 同时看 status/state(此前只看 status,而上游若用 state # 会被显示成 "pending" —— 即使其实已完成,与等待循环的判定不一致) raw_final = (final.get("raw") or {}) if final else {} - resp["status"] = (raw_final.get("status") or raw_final.get("state") or "pending") if final else "submitted" + resp["status"] = (_video_status(raw_final) or "pending") if final else "submitted" elif req.callback_url: # 第六轮修复: 此前只传 callback_url(不传 wait)时,_video_wait_and_callback 第一行 # 就 `if not wait: return None` → **webhook 被静默丢弃、永不回调**,而 README 却把 @@ -2026,8 +2078,8 @@ async def videos_poll(request: Request, video_id: str, model: str = "", wait: bo log.warning("[rid=%s] 轮询视频 %s 瞬时失败: %s", rid, _logsafe(video_id), e) await asyncio.sleep(2) continue - status = (result.get("raw") or {}).get("status") or (result.get("raw") or {}).get("state") - if status in ("completed", "failed", "succeeded", "success"): + status = _video_status(result.get("raw")) + if _video_terminal(status): break await asyncio.sleep(2) if result is None: @@ -2043,12 +2095,12 @@ async def videos_poll(request: Request, video_id: str, model: str = "", wait: bo # 第十轮: 轮询不单独占一行日志,改为按 video_id 快照累积,由 /logs 合成到创建那条里 video_poll_push(video_id, { "ts": round(time.time(), 3), "ok": True, - "status": (raw.get("status") or raw.get("state") or ""), + "status": _video_status(raw), "progress": raw.get("progress"), "raw": json.dumps(raw, ensure_ascii=False)[:1200], }) return {"video_id": video_id, "provider": pkey, "served_model": pmodel_id, "raw": raw, - "status": raw.get("status") or raw.get("state"), "x_request_id": rid} + "status": _video_status(raw), "x_request_id": rid} except AuthConfigError as e: cb.release_probe() raise HTTPException(503, f"供应商 {pconfig.name} 未配置可用凭证: {e}") diff --git a/app/settings.py b/app/settings.py index cdc93cd..eeba6e5 100644 --- a/app/settings.py +++ b/app/settings.py @@ -61,6 +61,8 @@ MEDIA_KEYS = ( "video_poll_base", "video_poll_path", "video_model_name", + "video_style", + "video_default_size", ) MODEL_TYPES = ("text", "image", "video") diff --git a/data/gateway.yaml b/data/gateway.yaml index 0d5d947..882f749 100644 --- a/data/gateway.yaml +++ b/data/gateway.yaml @@ -74,7 +74,19 @@ providers: auth: token_env: "ZHIPU_API_KEY" extra_headers: {} - media: {} + # 智谱媒体生成(openai 兼容 + 异步查询): + # - 图像 cogview-3-flash:POST /images/generations,size 为像素档,返回 data[].url + # - 视频 cogvideox-flash:POST /videos/generations(异步),GET /async-result/{id} 轮询; + # 完成时 task_status=SUCCESS、video_result[].url。 + # video_style: zhipu 让适配器按智谱契约构造视频 payload 与轮询路径(不走 agnes 那套 seconds/mode/aspect)。 + media: + image_endpoint: "/images/generations" + image_default_size: "1024x1024" + video_create_endpoint: "/videos/generations" + video_poll_base: "https://open.bigmodel.cn/api/paas/v4" + video_poll_path: "/async-result" + video_style: "zhipu" + video_default_size: "1920x1080" models: - id: "GLM-4.7-Flash" display_name: "GLM-4.7-Flash" @@ -97,7 +109,12 @@ providers: display_name: "GLM-4.1V-Thinking-Flash" type: "text" vision: true - + - id: "cogview-3-flash" + display_name: "CogView-3-Flash" + type: "image" + - id: "cogvideox-flash" + display_name: "CogVideoX-Flash" + type: "video" server: host: "127.0.0.1" port: 8808 diff --git a/frontend/src/lib/media.ts b/frontend/src/lib/media.ts index 473af96..1179658 100644 --- a/frontend/src/lib/media.ts +++ b/frontend/src/lib/media.ts @@ -26,7 +26,7 @@ export function findVideoUrl(obj: any): string { return '' } if (typeof obj === 'object') { - for (const k of ['video_url', 'play_url', 'url', 'html_url', 'video', 'media_url', 'result', 'data', 'mp4']) { + for (const k of ['video_result', 'video_url', 'play_url', 'url', 'html_url', 'video', 'media_url', 'result', 'data', 'mp4']) { if (k in obj) { const u = findVideoUrl(obj[k]); if (u) return u } } for (const v of Object.values(obj)) { const u = findVideoUrl(v); if (u) return u } diff --git a/frontend/src/locales/en.ts b/frontend/src/locales/en.ts index b369afa..5b9a4b6 100644 --- a/frontend/src/locales/en.ts +++ b/frontend/src/locales/en.ts @@ -303,6 +303,13 @@ export default { videos: { taskTitle: 'Tasks', fixed: 'Fixed', + zSize: 'Resolution', + zQuality: 'Quality', + zSpeed: 'Speed first', + zQualityHigh: 'Quality first', + zFps: 'FPS', + zAudio: 'Audio', + zTip: 'Zhipu CogVideoX supports text-to-video only (text mode); generation takes a while, please wait.', title: 'Video generation', model: 'Video model', mode: 'Scenario', diff --git a/frontend/src/locales/zh.ts b/frontend/src/locales/zh.ts index ac270eb..6d34568 100644 --- a/frontend/src/locales/zh.ts +++ b/frontend/src/locales/zh.ts @@ -303,6 +303,13 @@ export default { videos: { taskTitle: '任务列表', fixed: '固定', + zSize: '分辨率', + zQuality: '质量', + zSpeed: '速度优先', + zQualityHigh: '质量优先', + zFps: '帧率', + zAudio: '配音', + zTip: '智谱 CogVideoX 仅支持文生视频(text 模式);生成耗时较长,请耐心等待。', title: '视频生成', model: '视频模型', mode: '场景', diff --git a/frontend/src/views/Images.vue b/frontend/src/views/Images.vue index 889902e..1f8237a 100644 --- a/frontend/src/views/Images.vue +++ b/frontend/src/views/Images.vue @@ -14,10 +14,10 @@
- +
-
+
@@ -44,7 +44,7 @@ />
-
+
@@ -166,8 +166,22 @@ const models = ref([]) const model = ref('') const sizes = ['1K', '2K', '3K', '4K'] const ratios = ['1:1', '3:4', '4:3', '16:9', '9:16', '2:3', '3:2', '21:9'] +// 智谱 CogView-3-Flash:文生图,size 用像素档、天然无 ratio、不支持参考图(图生图) +const zhipuSizes = ['1024x1024', '768x1344', '864x1152', '1344x768', '1152x864', '1440x720', '720x1440'] +const isZhipu = computed(() => models.value.find((m: any) => m.id === model.value)?.provider === 'bigmodel') +const displaySizes = computed(() => (isZhipu.value ? zhipuSizes : sizes)) const size = ref('1K') const ratio = ref('1:1') +watch(model, (m) => { + const mo = models.value.find((x: any) => x.id === m) + const z = mo?.provider === 'bigmodel' + if (z) { + if (!zhipuSizes.includes(size.value)) size.value = '1024x1024' + ratio.value = '' // cogview 的宽高由 size 像素档决定,无 ratio + } else if (ratio.value === '') { + ratio.value = '1:1' + } +}) const count = ref(1) // 逐张生成:每张一次请求(上游 n 必须为 1) const prompt = ref('') // 参考图(图生图 / 多图合成):上传的走 data URI,URL 的直接透传,两类可混用 @@ -274,8 +288,8 @@ async function generate() { progress.value = i const t0 = performance.now() // 上游图像接口的 n 必须为 1:多张就在这里逐张调用,每张出来就上屏(进度可见) - const body: any = { model: model.value, prompt: prompt.value, size: size.value, ratio: ratio.value, n: 1 } - if (list.length) body.image = list // 图生图 / 多图合成(网关转成上游的 extra_body.image) + const body: any = { model: model.value, prompt: prompt.value, size: size.value, ratio: isZhipu.value ? '' : ratio.value, n: 1 } + if (list.length && !isZhipu.value) body.image = list // 图生图 / 多图合成(网关转成上游的 extra_body.image) const j = await api('/v1/images/generations', { method: 'POST', body: JSON.stringify(body) }) const ms = (performance.now() - t0) | 0 providerName.value = j.provider_name || j.provider || '' diff --git a/frontend/src/views/Videos.vue b/frontend/src/views/Videos.vue index 2d61f34..0f025e3 100644 --- a/frontend/src/views/Videos.vue +++ b/frontend/src/views/Videos.vue @@ -10,7 +10,9 @@
- + + + +
@@ -220,7 +255,7 @@