fix lint on backend

This commit is contained in:
abhi1992002
2026-02-06 10:17:22 +05:30
parent 4b036bfe22
commit 090c576b3e
3 changed files with 5 additions and 5 deletions

View File

@@ -138,6 +138,7 @@ class StreamToolOutputAvailable(StreamBaseResponse):
def to_sse(self) -> str:
"""Convert to SSE format, excluding non-spec fields."""
import json
data = {
"type": self.type.value,
"toolCallId": self.toolCallId,
@@ -145,6 +146,7 @@ class StreamToolOutputAvailable(StreamBaseResponse):
}
return f"data: {json.dumps(data)}\n\n"
# ========== Other ==========

View File

@@ -37,7 +37,6 @@ from .tools.models import (
OperationInProgressResponse,
OperationPendingResponse,
OperationStartedResponse,
ResponseType,
SetupRequirementsResponse,
UnderstandingUpdatedResponse,
)

View File

@@ -351,7 +351,9 @@ async def stream_chat_completion(
retry_count: int = 0,
session: ChatSession | None = None,
context: dict[str, str] | None = None, # {url: str, content: str}
_continuation_message_id: str | None = None, # Internal: reuse message ID for tool call continuations
_continuation_message_id: (
str | None
) = None, # Internal: reuse message ID for tool call continuations
) -> AsyncGenerator[StreamBaseResponse, None]:
"""Main entry point for streaming chat completions with database handling.
@@ -480,13 +482,10 @@ async def stream_chat_completion(
# Generate unique IDs for AI SDK protocol
import uuid as uuid_module
# Reuse message ID for continuations (tool call follow-ups) to avoid duplicate messages
is_continuation = _continuation_message_id is not None
message_id = _continuation_message_id or str(uuid_module.uuid4())
text_block_id = str(uuid_module.uuid4())
# Only yield message start for the initial call, not for continuations
# This prevents the AI SDK from creating duplicate message objects
if not is_continuation:
yield StreamStart(messageId=message_id)