|
@@ -7,19 +7,18 @@ from typing import Dict, Any
|
|
|
from quart import Blueprint, jsonify, request
|
|
|
from quart_cors import cors
|
|
|
|
|
|
+from applications.api import get_basic_embedding
|
|
|
+from applications.api import get_img_embedding
|
|
|
+from applications.async_task import ChunkEmbeddingTask, DeleteTask
|
|
|
from applications.config import (
|
|
|
DEFAULT_MODEL,
|
|
|
LOCAL_MODEL_CONFIG,
|
|
|
BASE_MILVUS_SEARCH_PARAMS,
|
|
|
)
|
|
|
from applications.resource import get_resource_manager
|
|
|
-from applications.api import get_basic_embedding
|
|
|
-from applications.api import get_img_embedding
|
|
|
-from applications.async_task import ChunkEmbeddingTask, DeleteTask
|
|
|
from applications.search import HybridSearch
|
|
|
from applications.utils.chat import ChatClassifier
|
|
|
-from applications.utils.mysql import Dataset, Contents, ContentChunks
|
|
|
-from applications.utils.mysql.mapper import ChatRes
|
|
|
+from applications.utils.mysql import Dataset, Contents, ContentChunks, ChatResult
|
|
|
|
|
|
server_bp = Blueprint("api", __name__, url_prefix="/api")
|
|
|
server_bp = cors(server_bp, allow_origin="*")
|
|
@@ -381,7 +380,7 @@ async def chat():
|
|
|
resource = get_resource_manager()
|
|
|
content_chunk_mapper = ContentChunks(resource.mysql_client)
|
|
|
dataset_mapper = Dataset(resource.mysql_client)
|
|
|
- chat_res_mapper = ChatRes(resource.mysql_client)
|
|
|
+ chat_result_mapper = ChatResult(resource.mysql_client)
|
|
|
res = []
|
|
|
for result in query_results["results"]:
|
|
|
content_chunks = await content_chunk_mapper.select_chunk_content(
|
|
@@ -416,7 +415,7 @@ async def chat():
|
|
|
chat_classifier = ChatClassifier()
|
|
|
chat_res = await chat_classifier.chat_with_deepseek(query_text, res)
|
|
|
data = {"results": res, "chat_res": chat_res["summary"]}
|
|
|
- await chat_res_mapper.insert_chat_res(
|
|
|
+ await chat_result_mapper.insert_chat_result(
|
|
|
query_text,
|
|
|
dataset_id_strs,
|
|
|
json.dumps(data, ensure_ascii=False),
|