新增AI绘图统一LLM配置

1. 在config.yaml中新增AI绘图专用的OpenAI兼容backend,接入用户提供的网关地址与密钥。

2. 在llm.scenes中新增image.generate场景,统一路由AI绘图插件请求。

3. 将ai_gen_image插件默认scene切换为image.generate,实现开箱即用。
This commit is contained in:
liuwei
2026-04-28 16:03:39 +08:00
parent 075fba65ec
commit 5e144fb481
2 changed files with 18 additions and 1 deletions

View File

@@ -121,6 +121,22 @@ llm:
request_timeout: 15
max_retries: 1
retry_delay_seconds: 1.0
openai_compatible_ai_gen_image:
provider: "openai_compatible"
# AI 绘图专用网关:
# 1. 这里使用用户提供的 OpenAI 兼容服务地址;
# 2. 插件会在此 base_url 基础上请求 images/generations
# 3. endpoint 保留为图片接口默认值,便于后续统一调整。
api_base_url: "https://freeapi.dgbmc.top"
endpoint: "images/generations"
api_key: "sk-2XccrBRsX8OmxqCEsZjdDRczhHNaAG7Mn88mNVL7Y0w0tx72"
# 图片模型默认使用 gpt-image-1
# 若网关只支持其他模型,可后续直接在这里替换。
model: "gpt-image-1"
stream: false
timeout_seconds: 300
max_retries: 2
retry_delay_seconds: 1.0
# 场景路由层:插件建议优先使用 scene而不是直接绑定 backend。
# 这样当模型或供应商切换时,只需要改这里,不需要逐个改插件配置。
scenes:
@@ -132,3 +148,4 @@ llm:
"game.task": "openai_compatible_game_task"
"auto_reply.group": "dify_workflow_ai_auto_response"
"member_roast": "openai_compatible_ai_auto_response"
"image.generate": "openai_compatible_ai_gen_image"

View File

@@ -33,5 +33,5 @@ legacy_model = "turbo"
# 2. 插件会从该 scene 对应的 backend 中复用 api_base_url / api_key
# 3. 图片接口默认请求 images/generations如需特殊网关可在这里覆盖 image_endpoint。
[AIGenImage.llm]
scene = ""
scene = "image.generate"
image_endpoint = "images/generations"