merge: rag chat stabilization from wren-dev

This commit is contained in:
wren
2026-05-19 15:59:20 +08:00
19 changed files with 1939 additions and 111 deletions
File diff suppressed because it is too large Load Diff
@@ -36,7 +36,7 @@ from fastapi_modules.fastapi_leaudit.domian.vo.ragDatasetVo import (
)
from fastapi_modules.fastapi_leaudit.domian.vo.ragChatVo import RagOperationResultVO
from fastapi_modules.fastapi_leaudit.rag_engine.chroma_client import get_chroma
from fastapi_modules.fastapi_leaudit.rag_engine.config import RAG_CONFIG
from fastapi_modules.fastapi_leaudit.rag_engine.config import RAG_CONFIG, build_openai_embeddings_url
from fastapi_modules.fastapi_leaudit.services.ragDatasetService import IRagDatasetService
@@ -1503,7 +1503,7 @@ class RagDatasetServiceImpl(IRagDatasetService):
return chunks
async def _embed_texts(self, texts: list[str], model_name: str) -> list[list[float]]:
embed_url = (RAG_CONFIG.get("EMBED_URL") or "").strip() or f"{RAG_CONFIG['LLM_BASE_URL'].rstrip('/')}/embeddings"
embed_url = (RAG_CONFIG.get("EMBED_URL") or "").strip() or build_openai_embeddings_url(RAG_CONFIG["LLM_BASE_URL"])
embed_key = (RAG_CONFIG.get("EMBED_KEY") or "").strip() or RAG_CONFIG["LLM_API_KEY"]
embed_model = model_name or (RAG_CONFIG.get("EMBED_MODEL") or "").strip() or "text-embedding-v4"
batch_size = max(1, int(RAG_CONFIG.get("EMBED_BATCH_SIZE") or 10))
@@ -6,6 +6,7 @@ from typing import AsyncGenerator
from fastapi_modules.fastapi_leaudit.domian.Dto.ragChatDto import (
RagConversationRenameDTO,
RagMessageFeedbackDTO,
RagStopMessageDTO,
)
from fastapi_modules.fastapi_leaudit.domian.vo.ragChatVo import (
RagAppParametersVO,
@@ -52,6 +53,9 @@ class IRagChatService(ABC):
@abstractmethod
async def UpdateFeedback(self, CurrentUserId: int, MessageId: str, Body: RagMessageFeedbackDTO) -> RagOperationResultVO: ...
@abstractmethod
async def StopMessage(self, CurrentUserId: int, MessageId: str, Body: RagStopMessageDTO | None = None) -> RagOperationResultVO: ...
@abstractmethod
async def GetAppParameters(
self,