MaxKB/apps/chat/api/chat_api.py
shaohuzhang1 7f9caca5c7
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
feat: historical conversation (#3358)
2025-06-23 21:28:10 +08:00

62 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# coding=utf-8
"""
@project: MaxKB
@Author虎虎
@file chat_api.py
@date2025/6/9 15:23
@desc:
"""
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import OpenApiParameter
from chat.serializers.chat import ChatMessageSerializers
from chat.serializers.chat_record import HistoryChatRecordModel
from common.mixins.api_mixin import APIMixin
from common.result import ResultSerializer, ResultPageSerializer
class ChatAPI(APIMixin):
@staticmethod
def get_parameters():
return [OpenApiParameter(
name="chat_id",
description="对话id",
type=OpenApiTypes.STR,
location='path',
required=True,
)]
@staticmethod
def get_request():
return ChatMessageSerializers
class ApplicationCreateResponse(ResultSerializer):
def get_data(self):
return HistoryChatRecordModel(many=True)
class PageApplicationCreateResponse(ResultPageSerializer):
def get_data(self):
return HistoryChatRecordModel(many=True)
class HistoricalConversationAPI(APIMixin):
@staticmethod
def get_parameters():
return []
@staticmethod
def get_response():
return ApplicationCreateResponse
class PageHistoricalConversationAPI(APIMixin):
@staticmethod
def get_parameters():
return []
@staticmethod
def get_response():
return PageApplicationCreateResponse