Repository navigation
feat(tools): 新增图片生成模型调用授权限制 - #7
Merged
Merged
Conversation
任何图片生成模型(Qwen-Image 全系、wan/万相、Seedream、Gemini/Nano Banana、 GPT-Image、FLUX、z-image 等,含 MCP 工具与网页端代操作)在调用前必须先向用户 说明用途、模型与预计花费,取得明确同意后才可执行。 - 新增 tools/IMAGE-GEN-AUTHORIZATION.md 作为规则正本:三要素说明(用途须落到产品/ 平台/页面位置、模型与通道、张数×单价)、单价取值口径(取官方页面当时数值,不写死 价格)、禁止事项(禁止先跑一张试试、禁止代拟授权凭据、禁止拆批规避、禁止挪用)、 审计字段清单 - tools/qwen_image.py 新增 check_authorization() 硬闸门与 --authorize / --purpose / --unit-price 三个必填参数,闸门置于读取密钥与发出请求之前,缺任一即退出且不产生 任何 API 调用;放行时打印「张数×单价=预计花费」并追加写入 out/authorization.log - selftest 补充 4 组未授权拒绝断言、1 组放行并按 4×0.25=1.0 算费断言、1 组「未授权 不写审计日志」断言,全部离线执行不触网 决策 2026-10-29 20:00:单价不写死在文档或脚本中,改为必填参数。百炼官方计费页需 登录,未取到 qwen-image 确切单价;写死一个未经核实的数字会随官方调价变成误导。
把「出图前须取得用户授权」写进 Agent 实际会读到的四个位置,避免只有翻到规则 正本才知道有这条限制。 - README「云端出图」节加授权提示块与工具表条目,示例命令补上三个授权参数 - ecom-main-image-prompts/SKILL.md、ecom-detail-page-prompts/SKILL.md 步骤末尾各 加一条「不得自行出图」:未获授权时只交付提示词文本 - 两份 references/tool-adaptation.md 的出图章节各加授权提示与示例参数,说明 --authorize 填用户原话、--purpose 落到具体位置、--unit-price 取官方当时数值 - SKILL.md 内注明规则正本位于仓库与镜像工作区,单独安装技能目录时不带该文件, 约束仍按句执行
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
出图按张计费,一次批量任务可能几十上百张,费用会累积;用途不明时还可能生成不该生成的东西。用户要求把「调用任何图片生成模型前须取得授权,并说明用途与预计花费」落成文件,写进实际调用环节,不能只靠记忆或口头约定。
改动
规则正本
tools/IMAGE-GEN-AUTHORIZATION.md脚本硬闸门
tools/qwen_image.py--authorize/--purpose/--unit-price三个必填参数out/authorization.log(已被.gitignore覆盖,只留本机)调用点接入
SKILL.md步骤末尾各加「不得自行出图」:未获授权只交付提示词文本references/tool-adaptation.md出图章节加授权提示,说明--authorize填用户原话适用范围不限 Qwen-Image,含 wan/万相、Seedream、Gemini/Nano Banana、GPT-Image、FLUX、z-image,以及 MCP 图片工具与网页端代操作。
验证
--selftestexit 0:含 4 组未授权拒绝断言、1 组放行按 4×0.25=1.0 算费断言、1 组「未授权不写审计日志」断言,全部离线不触网lint_skills.py0 错 0 警、check_cases.py23/23、verify-sync.py40/40 全 exit 0已知限制
官方百炼计费页需登录,未取到 qwen-image 确切单价,因此单价设计为参数传入而非内置默认值。