This commit is contained in:
hailin 2024-10-25 15:13:38 +08:00
parent 2b2451ec6f
commit 449dd04ee5
2 changed files with 5 additions and 4 deletions

5
app.py
View File

@ -4,6 +4,9 @@ app = Flask(__name__)
# 全局变量,存储传递进来的嵌套字典数据
customer_data = []
buf = {}
key = "ZbIF9jKqzDyChwiB"
@app.route('/')
def index():
@ -47,8 +50,6 @@ def update_customers(index):
if 0 <= index < len(customer_data):
customer = customer_data[index]
for domain, info in customer.items():
print(f"..........domain={domain}")
print(f"..........info={info}")
if 'customer industry' in info:
info['customer industry'] = updated_data.get(f'{domain}_industry', [info['customer industry']])[0]

View File

@ -1,4 +1,5 @@
import app
from app import key, buf
import json
from elasticsearch import Elasticsearch
from elasticsearch.exceptions import ApiError, TransportError
@ -107,8 +108,7 @@ def load_indices_from_es(key: str, index: str, buf: Dict[str, Any]) -> Any:
# 传递数据并启动 Flask 应用
# store_to_es(key, buf, 'customer')
buf = {}
key = "ZbIF9jKqzDyChwiB"
ret = load_indices_from_es(key, 'customer', buf)
if not ret:
exit("客服AI员工不能拥有数据库。")