Spaces:
Runtime error
Runtime error
Update PCAgent/chat.py
Browse files- PCAgent/chat.py +14 -4
PCAgent/chat.py
CHANGED
|
@@ -34,16 +34,26 @@ def add_response_old(role, prompt, chat_history, image=None):
|
|
| 34 |
new_chat_history = copy.deepcopy(chat_history)
|
| 35 |
if image:
|
| 36 |
base64_image = resize_encode_image(image)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
content = [
|
| 38 |
{
|
| 39 |
"type": "text",
|
| 40 |
"text": prompt
|
| 41 |
},
|
| 42 |
{
|
| 43 |
-
"type": "
|
| 44 |
-
"
|
| 45 |
-
"url": f"data:image/jpeg;base64,{base64_image}"
|
| 46 |
-
}
|
| 47 |
},
|
| 48 |
]
|
| 49 |
else:
|
|
|
|
| 34 |
new_chat_history = copy.deepcopy(chat_history)
|
| 35 |
if image:
|
| 36 |
base64_image = resize_encode_image(image)
|
| 37 |
+
# content = [
|
| 38 |
+
# {
|
| 39 |
+
# "type": "text",
|
| 40 |
+
# "text": prompt
|
| 41 |
+
# },
|
| 42 |
+
# {
|
| 43 |
+
# "type": "image_url",
|
| 44 |
+
# "image_url": {
|
| 45 |
+
# "url": f"data:image/jpeg;base64,{base64_image}"
|
| 46 |
+
# }
|
| 47 |
+
# },
|
| 48 |
+
# ]
|
| 49 |
content = [
|
| 50 |
{
|
| 51 |
"type": "text",
|
| 52 |
"text": prompt
|
| 53 |
},
|
| 54 |
{
|
| 55 |
+
"type": "image",
|
| 56 |
+
"image": f"file://{image}"
|
|
|
|
|
|
|
| 57 |
},
|
| 58 |
]
|
| 59 |
else:
|