diff --git a/README.md b/README.md index aece2b2..b714f5a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PicGen Console -一个面向 OpenAI 兼容图像生成 / 编辑接口的本地工作台,当前版本 **0.1.58**。它把 +一个面向 OpenAI 兼容图像生成 / 编辑接口的本地工作台,当前版本 **0.1.59**。它把 `/v1/images/generations`、`/v1/images/edits` 与 `/v1/responses`(含 `image_generation` 工具) 包装成统一可观测的代理,前端是一套零依赖的 Web 控制台。 @@ -14,7 +14,9 @@  -## 0.1.58 主要特性 +## 0.1.59 主要特性 + +- **上游参数错误不再误报审核**:`invalid_mask_image_format` 会提示客户改用像素尺寸一致的标准 PNG,不再仅因通用 `image_generation_user_error` 类型就提示“内容审核未通过”;明确的内容政策 code 和文案仍会正确分类。 - **Responses 候选数量收敛**:强制使用图像工具、关闭并行工具调用并把请求数量写入提示词;上游仍越界时在落盘前按 `sample_count` 截断,避免单图任务意外生成 6 张候选并拖到数百秒,同时不再为非官方 `n` 参数自动重发付费请求。 @@ -109,10 +111,10 @@ PICGEN_LOG_FORMAT=json \ ### Docker ```bash -docker build -t minorli/picgen:0.1.58 . +docker build -t minorli/picgen:0.1.59 . docker run --rm -p 8000:8000 \ -v picgen-data:/app/data \ - minorli/picgen:0.1.58 + minorli/picgen:0.1.59 ``` 或: @@ -127,10 +129,10 @@ docker compose up -d ./scripts/docker-build-push.sh ``` -默认会构建并推送 `minorli/picgen:0.1.58`。也可以覆盖: +默认会构建并推送 `minorli/picgen:0.1.59`。也可以覆盖: ```bash -IMAGE=minorli/picgen VERSION=0.1.58 PLATFORM=linux/amd64 ./scripts/docker-build-push.sh +IMAGE=minorli/picgen VERSION=0.1.59 PLATFORM=linux/amd64 ./scripts/docker-build-push.sh ``` 镜像不会包含 `.env`、本地用户库或历史图片。容器内置 `HEALTHCHECK` 探测 `/api/health`,以非 root @@ -243,7 +245,7 @@ Bug 反馈和找回密码申请会先写入本地认证库,再优先发送到 ## 图像通道 -PicGen 0.1.58 把四类图像操作统一提交给 `/api/image-jobs`,实际通道由服务端决定: +PicGen 0.1.59 把四类图像操作统一提交给 `/api/image-jobs`,实际通道由服务端决定: | 用户操作 | 默认接口 | 默认模型 | | --- | --- | --- | diff --git a/docker-compose.yml b/docker-compose.yml index 4059963..bfa56fe 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: picgen: - image: minorli/picgen:0.1.58 + image: minorli/picgen:0.1.59 build: context: . ports: diff --git a/pyproject.toml b/pyproject.toml index 2e4eeef..c41f1c5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "picgen" -version = "0.1.58" +version = "0.1.59" description = "Enterprise-grade local web console for OpenAI-compatible image generation and editing APIs." readme = "README.md" requires-python = ">=3.12" diff --git a/scripts/docker-build-push.sh b/scripts/docker-build-push.sh index 9fb62a5..f6427c3 100755 --- a/scripts/docker-build-push.sh +++ b/scripts/docker-build-push.sh @@ -2,7 +2,7 @@ set -euo pipefail IMAGE="${IMAGE:-minorli/picgen}" -VERSION="${VERSION:-0.1.58}" +VERSION="${VERSION:-0.1.59}" PLATFORM="${PLATFORM:-linux/amd64}" docker buildx build \ diff --git a/src/picgen/upstream/errors.py b/src/picgen/upstream/errors.py index 0202ce4..a6ad27e 100644 --- a/src/picgen/upstream/errors.py +++ b/src/picgen/upstream/errors.py @@ -60,6 +60,8 @@ def classify_upstream_error(status: int, message: str, details: str | None = Non haystack = f"{message}\n{details or ''}".lower() if status == 429 or "rate limit" in haystack or "rate_limit" in haystack: return "upstream_rate_limited" + if "invalid_mask_image_format" in _error_values(details): + return "upstream_invalid_image_input" if _looks_like_content_policy_error(status, message, details): return "upstream_content_policy" if "cloudflare" in haystack or "error 1010" in haystack: @@ -76,7 +78,6 @@ def _looks_like_content_policy_error(status: int, message: str, details: str | N "policy_violation", "safety_policy_violation", "moderation_blocked", - "image_generation_user_error", } for value in explicit_values ): @@ -120,6 +121,8 @@ def _error_values(details: str | None) -> set[str]: def public_upstream_error_message(status: int, code: str, action: str) -> str: if code == "upstream_rate_limited": return "图片生成服务当前请求较多,请稍后再试。" + if code == "upstream_invalid_image_input": + return "上游不接受当前输入图或蒙版的格式/尺寸,请改用像素尺寸一致的标准 PNG 后重试。" if code == "upstream_content_policy": return "这次提示词没有通过上游内容审核,请调整描述后重试。" if code == "upstream_blocked": diff --git a/static/app.js b/static/app.js index 91ec3e7..83f8485 100644 --- a/static/app.js +++ b/static/app.js @@ -1,11 +1,11 @@ -import { calculateLogoPlacementScore, chooseLogoPlacement } from "./logo-placement.mjs?v=0.1.58" +import { calculateLogoPlacementScore, chooseLogoPlacement } from "./logo-placement.mjs?v=0.1.59" import { DEFAULT_RESPONSES_MODEL, RESPONSES_MODEL_STORAGE_VERSION, RESPONSES_REASONING_STORAGE_VERSION, migrateStoredResponsesReasoningSettings, migrateStoredResponsesSettings, -} from "./responses-settings.mjs?v=0.1.58" +} from "./responses-settings.mjs?v=0.1.59" const RESPONSES_REASONING_EFFORTS = new Set(["low", "medium", "high", "xhigh", "max", "ultra"]) const DEFAULT_RESPONSES_REASONING_EFFORT = "xhigh" diff --git a/static/index.html b/static/index.html index 79b7871..954d87d 100644 --- a/static/index.html +++ b/static/index.html @@ -5,7 +5,7 @@