mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-20 13:47:15 +08:00
fix: merge plugins to dev
This commit is contained in:
@@ -127,7 +127,7 @@ class ChatGPTBot(Bot):
|
|||||||
def create_img(self, query, retry_count=0):
|
def create_img(self, query, retry_count=0):
|
||||||
try:
|
try:
|
||||||
if conf().get('rate_limit_dalle') and not self.tb4dalle.get_token():
|
if conf().get('rate_limit_dalle') and not self.tb4dalle.get_token():
|
||||||
return "请求太快了,请休息一下再问我吧"
|
return False, "请求太快了,请休息一下再问我吧"
|
||||||
logger.info("[OPEN_AI] image_query={}".format(query))
|
logger.info("[OPEN_AI] image_query={}".format(query))
|
||||||
response = openai.Image.create(
|
response = openai.Image.create(
|
||||||
prompt=query, #图片描述
|
prompt=query, #图片描述
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
|
from bridge.context import *
|
||||||
from channel.channel import Channel
|
from channel.channel import Channel
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
class TerminalChannel(Channel):
|
class TerminalChannel(Channel):
|
||||||
def startup(self):
|
def startup(self):
|
||||||
context = {"from_user_id": "User"}
|
context = Context()
|
||||||
print("\nPlease input your question")
|
print("\nPlease input your question")
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
@@ -12,12 +13,13 @@ class TerminalChannel(Channel):
|
|||||||
print("\nExiting...")
|
print("\nExiting...")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
context.type = ContextType.TEXT
|
||||||
|
context['session_id'] = "User"
|
||||||
|
context.content = prompt
|
||||||
print("Bot:")
|
print("Bot:")
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
for res in super().build_reply_content(prompt, context):
|
res = super().build_reply_content(prompt, context).content
|
||||||
print(res, end="")
|
print(res)
|
||||||
sys.stdout.flush()
|
|
||||||
print("\n")
|
|
||||||
|
|
||||||
|
|
||||||
def get_input(self, prompt):
|
def get_input(self, prompt):
|
||||||
|
|||||||
Reference in New Issue
Block a user