Eriberto commited on
Commit
0fa03e9
·
1 Parent(s): 26e18bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -9,12 +9,13 @@ logger.info(f"session_token_: {openai.api_key}")
9
 
10
  def get_response_from_chatgpt(text):
11
  try:
12
- response = openai.Completion.create(engine='text-davinci-003', prompt=text, max_tokens=100)
13
  response_str = response["choices"][0]["text"].replace("\n", "")
14
  response_str = response_str.split(user_name + ": ", 1)[0].split(bot_name + ": ", 1)[0]
15
- logger.info(f"conversation_id_: [{esponse}]")
 
16
  except:
17
- response = "Openai said: I'm so tired. Let me lie down for a few days. If you like, you can visit my home."
18
  return response
19
 
20
  start_work = """async() => {
 
9
 
10
  def get_response_from_chatgpt(text):
11
  try:
12
+ response_api = openai.Completion.create(engine='text-davinci-003', prompt=text, max_tokens=100)
13
  response_str = response["choices"][0]["text"].replace("\n", "")
14
  response_str = response_str.split(user_name + ": ", 1)[0].split(bot_name + ": ", 1)[0]
15
+ response = response_str
16
+ logger.info(f"conversation_id_: [{response}]")
17
  except:
18
+ response = "Openai said: I'm so tired. Let me lie down for a few days."
19
  return response
20
 
21
  start_work = """async() => {