Private
Public Access
0
0

refactor(ai_client): _send_anthropic_result() returns Result[str]

This commit is contained in:
2026-06-12 18:41:15 -04:00
parent 943a21bfdc
commit f840dbe85e
+3 -3
View File
@@ -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