Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -594,6 +594,7 @@ class GrokApiClient:
|
|
594 |
last_content = ''
|
595 |
message_length = 0
|
596 |
convert_to_file = False
|
|
|
597 |
search = request["model"] in ['grok-2-search', 'grok-3-search']
|
598 |
|
599 |
# 移除<think>标签及其内容和base64图片
|
@@ -643,8 +644,8 @@ class GrokApiClient:
|
|
643 |
|
644 |
|
645 |
text_content = process_content(current.get("content", ""))
|
646 |
-
if is_last_message:
|
647 |
-
|
648 |
continue
|
649 |
if text_content or (is_last_message and file_attachments):
|
650 |
if role == last_role and text_content:
|
@@ -661,6 +662,7 @@ class GrokApiClient:
|
|
661 |
file_id = self.upload_base64_file(messages, request["model"])
|
662 |
if file_id:
|
663 |
file_attachments.insert(0, file_id)
|
|
|
664 |
|
665 |
return {
|
666 |
"temporary": CONFIG["API"].get("IS_TEMP_CONVERSATION", False),
|
|
|
594 |
last_content = ''
|
595 |
message_length = 0
|
596 |
convert_to_file = False
|
597 |
+
last_message_content = ''
|
598 |
search = request["model"] in ['grok-2-search', 'grok-3-search']
|
599 |
|
600 |
# 移除<think>标签及其内容和base64图片
|
|
|
644 |
|
645 |
|
646 |
text_content = process_content(current.get("content", ""))
|
647 |
+
if is_last_message and convert_to_file:
|
648 |
+
last_message_content = f"{role.upper()}: {text_content or '[图片]'}\n"
|
649 |
continue
|
650 |
if text_content or (is_last_message and file_attachments):
|
651 |
if role == last_role and text_content:
|
|
|
662 |
file_id = self.upload_base64_file(messages, request["model"])
|
663 |
if file_id:
|
664 |
file_attachments.insert(0, file_id)
|
665 |
+
messages = last_message_content.strip()
|
666 |
|
667 |
return {
|
668 |
"temporary": CONFIG["API"].get("IS_TEMP_CONVERSATION", False),
|