Spaces:
Running
Running
Commit
·
765355f
1
Parent(s):
f7f47ac
fixed vertex mode cot handling
Browse files
app/message_processing.py
CHANGED
@@ -223,11 +223,8 @@ def parse_gemini_response_for_reasoning_and_content(gemini_response_candidate: A
|
|
223 |
# Check if gemini_response_candidate itself resembles a part_item with 'thought'
|
224 |
# This might be relevant for direct part processing in stream chunks if candidate structure is shallow
|
225 |
candidate_part_text = ""
|
226 |
-
is_candidate_itself_thought = False
|
227 |
if hasattr(gemini_response_candidate, 'text') and gemini_response_candidate.text is not None:
|
228 |
candidate_part_text = str(gemini_response_candidate.text)
|
229 |
-
if hasattr(gemini_response_candidate, 'thought') and gemini_response_candidate.thought is True:
|
230 |
-
is_candidate_itself_thought = True
|
231 |
|
232 |
# Primary logic: Iterate through parts of the candidate's content object
|
233 |
gemini_candidate_content = None
|
@@ -244,9 +241,7 @@ def parse_gemini_response_for_reasoning_and_content(gemini_response_candidate: A
|
|
244 |
reasoning_text_parts.append(part_text)
|
245 |
else:
|
246 |
normal_text_parts.append(part_text)
|
247 |
-
|
248 |
-
reasoning_text_parts.append(candidate_part_text)
|
249 |
-
elif candidate_part_text: # Candidate had text but no parts and was not a thought itself
|
250 |
normal_text_parts.append(candidate_part_text)
|
251 |
# If no parts and no direct text on candidate, both lists remain empty.
|
252 |
|
@@ -255,7 +250,7 @@ def parse_gemini_response_for_reasoning_and_content(gemini_response_candidate: A
|
|
255 |
normal_text_parts.append(str(gemini_candidate_content.text))
|
256 |
# Fallback if no .content but direct .text on candidate
|
257 |
elif hasattr(gemini_response_candidate, 'text') and gemini_response_candidate.text is not None and not gemini_candidate_content:
|
258 |
-
|
259 |
|
260 |
return "".join(reasoning_text_parts), "".join(normal_text_parts)
|
261 |
|
|
|
223 |
# Check if gemini_response_candidate itself resembles a part_item with 'thought'
|
224 |
# This might be relevant for direct part processing in stream chunks if candidate structure is shallow
|
225 |
candidate_part_text = ""
|
|
|
226 |
if hasattr(gemini_response_candidate, 'text') and gemini_response_candidate.text is not None:
|
227 |
candidate_part_text = str(gemini_response_candidate.text)
|
|
|
|
|
228 |
|
229 |
# Primary logic: Iterate through parts of the candidate's content object
|
230 |
gemini_candidate_content = None
|
|
|
241 |
reasoning_text_parts.append(part_text)
|
242 |
else:
|
243 |
normal_text_parts.append(part_text)
|
244 |
+
if candidate_part_text: # Candidate had text but no parts and was not a thought itself
|
|
|
|
|
245 |
normal_text_parts.append(candidate_part_text)
|
246 |
# If no parts and no direct text on candidate, both lists remain empty.
|
247 |
|
|
|
250 |
normal_text_parts.append(str(gemini_candidate_content.text))
|
251 |
# Fallback if no .content but direct .text on candidate
|
252 |
elif hasattr(gemini_response_candidate, 'text') and gemini_response_candidate.text is not None and not gemini_candidate_content:
|
253 |
+
normal_text_parts.append(str(gemini_response_candidate.text))
|
254 |
|
255 |
return "".join(reasoning_text_parts), "".join(normal_text_parts)
|
256 |
|