Commit 4421d8f

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-06-17 10:38:25
fix(gemini): fix files uploading
1 parent 1617807
Changed files (1)
src
src/llm/gemini.py
@@ -281,7 +281,7 @@ async def gemini_nonstream(
         app = genai.Client(api_key=api_key, http_options=http_options)
         # Construct the request params
         if "contents" not in params and "conversations" in params:  # convert conversations to contents
-            params["contents"] = await get_conversation_contexts(client, params.pop("conversations"), ctx_format="gemini")
+            params["contents"] = await get_conversation_contexts(client, params.pop("conversations"), ctx_format="gemini", app=app)
         if clean_marks:
             clean_gemini_sourcemarks(params["contents"])
         tokens = await app.aio.models.count_tokens(model=params["model"], contents=params["contents"])  # type: ignore
@@ -327,7 +327,6 @@ async def gemini_nonstream(
 
 def parse_response(data: dict, *, append_grounding: bool = True) -> dict:
     """Parse gemini response, includes texts, image and websearch."""
-    logger.trace(data)
     parts = glom(data, "candidates.0.content.parts", default=[]) or []
     gemini_logging(parts)
     grounding_chunks = glom(data, "candidates.0.grounding_metadata.grounding_chunks", default=[]) or []