优化三个工具的返回结果。

This commit is contained in:
2025-01-06 17:27:45 +08:00
parent c7d2d482da
commit 4d0c41d222
7 changed files with 266 additions and 8 deletions

View File

@@ -17,6 +17,7 @@ from services.mp_service import (
)
from utils import handle_minio_upload
from error_handlers import handle_general_error
from utils import settings
router = APIRouter(prefix="/mp", tags=["Material Project"])
logger = logging.getLogger(__name__)
@@ -55,10 +56,10 @@ async def search_from_material_project(request: Request):
os.remove(file_name)
# 格式化返回结果
res_chunk = "```json\n" + json.dumps(res[:5], indent=2) + "\n```"
res_chunk = "```json\n" + json.dumps(res[:settings.mp_topk], indent=2) + "\n```"
res_template = f"""
好的,以下是用户的查询结果:
由于返回长度的限制,我们只能返回前5个结果。如下:
由于返回长度的限制,我们只能返回前{settings.mp_topk}个结果。如下:
{res_chunk}
如果用户需要更多的结果,请提示用户修改查询条件,或者尝试使用其他查询参数。
同时我们将全部的的查询结果上传到MinIO中请你提示用户可以通过以下链接下载