Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
George Burton committed Sep 5, 2024
1 parent d6a94a3 commit 9f0d60a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions django_app/redbox_app/redbox_core/consumers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
from asyncio import CancelledError
from collections.abc import Mapping, Sequence
from typing import Any
from typing import Any, ClassVar
from uuid import UUID

from channels.db import database_sync_to_async
Expand Down Expand Up @@ -33,10 +33,9 @@
logger.info("WEBSOCKET_SCHEME is: %s", settings.WEBSOCKET_SCHEME)



class ChatConsumer(AsyncWebsocketConsumer):
full_reply = []
citations = []
full_reply: ClassVar = []
citations: ClassVar = []
route = None
metadata: MetadataDetail = MetadataDetail()
redbox = Redbox(env=Settings(), debug=True)
Expand Down Expand Up @@ -97,9 +96,13 @@ async def llm_conversation(self, selected_files: Sequence[File], session: Chat,
)

try:

message = await self.save_message(
session, "".join(self.full_reply), ChatRoleEnum.ai, sources=self.citations, route=self.route, metadata=self.metadata
session,
"".join(self.full_reply),
ChatRoleEnum.ai,
sources=self.citations,
route=self.route,
metadata=self.metadata,
)
await self.send_to_client("end", {"message_id": message.id, "title": title, "session_id": session.id})

Expand Down Expand Up @@ -209,9 +212,6 @@ async def handle_documents(self, response: ClientResponse) -> Sequence[tuple[Fil
files = File.objects.filter(original_file__in=s3_keys)

async for file in files:
await self.send_to_client(
"source", {"url": str(file.url), "original_file_name": file.original_file_name}
)
await self.send_to_client("source", {"url": str(file.url), "original_file_name": file.original_file_name})
for file in files:
self.citations.append((file, [doc for doc in response.data if doc.s3_key == file.unique_name]))

0 comments on commit 9f0d60a

Please sign in to comment.