Spaces:
Runtime error
Runtime error
yizhangliu
commited on
Commit
·
f21f8e3
1
Parent(s):
ad66e11
Update app.py
Browse files
app.py
CHANGED
@@ -17,17 +17,18 @@ session_token = os.environ.get('SessionToken')
|
|
17 |
# logger.info(f"session_token_: {session_token}")
|
18 |
|
19 |
def get_api():
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
25 |
return api
|
26 |
|
27 |
def get_response_from_chatbot(api, text):
|
28 |
if api is None:
|
29 |
# return "Sorry, I'm busy. Try again later.(1)"
|
30 |
-
return "Openai said: I'm too tired. Let me lie down for a few days."
|
31 |
try:
|
32 |
resp = api.send_message(text)
|
33 |
api.refresh_auth()
|
@@ -39,7 +40,7 @@ def get_response_from_chatbot(api, text):
|
|
39 |
logger.info(f"conversation_id_: [{conversation_id}] / parent_id: [{parent_id}]")
|
40 |
except:
|
41 |
# response = "Sorry, I'm busy. Try again later.(2)"
|
42 |
-
response = "Openai said: I'm so tired. Let me lie down for a few days."
|
43 |
return response
|
44 |
|
45 |
model_ids = {
|
|
|
17 |
# logger.info(f"session_token_: {session_token}")
|
18 |
|
19 |
def get_api():
|
20 |
+
api = None
|
21 |
+
# try:
|
22 |
+
# api = ChatGPT(session_token)
|
23 |
+
# # api.refresh_auth()
|
24 |
+
# except:
|
25 |
+
# api = None
|
26 |
return api
|
27 |
|
28 |
def get_response_from_chatbot(api, text):
|
29 |
if api is None:
|
30 |
# return "Sorry, I'm busy. Try again later.(1)"
|
31 |
+
return "Openai said: I'm too tired. Let me lie down for a few days. If you like, you can visit my home."
|
32 |
try:
|
33 |
resp = api.send_message(text)
|
34 |
api.refresh_auth()
|
|
|
40 |
logger.info(f"conversation_id_: [{conversation_id}] / parent_id: [{parent_id}]")
|
41 |
except:
|
42 |
# response = "Sorry, I'm busy. Try again later.(2)"
|
43 |
+
response = "Openai said: I'm so tired. Let me lie down for a few days. If you like, you can visit my home."
|
44 |
return response
|
45 |
|
46 |
model_ids = {
|