Merge PR #7402 for gate
This commit is contained in:
commit
2a804ae38d
4 files changed
+231
-12
No files matched your search
+5
-5
@@ -27688,13 +27688,13 @@ def _handle_handoff_summary(handler, body):
|
||||
if not is_chatgpt_codex:
|
||||
codex_kwargs["max_output_tokens"] = max_tokens
|
||||
resp = agent._run_codex_stream(codex_kwargs)
|
||||
assistant_message, _ = agent._normalize_codex_response(resp)
|
||||
result["text"] = str((assistant_message.content or "") if assistant_message else "").strip()
|
||||
normalized = agent._get_transport("codex_responses").normalize_response(resp)
|
||||
result["text"] = str((normalized.content or "") if normalized else "").strip()
|
||||
result["incomplete"] = _summary_output_incomplete(result["text"])
|
||||
return result
|
||||
|
||||
if getattr(agent, "api_mode", "") == "anthropic_messages":
|
||||
from agent.anthropic_adapter import build_anthropic_kwargs, normalize_anthropic_response
|
||||
from agent.anthropic_adapter import build_anthropic_kwargs
|
||||
|
||||
ant_kwargs = build_anthropic_kwargs(
|
||||
model=agent.model,
|
||||
@@ -27707,11 +27707,11 @@ def _handle_handoff_summary(handler, body):
|
||||
base_url=getattr(agent, "_anthropic_base_url", None),
|
||||
)
|
||||
resp = agent._anthropic_messages_create(ant_kwargs)
|
||||
assistant_message, _ = normalize_anthropic_response(
|
||||
normalized = agent._get_transport().normalize_response(
|
||||
resp,
|
||||
strip_tool_prefix=getattr(agent, "_is_anthropic_oauth", False),
|
||||
)
|
||||
result["text"] = str((assistant_message.content or "") if assistant_message else "").strip()
|
||||
result["text"] = str((normalized.content or "") if normalized else "").strip()
|
||||
result["incomplete"] = _summary_output_incomplete(result["text"])
|
||||
return result
|
||||
|
||||
|
||||
+5
-5
@@ -4459,12 +4459,12 @@ def generate_title_raw_via_agent(agent, user_text: str, assistant_text: str) ->
|
||||
if 'max_output_tokens' in codex_kwargs:
|
||||
codex_kwargs['max_output_tokens'] = max_tokens
|
||||
resp = agent._run_codex_stream(codex_kwargs)
|
||||
assistant_message, _ = agent._normalize_codex_response(resp)
|
||||
raw = (assistant_message.content or '') if assistant_message else ''
|
||||
normalized = agent._get_transport('codex_responses').normalize_response(resp)
|
||||
raw = (normalized.content or '') if normalized else ''
|
||||
if not raw:
|
||||
empty_status = 'llm_empty'
|
||||
elif getattr(agent, 'api_mode', '') == 'anthropic_messages':
|
||||
from agent.anthropic_adapter import build_anthropic_kwargs, normalize_anthropic_response
|
||||
from agent.anthropic_adapter import build_anthropic_kwargs
|
||||
ant_kwargs = build_anthropic_kwargs(
|
||||
model=agent.model,
|
||||
messages=api_messages,
|
||||
@@ -4476,10 +4476,10 @@ def generate_title_raw_via_agent(agent, user_text: str, assistant_text: str) ->
|
||||
base_url=getattr(agent, '_anthropic_base_url', None),
|
||||
)
|
||||
resp = agent._anthropic_messages_create(ant_kwargs)
|
||||
assistant_message, _ = normalize_anthropic_response(
|
||||
normalized = agent._get_transport().normalize_response(
|
||||
resp, strip_tool_prefix=getattr(agent, '_is_anthropic_oauth', False)
|
||||
)
|
||||
raw = (assistant_message.content or '') if assistant_message else ''
|
||||
raw = (normalized.content or '') if normalized else ''
|
||||
if not raw:
|
||||
empty_status = 'llm_empty'
|
||||
else:
|
||||
|
||||
Reference in new issue
Block a user