Private
Public Access
refactor(ai_client): _send_gemini_result() returns Result[str]
This commit is contained in:
+4
-4
@@ -1522,14 +1522,14 @@ def _get_gemini_history_list(chat: Any | None) -> list[Any]:
|
|||||||
return cast(list[Any], chat.get_history())
|
return cast(list[Any], chat.get_history())
|
||||||
return []
|
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,
|
file_items: list[dict[str, Any]] | None = None,
|
||||||
discussion_history: str = "",
|
discussion_history: str = "",
|
||||||
pre_tool_callback: Optional[Callable[[str, str, Optional[Callable[[str], str]]], Optional[str]]] = None,
|
pre_tool_callback: Optional[Callable[[str, str, Optional[Callable[[str], str]]], Optional[str]]] = None,
|
||||||
qa_callback: Optional[Callable[[str], str]] = None,
|
qa_callback: Optional[Callable[[str], str]] = None,
|
||||||
enable_tools: bool = True,
|
enable_tools: bool = True,
|
||||||
stream_callback: Optional[Callable[[str], None]] = None,
|
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]
|
[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
|
payload = f_resps
|
||||||
res = "\n\n".join(all_text) if all_text else "(No text returned)"
|
res = "\n\n".join(all_text) if all_text else "(No text returned)"
|
||||||
if monitor.enabled: monitor.end_component("ai_client._send_gemini")
|
if monitor.enabled: monitor.end_component("ai_client._send_gemini")
|
||||||
return res
|
return Result(data=res)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if monitor.enabled: monitor.end_component("ai_client._send_gemini")
|
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,
|
def _send_gemini_cli(md_content: str, user_message: str, base_dir: str,
|
||||||
file_items: list[dict[str, Any]] | None = None,
|
file_items: list[dict[str, Any]] | None = None,
|
||||||
|
|||||||
Reference in New Issue
Block a user