|
|
|
@ -15,8 +15,11 @@ from datetime import datetime
|
|
|
|
class Config:
|
|
|
|
class Config:
|
|
|
|
def __init__(self, supplier):
|
|
|
|
def __init__(self, supplier):
|
|
|
|
self.embedding_supplier = "SiliconFlow"
|
|
|
|
self.embedding_supplier = "SiliconFlow"
|
|
|
|
self.milvus_uri = dify_config.MILVUS_URI
|
|
|
|
self.milvus_uri = dify_config.VANNA_MILVUS_URI
|
|
|
|
self.milvus_database = 'vanna_demo'
|
|
|
|
self.milvus_database = dify_config.VANNA_MILVUS_DATABASE
|
|
|
|
|
|
|
|
self.embedding_host = dify_config.VANNA_EMBEDDING_HOST
|
|
|
|
|
|
|
|
self.embedding_model = dify_config.VANNA_EMBEDDING_MODEL
|
|
|
|
|
|
|
|
self.embedding_type = dify_config.VANNA_EMBEDDING_TYPE
|
|
|
|
self.supplier = supplier
|
|
|
|
self.supplier = supplier
|
|
|
|
# self.llm_type = 'tongyi'
|
|
|
|
# self.llm_type = 'tongyi'
|
|
|
|
# self.model = 'qwen-max'
|
|
|
|
# self.model = 'qwen-max'
|
|
|
|
@ -24,16 +27,16 @@ class Config:
|
|
|
|
# 本地模型
|
|
|
|
# 本地模型
|
|
|
|
# self.ollama_host = 'http://wsd.wisdomidata.com:19042'
|
|
|
|
# self.ollama_host = 'http://wsd.wisdomidata.com:19042'
|
|
|
|
# self.model = 'qwen2:7b'
|
|
|
|
# self.model = 'qwen2:7b'
|
|
|
|
self.llm_type = 'deepseek'
|
|
|
|
self.llm_type = dify_config.VANNA_LLM_TYPE
|
|
|
|
self.model = 'deepseek-coder'
|
|
|
|
self.model = dify_config.VANNA_MODEL
|
|
|
|
self.api_key = 'sk-0382990b7a90496c889774b1d3843f90'
|
|
|
|
self.api_key = dify_config.VANNA_API_KEY
|
|
|
|
self.sql_type = 'postgres'
|
|
|
|
self.sql_type = dify_config.VANNA_SQL_TYPE
|
|
|
|
self.sql_config = {
|
|
|
|
self.sql_config = {
|
|
|
|
"host": dify_config.DB_HOST,
|
|
|
|
"host": dify_config.VANNA_DB_HOST,
|
|
|
|
"dbname": 'vanna_demo',
|
|
|
|
"dbname": dify_config.VANNA_DB_DATABASE,
|
|
|
|
"user": dify_config.DB_USERNAME,
|
|
|
|
"user": dify_config.VANNA_DB_USERNAME,
|
|
|
|
"password": dify_config.DB_PASSWORD,
|
|
|
|
"password": dify_config.VANNA_DB_PASSWORD,
|
|
|
|
"port": dify_config.DB_PORT
|
|
|
|
"port": dify_config.VANNA_DB_PORT
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# 存储不同的 VannaServer 实例
|
|
|
|
# 存储不同的 VannaServer 实例
|
|
|
|
@ -214,7 +217,7 @@ def init_app(app: DifyApp):
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/api/training/data/import', methods=['POST'])
|
|
|
|
@app.route('/api/training/data/import', methods=['POST'])
|
|
|
|
def training_data_import():
|
|
|
|
def training_data_import():
|
|
|
|
|
|
|
|
|
|
|
|
if 'file' not in request.files:
|
|
|
|
if 'file' not in request.files:
|
|
|
|
return jsonify({"type": "error", "error": "未上传文件"}), 400
|
|
|
|
return jsonify({"type": "error", "error": "未上传文件"}), 400
|
|
|
|
|
|
|
|
|
|
|
|
@ -235,4 +238,4 @@ def init_app(app: DifyApp):
|
|
|
|
return jsonify({'status': 'success'}), 200
|
|
|
|
return jsonify({'status': 'success'}), 200
|
|
|
|
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
except Exception as e:
|
|
|
|
return jsonify({"type": "error", "error": f"文件解析失败: {str(e)}"}), 500
|
|
|
|
return jsonify({"type": "error", "error": f"文件解析失败: {str(e)}"}), 500
|
|
|
|
|