From f840dbe85ee55310b26085e2973425dc27ae23b2 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Fri, 12 Jun 2026 18:41:15 -0400 Subject: [PATCH] refactor(ai_client): _send_anthropic_result() returns Result[str] --- src/ai_client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ai_client.py b/src/ai_client.py index 6db942b6..1f2a2850 100644 --- a/src/ai_client.py +++ b/src/ai_client.py @@ -1276,7 +1276,7 @@ def _repair_anthropic_history(history: list[dict[str, Any]]) -> None: ], }) -def _send_anthropic(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, stream_callback: Optional[Callable[[str], None]] = None, patch_callback: Optional[Callable[[str, str], Optional[str]]] = None) -> str: +def _send_anthropic_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, stream_callback: Optional[Callable[[str], None]] = None, patch_callback: Optional[Callable[[str, str], Optional[str]]] = None) -> Result[str]: """ [C: src/ai_server.py:_handle_send] """ @@ -1449,13 +1449,13 @@ def _send_anthropic(md_content: str, user_message: str, base_dir: str, file_item final_text = "\n\n".join(all_text_parts) res = final_text if final_text.strip() else "(No text returned by the model)" if monitor.enabled: monitor.end_component("ai_client._send_anthropic") - return res + return Result(data=res) except ProviderError: if monitor.enabled: monitor.end_component("ai_client._send_anthropic") raise except Exception as exc: if monitor.enabled: monitor.end_component("ai_client._send_anthropic") - raise _classify_anthropic_error(exc) from exc + return Result(data="", errors=[_classify_anthropic_error(exc, source="ai_client.anthropic")]) #endregion: Anthropic Provider