1、将清单、定额excel上传到git. 初此启动服务将创建数据库文件。因数据库中包含向量数据体积庞大,采用初此启动服务创建策略
2、优化环境变量的使用和命名
This commit is contained in:
+2
-2
@@ -530,7 +530,7 @@ class CreateEmbedingData():
|
||||
if self.conn:
|
||||
self.conn.close()
|
||||
|
||||
def main():
|
||||
def create_db():
|
||||
"""主函数"""
|
||||
print("开始处理定额库和清单库Excel文件...")
|
||||
|
||||
@@ -589,4 +589,4 @@ def main():
|
||||
processor.conn.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
create_db()
|
||||
@@ -11,7 +11,7 @@ import os
|
||||
|
||||
# 导入ExcelToSQLiteProcessor类
|
||||
sys.path.append(os.getcwd())
|
||||
from rag2_0.demo.create_qingdan_dinge_database import ExcelToSQLiteProcessor
|
||||
from rag2_0.api.create_qingdan_dinge_database import ExcelToSQLiteProcessor, create_db
|
||||
# 导入向量检索相关类
|
||||
from rag2_0.tool.ModelTool import XinferenceEmbeddings
|
||||
from langchain_community.vectorstores import SQLiteVSS
|
||||
@@ -57,6 +57,9 @@ class QingDanDingEQueryService:
|
||||
self.db_path = f"{os.getcwd()}/data/db/qingdan_ding_e_ku.db"
|
||||
self.top_k = TOP_K
|
||||
|
||||
# 初始化数据库文件,首次将创建数据库DB
|
||||
create_db()
|
||||
|
||||
# 初始化向量检索相关组件
|
||||
self.embedding_function = XinferenceEmbeddings()
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class DifyExporter:
|
||||
self.message_info_list = []
|
||||
|
||||
# 设置AnswerType服务地址
|
||||
self.answer_type_url = f"http://10.1.16.39:8003"
|
||||
self.answer_type_url = f"http://172.20.0.145:8003"
|
||||
|
||||
def process_message_chain(self, messages):
|
||||
"""
|
||||
@@ -144,15 +144,19 @@ class DifyExporter:
|
||||
if lock_node_execution["outputs"] is None:
|
||||
return []
|
||||
outputs = json.loads(lock_node_execution["outputs"])
|
||||
source_kno = outputs['json'][0]['retrieve_result']
|
||||
if 'json' in outputs:
|
||||
source_kno = outputs['json'][0]['retrieve_result']
|
||||
else:
|
||||
source_kno = outputs['result']['value']
|
||||
for knowledge in source_kno:
|
||||
document_name = knowledge['metadata']['document_name']
|
||||
wiki_list.append(document_name.split("/")[-1])
|
||||
|
||||
wiki_list.append("锁信息查询")
|
||||
wiki_list.append("软件锁注册、激活、查锁、试用锁延期")
|
||||
if "锁信息查询" not in wiki_list:
|
||||
wiki_list.append("锁信息查询")
|
||||
if "软件锁注册、激活、查锁、试用锁延期" not in wiki_list:
|
||||
wiki_list.append("软件锁注册、激活、查锁、试用锁延期")
|
||||
return wiki_list
|
||||
|
||||
return []
|
||||
|
||||
def get_query_type_from_service(self, workflow_run_id):
|
||||
@@ -406,18 +410,18 @@ if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Dify数据导出工具')
|
||||
parser.add_argument('--output', '-o', type=str, default="data/excel/dify_export.xlsx",
|
||||
help='输出Excel文件路径')
|
||||
parser.add_argument('--app_id', '-a', type=str, default="6218c4fd-bba3-4f5b-9fb5-61585d8eee51",
|
||||
parser.add_argument('--app_id', '-a', type=str, default="72d03c7d-8bea-42f9-9e8d-cdfb9480f372",
|
||||
help='Dify应用ID')
|
||||
parser.add_argument('--start_date', '-s', type=str, default="2025-07-30 00",
|
||||
parser.add_argument('--start_date', '-s', type=str, default="2025-09-10 00",
|
||||
help='开始日期时间,格式为YYYY-MM-DD HH,例如2025-07-08 14表示2025年7月8日14时(UTC+8时区)')
|
||||
parser.add_argument('--end_date', '-e', type=str, default=None,
|
||||
parser.add_argument('--end_date', '-e', type=str, default="2025-09-19 23",
|
||||
help='结束日期时间,格式为YYYY-MM-DD HH,例如2025-07-08 18表示2025年7月8日18时(UTC+8时区)')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
load_dotenv()
|
||||
# 设置环境变量
|
||||
os.environ["DIFY_PG_HOST"] = "10.1.16.39"
|
||||
os.environ["DIFY_PG_HOST"] = "172.20.0.145"
|
||||
os.environ["DIFY_PG_PORT"] = "5432"
|
||||
os.environ["DIFY_PG_USER"] = "postgres"
|
||||
os.environ["DIFY_PG_PASSWORD"] = "difyai123456"
|
||||
|
||||
@@ -98,13 +98,6 @@ classification_prompt="""
|
||||
"sub_classification":"软件功能"
|
||||
}}
|
||||
|
||||
|
||||
用户输入2: BDD3是什么
|
||||
输出2:
|
||||
{{
|
||||
"vertical_classification":"安装下载注册",
|
||||
"sub_classification":"后缀名咨询"
|
||||
}}
|
||||
"""
|
||||
|
||||
query_rewrite_prompt = """
|
||||
|
||||
Reference in New Issue
Block a user