Browse Source

feat: Make the size parameter of the resulting picture configurable

master
李超 1 year ago
parent
commit
fc5d3e4e9c
3 changed files with 8 additions and 2 deletions
  1. +1
    -1
      bot/openai/open_ai_image.py
  2. +2
    -0
      config.py
  3. +5
    -1
      docker/build.latest.sh

+ 1
- 1
bot/openai/open_ai_image.py View File

@@ -20,7 +20,7 @@ class OpenAIImage(object):
response = openai.Image.create(
prompt=query, #图片描述
n=1, #每次生成图片的数量
size="256x256" #图片大小,可选有 256x256, 512x512, 1024x1024
size=conf().get('image_create_size', "256x256") #图片大小,可选有 256x256, 512x512, 1024x1024
)
image_url = response['data'][0]['url']
logger.info("[OPEN_AI] image_url={}".format(image_url))


+ 2
- 0
config.py View File

@@ -32,6 +32,8 @@ available_setting = {
"image_create_prefix": ["画", "看", "找"], # 开启图片回复的前缀
"concurrency_in_session": 1, # 同一会话最多有多少条消息在处理中,大于1可能乱序

"image_create_size": "256x256", #图片大小,可选有 256x256, 512x512, 1024x1024

# chatgpt会话参数
"expires_in_seconds": 3600, # 无操作会话的过期时间
"character_desc": "你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。", # 人格描述


+ 5
- 1
docker/build.latest.sh View File

@@ -1,4 +1,8 @@
#!/bin/bash

unset KUBECONFIG

cd .. && docker build -f docker/Dockerfile.latest \
-t zhayujie/chatgpt-on-wechat .
-t zhayujie/chatgpt-on-wechat .

docker tag zhayujie/chatgpt-on-wechat zhayujie/chatgpt-on-wechat:$(date +%y%m%d)

Loading…
Cancel
Save