Skip to content

Commit 21a0973

Browse files
remove pylint issues
1 parent ea3e081 commit 21a0973

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/backend/v3/callbacks/response_handlers.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,23 @@
1717
WebsocketMessageType,
1818
)
1919

20+
2021
def clean_citations(text: str) -> str:
2122
"""Remove citation markers from agent responses while preserving formatting."""
2223
if not text:
2324
return text
24-
25+
2526
# Remove citation patterns like [9:0|source], [9:1|source], etc.
2627
text = re.sub(r'\[\d+:\d+\|source\]', '', text)
27-
28-
#Remove other common citation pattern
28+
29+
# Remove other common citation pattern
2930
text = re.sub(r'\[\s*source\s*\]', '', text, flags=re.IGNORECASE)
3031
text = re.sub(r'\[\d+\]', '', text)
3132
text = re.sub(r'【[^】]*】', '', text) # Unicode brackets
3233
text = re.sub(r'\(source:[^)]*\)', '', text, flags=re.IGNORECASE)
3334
text = re.sub(r'\[source:[^\]]*\]', '', text, flags=re.IGNORECASE)
34-
35+
36+
3537
return text
3638

3739
def agent_response_callback(message: ChatMessageContent, user_id: str = None) -> None:
@@ -96,7 +98,7 @@ async def streaming_agent_response_callback(
9698
try:
9799
message = AgentMessageStreaming(
98100
agent_name=streaming_message.name or "Unknown Agent",
99-
content=clean_citations(streaming_message.content),
101+
content=clean_citations(streaming_message.content) or "",
100102
is_final=is_final,
101103
)
102104
await connection_config.send_status_update_async(

0 commit comments

Comments
 (0)