From a9124a1881922dda5bfd61b8737bdbf0aed2f5b1 Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Tue, 9 Jul 2024 16:38:05 +0800 Subject: [PATCH] fix typo --- src/api.py | 6 +++--- src/cli.py | 8 ++++---- src/core/__init__.py | 2 +- src/core/{preretrival.py => preretrieval.py} | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) rename src/core/{preretrival.py => preretrieval.py} (98%) diff --git a/src/api.py b/src/api.py index e559a626..30e47cb6 100644 --- a/src/api.py +++ b/src/api.py @@ -4,7 +4,7 @@ from flask import Flask, jsonify, Response, request from flask_cors import CORS from dotenv import load_dotenv from core import HistoryManager -from core import PreRetrival +from core import PreRetrieval from config import Config from models import select_model from utils.logging_config import setup_logger @@ -16,7 +16,7 @@ logger = setup_logger("server") config = Config("config/base.yaml") model = select_model(config) -pre_retrival = PreRetrival(config) +pre_retrieval = PreRetrieval(config) apps = Flask(__name__)# 这段代码是为了解决跨域问题,Flask默认不支持跨域 @@ -48,7 +48,7 @@ def chat(): external = "" if config.enable_knowledge_base: - kb_res = pre_retrival.search(query) + kb_res = pre_retrieval.search(query) if kb_res: kb_res = "\n".join([f"{r['id']}: {r['entity']['text']}" for r in kb_res[0]]) kb_res = f"知识库信息: {kb_res}" diff --git a/src/cli.py b/src/cli.py index 11663bb4..39257474 100644 --- a/src/cli.py +++ b/src/cli.py @@ -1,7 +1,7 @@ import os from dotenv import load_dotenv from core import HistoryManager -from core import PreRetrival +from core import PreRetrieval from config import Config from models import select_model @@ -11,8 +11,8 @@ load_dotenv() if __name__ == "__main__": config = Config("config/base.yaml") model = select_model(config) - pre_retrival = PreRetrival(config) - # pre_retrival.add_file("/home/zwj/workspace/ProjectAthena/src/data/file/鉴定工作报告、技术报告-0708.pdf") + pre_retrieval = PreRetrieval(config) + # pre_retrieval.add_file("/home/zwj/workspace/ProjectAthena/src/data/file/鉴定工作报告、技术报告-0708.pdf") print(f"[{config.model_provider}:{config.get('model_name', 'default')}] Type 'exit' to quit") @@ -25,7 +25,7 @@ if __name__ == "__main__": external = "" if config.enable_knowledge_base: - kb_res = pre_retrival.search(message) + kb_res = pre_retrieval.search(message) if kb_res: kb_res = "\n".join([f"{r['id']}: {r['entity']['text']}" for r in kb_res[0]]) kb_res = f"知识库信息: {kb_res}" diff --git a/src/core/__init__.py b/src/core/__init__.py index 414a12cc..71c46273 100644 --- a/src/core/__init__.py +++ b/src/core/__init__.py @@ -1,2 +1,2 @@ from .history import * -from .preretrival import * \ No newline at end of file +from .preretrieval import * \ No newline at end of file diff --git a/src/core/preretrival.py b/src/core/preretrieval.py similarity index 98% rename from src/core/preretrival.py rename to src/core/preretrieval.py index 51e73bab..3ac793de 100644 --- a/src/core/preretrival.py +++ b/src/core/preretrieval.py @@ -10,7 +10,7 @@ from utils.logging_config import setup_logger from pymilvus import MilvusClient -logger = setup_logger("PreRetrival") +logger = setup_logger("PreRetrieval") def pdfreader(file_path): """读取PDF文件并返回text文本""" @@ -32,7 +32,7 @@ def plainreader(file_path): return text -class PreRetrival: +class PreRetrieval: def __init__(self, config): self.config = config