Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -38,7 +38,7 @@ def chat(message, history, openai_api_key):
|
|
38 |
|
39 |
with lock:
|
40 |
text_values, image_values = [], []
|
41 |
-
|
42 |
|
43 |
try:
|
44 |
if os.environ["OPENAI_API_KEY"] != openai_api_key:
|
@@ -59,14 +59,17 @@ def chat(message, history, openai_api_key):
|
|
59 |
recurse_execute_tool_calls(get_thread(), run, run_steps, 0)
|
60 |
messages = get_messages(get_thread())
|
61 |
text_values, image_values = extract_content_values(messages)
|
|
|
|
|
|
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
download_link = f"<hr>[Download](https://platform.openai.com/storage/files/{image_values[0]})"
|
66 |
except Exception as e:
|
67 |
raise gr.Error(e)
|
68 |
|
69 |
-
return f"{
|
|
|
70 |
|
71 |
gr.ChatInterface(
|
72 |
fn=chat,
|
|
|
38 |
|
39 |
with lock:
|
40 |
text_values, image_values = [], []
|
41 |
+
texts, images = "", ""
|
42 |
|
43 |
try:
|
44 |
if os.environ["OPENAI_API_KEY"] != openai_api_key:
|
|
|
59 |
recurse_execute_tool_calls(get_thread(), run, run_steps, 0)
|
60 |
messages = get_messages(get_thread())
|
61 |
text_values, image_values = extract_content_values(messages)
|
62 |
+
|
63 |
+
for text_value in list(reversed(text_values)):
|
64 |
+
texts += f"{text_value})<br>"
|
65 |
|
66 |
+
for image_value in image_values:
|
67 |
+
images += f"[https://platform.openai.com/storage/files/{image_value}](https://platform.openai.com/storage/files/{image_value})<br>"
|
|
|
68 |
except Exception as e:
|
69 |
raise gr.Error(e)
|
70 |
|
71 |
+
return f"{texts}{images}"
|
72 |
+
#return f"{'<hr>'.join(list(reversed(text_values))[1:])}{images}"
|
73 |
|
74 |
gr.ChatInterface(
|
75 |
fn=chat,
|