Skip to content

Commit

Permalink
Fix messages being passed in conversations (SciPhi-AI#1726)
Browse files Browse the repository at this point in the history
  • Loading branch information
NolanTrem authored Dec 24, 2024
1 parent 8792d54 commit e0e0eaa
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions py/core/main/services/retrieval_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@
from core import R2RStreamingRAGAgent
from core.base import (
DocumentResponse,
EmbeddingPurpose,
GenerationConfig,
GraphSearchSettings,
Message,
R2RException,
RunManager,
SearchMode,
SearchSettings,
manage_run,
to_async_generator,
Expand Down Expand Up @@ -306,17 +303,15 @@ async def agent(

if conversation_id: # Fetch the existing conversation
try:
conversation = await self.providers.database.conversations_handler.get_conversations_overview(
offset=0,
limit=1,
conversation_ids=[conversation_id],
conversation_messages = await self.providers.database.conversations_handler.get_conversation(
conversation_id=conversation_id,
)
except Exception as e:
logger.error(f"Error fetching conversation: {str(e)}")

if conversation is not None:
if conversation_messages is not None:
messages_from_conversation: list[Message] = []
for message_response in conversation:
for message_response in conversation_messages:
if isinstance(message_response, MessageResponse):
messages_from_conversation.append(
message_response.message
Expand Down

0 comments on commit e0e0eaa

Please sign in to comment.