diff --git a/src/ai_client.py b/src/ai_client.py index f70560b3..d85bbd4d 100644 --- a/src/ai_client.py +++ b/src/ai_client.py @@ -1522,14 +1522,14 @@ def _get_gemini_history_list(chat: Any | None) -> list[Any]: return cast(list[Any], chat.get_history()) return [] -def _send_gemini(md_content: str, user_message: str, base_dir: str, +def _send_gemini_result(md_content: str, user_message: str, base_dir: str, file_items: list[dict[str, Any]] | None = None, discussion_history: str = "", pre_tool_callback: Optional[Callable[[str, str, Optional[Callable[[str], str]]], Optional[str]]] = None, qa_callback: Optional[Callable[[str], str]] = None, enable_tools: bool = True, stream_callback: Optional[Callable[[str], None]] = None, - patch_callback: Optional[Callable[[str, str], Optional[str]]] = None) -> str: + patch_callback: Optional[Callable[[str, str], Optional[str]]] = None) -> Result[str]: """ [C: src/ai_server.py:_handle_send, tests/test_tier4_interceptor.py:test_gemini_provider_passes_qa_callback_to_run_script] """ @@ -1753,10 +1753,10 @@ def _send_gemini(md_content: str, user_message: str, base_dir: str, payload = f_resps res = "\n\n".join(all_text) if all_text else "(No text returned)" if monitor.enabled: monitor.end_component("ai_client._send_gemini") - return res + return Result(data=res) except Exception as e: if monitor.enabled: monitor.end_component("ai_client._send_gemini") - raise _classify_gemini_error(e) from e + return Result(data="", errors=[_classify_gemini_error(e, source="ai_client.gemini")]) def _send_gemini_cli(md_content: str, user_message: str, base_dir: str, file_items: list[dict[str, Any]] | None = None,