Spaces:
Running
Running
Update app.py
Browse filesReasoning retrun if isBoss
app.py
CHANGED
|
@@ -903,6 +903,9 @@ def chat(prompt, user_window, pwd_window, past, response, gptModel, uploaded_ima
|
|
| 903 |
responses = []
|
| 904 |
inputs = []
|
| 905 |
prev_id = None
|
|
|
|
|
|
|
|
|
|
| 906 |
if mode == "Advanced":
|
| 907 |
if len(past):
|
| 908 |
(prev_id, container_id) = past.pop()
|
|
@@ -928,7 +931,7 @@ def chat(prompt, user_window, pwd_window, past, response, gptModel, uploaded_ima
|
|
| 928 |
image_done = False
|
| 929 |
ann_files = [] # (container_id, file_id, filename)
|
| 930 |
code_files = [] # (container_id, file_id, filename)
|
| 931 |
-
text
|
| 932 |
for output in result.output:
|
| 933 |
if output.type == 'message':
|
| 934 |
for content in output.content:
|
|
@@ -985,6 +988,9 @@ def chat(prompt, user_window, pwd_window, past, response, gptModel, uploaded_ima
|
|
| 985 |
with open(fpath,'wb') as fp:
|
| 986 |
fp.write(image_data)
|
| 987 |
image_out = gr.Image(visible=True, value=fpath)
|
|
|
|
|
|
|
|
|
|
| 988 |
do_file_download = False
|
| 989 |
ext = ''
|
| 990 |
backup_image = None
|
|
@@ -1029,7 +1035,7 @@ def chat(prompt, user_window, pwd_window, past, response, gptModel, uploaded_ima
|
|
| 1029 |
continue
|
| 1030 |
out_text = "\n".join(line for line in text.splitlines() if
|
| 1031 |
'download' not in line.casefold())
|
| 1032 |
-
res = md("\n\n***YOU***: " + prompt + "\n\n***GPT***: " + out_text)
|
| 1033 |
response += res
|
| 1034 |
past.append(res)
|
| 1035 |
past.append((result.id, container_id))
|
|
|
|
| 903 |
responses = []
|
| 904 |
inputs = []
|
| 905 |
prev_id = None
|
| 906 |
+
text = ''
|
| 907 |
+
reasoning = ''
|
| 908 |
+
show_reasoning = False
|
| 909 |
if mode == "Advanced":
|
| 910 |
if len(past):
|
| 911 |
(prev_id, container_id) = past.pop()
|
|
|
|
| 931 |
image_done = False
|
| 932 |
ann_files = [] # (container_id, file_id, filename)
|
| 933 |
code_files = [] # (container_id, file_id, filename)
|
| 934 |
+
text += '\n??? AI returned no text for this query\n'
|
| 935 |
for output in result.output:
|
| 936 |
if output.type == 'message':
|
| 937 |
for content in output.content:
|
|
|
|
| 988 |
with open(fpath,'wb') as fp:
|
| 989 |
fp.write(image_data)
|
| 990 |
image_out = gr.Image(visible=True, value=fpath)
|
| 991 |
+
elif isBoss and output.type == 'reasoning':
|
| 992 |
+
for item in output.summary:
|
| 993 |
+
reasoning += f'\nReasoning: {item.text}'
|
| 994 |
do_file_download = False
|
| 995 |
ext = ''
|
| 996 |
backup_image = None
|
|
|
|
| 1035 |
continue
|
| 1036 |
out_text = "\n".join(line for line in text.splitlines() if
|
| 1037 |
'download' not in line.casefold())
|
| 1038 |
+
res = md("\n\n***YOU***: " + prompt + "\n\n***GPT***: " + out_text + '\n' + reasoning)
|
| 1039 |
response += res
|
| 1040 |
past.append(res)
|
| 1041 |
past.append((result.id, container_id))
|