feat(rag): add temporary chat attachments

This commit is contained in:
wren
2026-05-25 15:37:37 +08:00
parent 0f385c9839
commit 75c077da77
16 changed files with 2257 additions and 16 deletions
@@ -0,0 +1,89 @@
from __future__ import annotations
from abc import ABC, abstractmethod
from fastapi_modules.fastapi_leaudit.domian.vo.ragChatAttachmentVo import (
RagChatAttachmentDeleteVO,
RagChatAttachmentVO,
)
class IRagChatAttachmentService(ABC):
@abstractmethod
async def CreateAttachment(
self,
CurrentUserId: int,
UserArea: str | None,
UserRole: str | None,
TenantCode: str | None,
TenantName: str | None,
ConversationId: str | None,
AppId: int | None,
FileName: str,
ContentType: str | None,
Content: bytes,
) -> RagChatAttachmentVO: ...
@abstractmethod
async def GetAttachment(
self,
CurrentUserId: int,
UserArea: str | None,
UserRole: str | None,
TenantCode: str | None,
TenantName: str | None,
ConversationId: str,
AttachmentId: str,
) -> RagChatAttachmentVO: ...
@abstractmethod
async def DeleteAttachment(
self,
CurrentUserId: int,
UserArea: str | None,
UserRole: str | None,
TenantCode: str | None,
TenantName: str | None,
ConversationId: str,
AttachmentId: str,
) -> RagChatAttachmentDeleteVO: ...
@abstractmethod
async def ValidateAttachmentForChat(
self,
CurrentUserId: int,
TenantCode: str | None,
ConversationId: str,
AttachmentId: str,
UserArea: str | None = None,
) -> dict: ...
@abstractmethod
async def RetrieveAttachmentContext(
self,
CurrentUserId: int,
TenantCode: str | None,
ConversationId: str,
AttachmentId: str,
Query: str,
TopK: int = 5,
UserArea: str | None = None,
) -> tuple[list[dict], str]: ...
@abstractmethod
async def ResolveActiveAttachmentIdForConversation(
self,
CurrentUserId: int,
TenantCode: str | None,
ConversationId: str,
UserArea: str | None = None,
) -> str | None: ...
@abstractmethod
async def ResolveActiveAttachmentIdsForConversation(
self,
CurrentUserId: int,
TenantCode: str | None,
ConversationId: str,
UserArea: str | None = None,
) -> list[str]: ...