Eriberto commited on
Commit
5c94b6c
·
1 Parent(s): 0fa03e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -9,13 +9,15 @@ logger.info(f"session_token_: {openai.api_key}")
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() => {
 
9
 
10
  def get_response_from_chatgpt(text):
11
  try:
12
+ response_api = openai.Completion.create(engine='text-davinci-003', prompt=str(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
+ print("RESPONSE STRING", response_str)
16
  response = response_str
17
+ logger.info(f"Response: [{response_api]")
18
  logger.info(f"conversation_id_: [{response}]")
19
  except:
20
+ response = "I'm so tired. Let me lie down for a few days."
21
  return response
22
 
23
  start_work = """async() => {