fixing api usage for gemini

This commit is contained in:
2026-02-21 22:19:46 -05:00
parent a6d7127d98
commit f126cdcb21
3 changed files with 9 additions and 14 deletions

View File

@@ -506,20 +506,10 @@ def _send_gemini(md_content: str, user_message: str, base_dir: str, file_items:
if not function_responses:
break
# Refresh file context after tool calls and inject as a text part
# Refresh file context after tool calls locally, but DO NOT inject as text part into Gemini.
# Gemini strictly expects only function_responses in this array.
if file_items:
file_items = _reread_file_items(file_items)
refreshed_ctx = _build_file_context_text(file_items)
if refreshed_ctx:
refreshed_text = (
"[FILES UPDATED — current contents below. "
"Do NOT re-read these files with PowerShell.]\n\n"
+ refreshed_ctx
)
if hasattr(types.Part, "from_text"):
function_responses.append(types.Part.from_text(text=refreshed_text))
else:
function_responses.append(types.Part(text=refreshed_text))
_append_comms("OUT", "tool_result_send", {
"results": sent_results_log