This commit is contained in:
parent
2b2451ec6f
commit
449dd04ee5
5
app.py
5
app.py
|
|
@ -4,6 +4,9 @@ app = Flask(__name__)
|
||||||
|
|
||||||
# 全局变量,存储传递进来的嵌套字典数据
|
# 全局变量,存储传递进来的嵌套字典数据
|
||||||
customer_data = []
|
customer_data = []
|
||||||
|
buf = {}
|
||||||
|
key = "ZbIF9jKqzDyChwiB"
|
||||||
|
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
|
|
@ -47,8 +50,6 @@ def update_customers(index):
|
||||||
if 0 <= index < len(customer_data):
|
if 0 <= index < len(customer_data):
|
||||||
customer = customer_data[index]
|
customer = customer_data[index]
|
||||||
for domain, info in customer.items():
|
for domain, info in customer.items():
|
||||||
print(f"..........domain={domain}")
|
|
||||||
print(f"..........info={info}")
|
|
||||||
if 'customer industry' in info:
|
if 'customer industry' in info:
|
||||||
info['customer industry'] = updated_data.get(f'{domain}_industry', [info['customer industry']])[0]
|
info['customer industry'] = updated_data.get(f'{domain}_industry', [info['customer industry']])[0]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import app
|
import app
|
||||||
|
from app import key, buf
|
||||||
import json
|
import json
|
||||||
from elasticsearch import Elasticsearch
|
from elasticsearch import Elasticsearch
|
||||||
from elasticsearch.exceptions import ApiError, TransportError
|
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 应用
|
# 传递数据并启动 Flask 应用
|
||||||
# store_to_es(key, buf, 'customer')
|
# store_to_es(key, buf, 'customer')
|
||||||
|
|
||||||
buf = {}
|
|
||||||
key = "ZbIF9jKqzDyChwiB"
|
|
||||||
ret = load_indices_from_es(key, 'customer', buf)
|
ret = load_indices_from_es(key, 'customer', buf)
|
||||||
if not ret:
|
if not ret:
|
||||||
exit("客服AI员工不能拥有数据库。")
|
exit("客服AI员工不能拥有数据库。")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue