refactor(a2a_agent): remove commented-out code and improve clarity
This commit is contained in:
parent
3622260c11
commit
18c6865926
@ -202,7 +202,6 @@ class A2ACustomAgent(BaseAgent):
|
|||||||
print("Agent supports streaming, using streaming API")
|
print("Agent supports streaming, using streaming API")
|
||||||
# Process with streaming
|
# Process with streaming
|
||||||
try:
|
try:
|
||||||
# Criar a requisição usando o método correto de tasks/sendSubscribe
|
|
||||||
request = SendTaskStreamingRequest(
|
request = SendTaskStreamingRequest(
|
||||||
method="tasks/sendSubscribe", params=task_params
|
method="tasks/sendSubscribe", params=task_params
|
||||||
)
|
)
|
||||||
@ -217,7 +216,6 @@ class A2ACustomAgent(BaseAgent):
|
|||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
# Processar manualmente a resposta SSE
|
|
||||||
async for line in response.aiter_lines():
|
async for line in response.aiter_lines():
|
||||||
if line.startswith("data:"):
|
if line.startswith("data:"):
|
||||||
data = line[5:].strip()
|
data = line[5:].strip()
|
||||||
@ -279,8 +277,6 @@ class A2ACustomAgent(BaseAgent):
|
|||||||
print(
|
print(
|
||||||
f"Error in direct streaming: {str(stream_error)}, falling back to regular API"
|
f"Error in direct streaming: {str(stream_error)}, falling back to regular API"
|
||||||
)
|
)
|
||||||
# If streaming fails, fall back to regular API
|
|
||||||
# Criar a requisição usando o método correto de tasks/send
|
|
||||||
fallback_request = SendTaskRequest(
|
fallback_request = SendTaskRequest(
|
||||||
method="tasks/send", params=task_params
|
method="tasks/send", params=task_params
|
||||||
)
|
)
|
||||||
@ -340,7 +336,6 @@ class A2ACustomAgent(BaseAgent):
|
|||||||
print("Agent does not support streaming, using regular API")
|
print("Agent does not support streaming, using regular API")
|
||||||
# Process with regular request
|
# Process with regular request
|
||||||
try:
|
try:
|
||||||
# Criar a requisição usando o método correto de tasks/send
|
|
||||||
request = SendTaskRequest(method="tasks/send", params=task_params)
|
request = SendTaskRequest(method="tasks/send", params=task_params)
|
||||||
|
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
|
Loading…
Reference in New Issue
Block a user