Spaces:
Runtime error
Runtime error
liuyizhang
commited on
Commit
•
67cdb63
1
Parent(s):
4099f3a
update app.py
Browse files
app.py
CHANGED
@@ -366,7 +366,6 @@ def set_openai_api_key(api_key):
|
|
366 |
|
367 |
def get_response_from_openai(input, prompt_system, chat_history, model_radio, temperature=0.0):
|
368 |
error_1 = 'You exceeded your current quota, please check your plan and billing details.'
|
369 |
-
|
370 |
def openai_create(input_list, prompt_system, model_radio):
|
371 |
try:
|
372 |
input_list_len = len(input_list)
|
@@ -448,8 +447,7 @@ def get_response_from_openai(input, prompt_system, chat_history, model_radio, te
|
|
448 |
ret = re.sub(r"<pre style='background-color: #ddd;margin-left:20px;padding-left:10px;'>(.*?)</pre>", lambda m: "<pre style='background-color: #ddd; color:#000; margin-left:20px;padding-left:10px;'>" + m.group(1).replace('<br>', '\n') + '</pre>', ret)
|
449 |
# logger.info(f'ret_2_={ret}')
|
450 |
if ret == '':
|
451 |
-
ret = f"Openai said: I'm too tired."
|
452 |
-
logger.info(f'openai.api_key = {openai.api_key}')
|
453 |
return ret, response.usage
|
454 |
except Exception as e:
|
455 |
logger.info(f"openai_create_error__{e}")
|
|
|
366 |
|
367 |
def get_response_from_openai(input, prompt_system, chat_history, model_radio, temperature=0.0):
|
368 |
error_1 = 'You exceeded your current quota, please check your plan and billing details.'
|
|
|
369 |
def openai_create(input_list, prompt_system, model_radio):
|
370 |
try:
|
371 |
input_list_len = len(input_list)
|
|
|
447 |
ret = re.sub(r"<pre style='background-color: #ddd;margin-left:20px;padding-left:10px;'>(.*?)</pre>", lambda m: "<pre style='background-color: #ddd; color:#000; margin-left:20px;padding-left:10px;'>" + m.group(1).replace('<br>', '\n') + '</pre>', ret)
|
448 |
# logger.info(f'ret_2_={ret}')
|
449 |
if ret == '':
|
450 |
+
ret = f"Openai said: I'm too tired."
|
|
|
451 |
return ret, response.usage
|
452 |
except Exception as e:
|
453 |
logger.info(f"openai_create_error__{e}")
|