Update app.py
Browse files
app.py
CHANGED
@@ -119,6 +119,9 @@ def upload_attachment(cookie ,organization_id,file_path):
|
|
119 |
|
120 |
|
121 |
def request_to_v2(message, cookie, user_id,attachment=None,context=[]):
|
|
|
|
|
|
|
122 |
## 是否加入文件
|
123 |
# Upload attachment if provided
|
124 |
attachment = attachment.name
|
@@ -129,7 +132,11 @@ def request_to_v2(message, cookie, user_id,attachment=None,context=[]):
|
|
129 |
attachments = [attachment_response]
|
130 |
print(f"attachment_response:{attachment_response}")
|
131 |
else:
|
132 |
-
|
|
|
|
|
|
|
|
|
133 |
|
134 |
# Ensure attachments is an empty list when no attachment is provided
|
135 |
if not attachment:
|
|
|
119 |
|
120 |
|
121 |
def request_to_v2(message, cookie, user_id,attachment=None,context=[]):
|
122 |
+
context = [message]
|
123 |
+
|
124 |
+
|
125 |
## 是否加入文件
|
126 |
# Upload attachment if provided
|
127 |
attachment = attachment.name
|
|
|
132 |
attachments = [attachment_response]
|
133 |
print(f"attachment_response:{attachment_response}")
|
134 |
else:
|
135 |
+
bots = {"Error: Invalid file format. Please try again."}
|
136 |
+
print(bots)
|
137 |
+
context += [bots]
|
138 |
+
responses = [(u, b) for u, b in zip(context[::2], context[1::2])]
|
139 |
+
return responses, context
|
140 |
|
141 |
# Ensure attachments is an empty list when no attachment is provided
|
142 |
if not attachment:
|