Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order chat by date #436

Merged
merged 2 commits into from
May 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions django_app/redbox_app/redbox_core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
from django.urls import reverse
from django.utils.datastructures import MultiValueDictKeyError
from django.views.decorators.http import require_http_methods
from requests.exceptions import HTTPError
brunns marked this conversation as resolved.
Show resolved Hide resolved
from yarl import URL

from redbox_app.redbox_core.client import CoreApiClient
from redbox_app.redbox_core.models import (
ChatHistory,
Expand All @@ -20,8 +23,6 @@
ProcessingStatusEnum,
User,
)
from requests.exceptions import HTTPError
from yarl import URL

logger = logging.getLogger(__name__)
core_api = CoreApiClient(host=settings.CORE_API_HOST, port=settings.CORE_API_PORT)
Expand Down Expand Up @@ -176,7 +177,7 @@ def chats_view(request: HttpRequest, chat_id: uuid = None):

messages = []
if chat_id:
messages = ChatMessage.objects.filter(chat_history__id=chat_id)
messages = ChatMessage.objects.filter(chat_history__id=chat_id).order_by("created_at")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

endpoint = URL.build(scheme="ws", host=request.get_host(), path=r"/ws/chat/")
context = {
"chat_id": chat_id,
Expand Down
Loading