From f21fea41b4e4f5bda40e2caca0c8c3cac0f906e9 Mon Sep 17 00:00:00 2001 From: liunux4odoo Date: Tue, 25 Jul 2023 08:53:28 +0800 Subject: [PATCH] =?UTF-8?q?bug=20fix:=20api.py=E4=B8=AD,=E6=89=80=E6=9C=89?= =?UTF-8?q?chat=E6=8E=A5=E5=8F=A3=E7=9A=84=E5=8F=82=E6=95=B0history,?= =?UTF-8?q?=E5=85=B6=E5=85=83=E7=B4=A0=E5=BA=94=E6=94=AF=E6=8C=81None?= =?UTF-8?q?=EF=BC=8C=E6=96=B9=E4=BE=BF=E5=85=B6=E4=BB=96=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E3=80=82=20=E5=90=A6=E5=88=99=E4=BB=A5histor?= =?UTF-8?q?y=3D[[None,'some=20thing']]=E8=B0=83=E7=94=A8=E6=97=B6=E4=BC=9A?= =?UTF-8?q?=E8=BF=94=E5=9B=9E422=E9=94=99=E8=AF=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api.py b/api.py index 5c348a9..a8b29d8 100644 --- a/api.py +++ b/api.py @@ -55,7 +55,7 @@ class ListDocsResponse(BaseResponse): class ChatMessage(BaseModel): question: str = pydantic.Field(..., description="Question text") response: str = pydantic.Field(..., description="Response text") - history: List[List[str]] = pydantic.Field(..., description="History text") + history: List[List[Optional[str]]] = pydantic.Field(..., description="History text") source_documents: List[str] = pydantic.Field( ..., description="List of source documents and their scores" ) @@ -303,7 +303,7 @@ async def update_doc( async def local_doc_chat( knowledge_base_id: str = Body(..., description="Knowledge Base Name", example="kb1"), question: str = Body(..., description="Question", example="工伤保险是什么?"), - history: List[List[str]] = Body( + history: List[List[Optional[str]]] = Body( [], description="History of previous questions and answers", example=[ @@ -344,7 +344,7 @@ async def local_doc_chat( async def bing_search_chat( question: str = Body(..., description="Question", example="工伤保险是什么?"), - history: Optional[List[List[str]]] = Body( + history: Optional[List[List[Optional[str]]]] = Body( [], description="History of previous questions and answers", example=[ @@ -374,7 +374,7 @@ async def bing_search_chat( async def chat( question: str = Body(..., description="Question", example="工伤保险是什么?"), - history: Optional[List[List[str]]] = Body( + history: Optional[List[List[Optional[str]]]] = Body( [], description="History of previous questions and answers", example=[