Skip to content

Commit 82ac284

Browse files
committed
few small fixes
1 parent f75354a commit 82ac284

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

src/a2a/client/text_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ async def send_text_message(
9494
elif event.HasField('message'):
9595
response_parts.append(get_message_text(event.message))
9696
elif event.HasField('status_update'):
97-
if event.status_update.task_id:
97+
if not self._task_id and event.status_update.task_id:
9898
self._task_id = event.status_update.task_id
9999
if event.status_update.status.state in _TERMINAL_STATES:
100100
self._task_id = None

tests/client/test_text_client.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ async def create_stream(*args, **kwargs):
5555
resp0.task.id = 'task-1'
5656
yield resp0
5757

58-
# Event 1: direct message
58+
# Event 1: status update
5959
resp1 = StreamResponse()
60-
resp1.message.parts.append(Part(text='Hello'))
60+
resp1.status_update.status.message.parts.append(Part(text='Hello'))
6161
yield resp1
6262

6363
# Event 2: status update without message
@@ -87,20 +87,17 @@ async def create_stream(*args, **kwargs):
8787

8888

8989
@pytest.mark.asyncio
90-
async def test_send_text_message_custom_delimiter(
90+
async def test_send_text_message(
9191
text_client: TextClient, mock_client: AsyncMock
9292
) -> None:
9393
async def create_stream(*args, **kwargs):
9494
resp1 = StreamResponse()
9595
resp1.message.parts.append(Part(text='Hello'))
9696
yield resp1
97-
resp2 = StreamResponse()
98-
resp2.artifact_update.artifact.parts.append(Part(text='World'))
99-
yield resp2
10097

10198
mock_client.send_message.return_value = create_stream()
102-
response = await text_client.send_text_message('Hi', delimiter='\n')
103-
assert response == 'Hello\nWorld'
99+
response = await text_client.send_text_message('Hi')
100+
assert response == 'Hello'
104101

105102

106103
@pytest.mark.asyncio

0 commit comments

Comments
 (0)