Jazee6 / cloudflare-ai-web

支持Gemini Pro / Cloudflare Workers AI / ChatGPT的融合Web平台
https://ai.jaze.top
Apache License 2.0
1.87k stars 471 forks source link

可以添加识别生图参数的功能吗? #19

Closed panxiaoguang closed 6 months ago

panxiaoguang commented 7 months ago

Stable Diffusion XL应该除了Prompt还可以识别别的一些参数:其所有的参数应该是按照官网上来的: https://platform.stability.ai/docs/features/api-parameters。 大概常用的参数有: prompt:正常提示词 height:图片的高度 width: 图片的宽度 steps: 迭代步数 num_samples: 一次性生图的个数 cfg_scale: 提示词的权重 sampler:采样器函数名称,例如k_euler就是euler采样器 seed: 种子,默认为随机(0)

可以通过一个函数来解析聊天message里面是否包含“--width”这种参数来识别是否用户添加了参数,然后将参数解析为一个请求体,发送给SDXL模型。例如聊天内容为“ a cute cat --width 1200 --height 1280" 就可以解析为:

{ prompt:'a cute cat', width:1200, height:1280 }

Jazee6 commented 6 months ago

目前1.5仅支持一个参数steps,后续会跟进其他参数