import asyncio
import openai
import werobot
openai.api_key = ""
robot = werobot.WeRoBot()
class RobotConfig(object):
HOST="0.0.0.0"
PORT= 80
TOKEN = " "
robot.config.from_object(RobotConfig)
async def generate_response(prompt):
response = await asyncio.get_event_loop().run_in_executor(
None,
openai.Completion.create,
model="text-davinci-003",
prompt=prompt,
temperature=0.7,
max_tokens=3000,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
message = response.choices[0].text
return message.strip()
@网页链接 async def hello (message):
print(message.content)
response = await generate_response(message.content)
return response.strip()
if __name__ == "__main__":
robot.run()
import openai
import werobot
openai.api_key = ""
robot = werobot.WeRoBot()
class RobotConfig(object):
HOST="0.0.0.0"
PORT= 80
TOKEN = " "
robot.config.from_object(RobotConfig)
async def generate_response(prompt):
response = await asyncio.get_event_loop().run_in_executor(
None,
openai.Completion.create,
model="text-davinci-003",
prompt=prompt,
temperature=0.7,
max_tokens=3000,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
message = response.choices[0].text
return message.strip()
@网页链接 async def hello (message):
print(message.content)
response = await generate_response(message.content)
return response.strip()
if __name__ == "__main__":
robot.run()