diff --git a/pipelines/google/google_gemini.py b/pipelines/google/google_gemini.py index fdb97fa..0c1c1f9 100644 --- a/pipelines/google/google_gemini.py +++ b/pipelines/google/google_gemini.py @@ -4,7 +4,7 @@ author_url: https://github.com/owndev/ project_url: https://github.com/owndev/Open-WebUI-Functions funding_url: https://github.com/sponsors/owndev -version: 1.9.0 +version: 1.9.1 required_open_webui_version: 0.6.26 license: Apache License 2.0 description: Highly optimized Google Gemini pipeline with advanced image generation capabilities, intelligent compression, and streamlined processing workflows. @@ -1786,8 +1786,6 @@ async def _process_grounding_metadata( grounding_metadata_list: List[types.GroundingMetadata], text: str, __event_emitter__: Callable, - *, - emit_replace: bool = True, ): """Process and emit grounding metadata events.""" grounding_chunks = [] @@ -1855,17 +1853,8 @@ async def _process_grounding_metadata( cited_chunks.append(text_bytes[last_byte_index:].decode(ENCODING)) replaced_text = "".join(cited_chunks) - if emit_replace: - await __event_emitter__( - { - "type": "replace", - "data": {"content": replaced_text}, - } - ) - # Return the transformed text when requested by caller - if not emit_replace: - return replaced_text if replaced_text is not None else text + return replaced_text if replaced_text is not None else text async def _handle_streaming_response( self, @@ -2003,12 +1992,10 @@ async def emit_chat_event(event_type: str, data: Dict[str, Any]) -> None: # After processing all chunks, handle grounding data final_answer_text = "".join(answer_chunks) if grounding_metadata_list and __event_emitter__: - # Don't emit replace here; we'll compose final content below cited = await self._process_grounding_metadata( grounding_metadata_list, final_answer_text, __event_emitter__, - emit_replace=False, ) final_answer_text = cited or final_answer_text @@ -2386,7 +2373,6 @@ async def get_response(): grounding_metadata_list, final_answer, __event_emitter__, - emit_replace=False, ) final_answer = cited or final_answer