From f24d668bf321b5590245df18cf63359dc2662b28 Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 13 Sep 2024 10:18:36 +0300 Subject: [PATCH] refactor --- services/backend/services/message_service.py | 56 ++++++++++---------- services/backend/services/rag_service.py | 2 +- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/services/backend/services/message_service.py b/services/backend/services/message_service.py index 7bc6335..4841cc5 100644 --- a/services/backend/services/message_service.py +++ b/services/backend/services/message_service.py @@ -120,31 +120,31 @@ def get_message(conversation_id): return result, 200 - @staticmethod - def get_message_for_ml(conversation_id): - """ - Получает только сообщения и роли отправителей для заданного идентификатора беседы. - - :param conversation_id: Идентификатор беседы. - :return: Словарь с сообщениями, и ролями отправителей. - """ - - messages = MessageModel.query.filter(MessageModel.conversation_id.in_([conversation_id])).all() - - if not messages: - return [ - { - "text": None, - "role": None - } - ] - - formatted_messages = [ - { - "text": message.text, - "role": message.role, - } - for message in messages - ] - - return formatted_messages \ No newline at end of file + # @staticmethod + # def get_message_for_ml(conversation_id): + # """ + # Получает только сообщения и роли отправителей для заданного идентификатора беседы. + # + # :param conversation_id: Идентификатор беседы. + # :return: Словарь с сообщениями, и ролями отправителей. + # """ + # + # messages = MessageModel.query.filter(MessageModel.conversation_id.in_([conversation_id])).all() + # + # if not messages: + # return [ + # { + # "text": None, + # "role": None + # } + # ] + # + # formatted_messages = [ + # { + # "text": message.text, + # "role": message.role, + # } + # for message in messages + # ] + # + # return formatted_messages \ No newline at end of file diff --git a/services/backend/services/rag_service.py b/services/backend/services/rag_service.py index aba7c4d..0db93be 100644 --- a/services/backend/services/rag_service.py +++ b/services/backend/services/rag_service.py @@ -101,7 +101,7 @@ def run_question_task(conversation_id, question: str): } } - all_messages = MessageService.get_message_for_ml(conversation_id) + all_messages = MessageService.get_message(conversation_id) query = { "data": data,