mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-08 20:25:19 +02:00
Merge pull request #214 from Utkarsh-Patel-13/fix/chat-optimization
Removed deprecated streaming methods.
This commit is contained in:
commit
50f84e1d0a
2 changed files with 2 additions and 46 deletions
|
|
@ -810,8 +810,7 @@ async def fetch_relevant_documents(
|
|||
|
||||
# After all sources are collected and deduplicated, stream them
|
||||
if streaming_service and writer:
|
||||
streaming_service.only_update_sources(deduplicated_sources)
|
||||
writer({"yield_value": streaming_service._format_annotations()})
|
||||
writer({"yield_value": streaming_service.format_sources_delta(deduplicated_sources)})
|
||||
|
||||
# Deduplicate raw documents based on chunk_id or content
|
||||
seen_chunk_ids = set()
|
||||
|
|
|
|||
|
|
@ -175,47 +175,4 @@ class StreamingService:
|
|||
"totalTokens": total_tokens
|
||||
}
|
||||
}
|
||||
return f'd:{json.dumps(completion_data)}\n'
|
||||
|
||||
|
||||
# DEPRECATED METHODS: Keep for backward compatibility but mark as deprecated
|
||||
def only_update_terminal(self, text: str, message_type: str = "info") -> str:
|
||||
"""
|
||||
DEPRECATED: Use format_terminal_info_delta() instead for optimal streaming
|
||||
"""
|
||||
self.message_annotations[0]["content"].append({
|
||||
"id": self.terminal_idx,
|
||||
"text": text,
|
||||
"type": message_type
|
||||
})
|
||||
self.terminal_idx += 1
|
||||
return self.message_annotations
|
||||
|
||||
def only_update_sources(self, sources: List[Dict[str, Any]]) -> str:
|
||||
"""
|
||||
DEPRECATED: Use format_sources_delta() instead for optimal streaming
|
||||
"""
|
||||
self.message_annotations[1]["content"] = sources
|
||||
return self.message_annotations
|
||||
|
||||
def only_update_answer(self, answer: List[str]) -> str:
|
||||
"""
|
||||
DEPRECATED: Use format_answer_delta() or format_answer_annotation() instead for optimal streaming
|
||||
"""
|
||||
self.message_annotations[2]["content"] = answer
|
||||
return self.message_annotations
|
||||
|
||||
def only_update_further_questions(self, further_questions: List[Dict[str, Any]]) -> str:
|
||||
"""
|
||||
DEPRECATED: Use format_further_questions_delta() instead for optimal streaming
|
||||
|
||||
Args:
|
||||
further_questions: List of further question objects with id and question fields
|
||||
|
||||
Returns:
|
||||
str: The updated annotations
|
||||
"""
|
||||
self.message_annotations[3]["content"] = further_questions
|
||||
return self.message_annotations
|
||||
|
||||
|
||||
return f'd:{json.dumps(completion_data)}\n'
|
||||
Loading…
Add table
Add a link
Reference in a new issue