feat: stabilize rag chat conversations and auto title sync
This commit is contained in:
@@ -15,6 +15,7 @@ from fastapi_modules.fastapi_leaudit.domian.Dto.ragChatDto import (
|
||||
RagConversationRenameDTO,
|
||||
RagChatSendMessageDTO,
|
||||
RagMessageFeedbackDTO,
|
||||
RagStopMessageDTO,
|
||||
)
|
||||
from fastapi_modules.fastapi_leaudit.domian.Dto.ragDatasetDto import (
|
||||
RagDatasetBatchDocumentDeleteDTO,
|
||||
@@ -479,6 +480,17 @@ class RagChatController(BaseController):
|
||||
headers={"Cache-Control": "no-cache", "X-Accel-Buffering": "no", "Connection": "keep-alive"},
|
||||
)
|
||||
|
||||
@self.router.post("/chat/messages/{MessageId}/stop", response_model=Result[RagOperationResultVO])
|
||||
async def StopMessage(
|
||||
MessageId: str,
|
||||
Body: RagStopMessageDTO | None = None,
|
||||
payload: dict[str, Any] = Depends(verify_access_token),
|
||||
):
|
||||
if not await self._check_permission(int(payload["user_id"]), [self._PERMISSIONS["chat_use"]]):
|
||||
return JSONResponse(status_code=403, content={"code": 403, "msg": "当前用户没有停止 RAG 对话权限", "data": None})
|
||||
data = await self.RagChatService.StopMessage(int(payload["user_id"]), MessageId, Body)
|
||||
return Result.success(data=data)
|
||||
|
||||
@self.router.get("/chat/conversations", response_model=Result[RagConversationPageVO])
|
||||
async def GetConversations(
|
||||
appId: int | None = Query(None, description="聊天应用ID"),
|
||||
|
||||
Reference in New Issue
Block a user