Преглед на файлове

24w条数据的压力测试

jiayongqiang преди 21 часа
родител
ревизия
ced4014b54

+ 3 - 1
agent/.gitignore

@@ -7,4 +7,6 @@ __pycache__/
 .venv/
 __pycache__
 .models/
-.venv/
+.venv/
+.logs/
+.data/

+ 2 - 0
agent/config.ini

@@ -21,6 +21,8 @@ enable_config = false
 
 [es]
 url = http://10.192.72.13:9200
+username = elastic
+password = 123456
 
 [app]
 top_k = 2

BIN
agent/data/24-all.xlsx


BIN
agent/dist/agent-0.1.5-py3-none-any.whl


BIN
agent/dist/agent-0.1.5.tar.gz


BIN
agent/dist/agent-0.1.6-py3-none-any.whl


BIN
agent/dist/agent-0.1.6.tar.gz


BIN
agent/logs/aitagging-app.2026-03-31_19-14-14_513382.log.zip


+ 2 - 1
agent/src/agent/core/es.py

@@ -14,7 +14,8 @@ es = Elasticsearch(
     hosts=[url],
     retry_on_timeout=True,
     max_retries=3,
-    http_compress=True 
+    http_compress=True,
+    basic_auth=(config['es']['username'], config['es']['password'])
 )
 
 INDEX_NAME = "ai-tagging"

+ 4 - 1
agent/tests/test_sync_category.py

@@ -1,6 +1,9 @@
 import requests
 
-res = requests.post("http://10.192.72.13:9876/api/aitag/admin/v1/synchronize_category", json={
+# res = requests.post("http://10.192.72.13:9876/api/aitag/admin/v1/synchronize_category", json={
+#     "category_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
+# })
+res = requests.post("http://localhost:9876/api/aitag/admin/v1/synchronize_category", json={
     "category_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
 })
 print(res.text)

+ 35 - 0
agent/tests/test_tagging_12w.py

@@ -0,0 +1,35 @@
+import requests
+import uuid
+from openpyxl import load_workbook
+
+wb = load_workbook('./data/样本数据打标结果-12w-终版.xlsx')
+ws = wb.active
+for row in ws.iter_rows(min_row=2, values_only=True):
+    zhiye = row[0] if row[0] is not None else ""
+    touxiang = row[1] if row[1] is not None else ""
+    yongtu = row[2] if row[2] is not None else ""
+    phrase = f"职业:{zhiye} 投向:{touxiang} 用途:{yongtu}"
+    requests.post("http://10.192.72.13:9876/api/aitag/v1/tagging", json={
+        "esb_seq_no": uuid.uuid4().hex,
+        "business_attr": uuid.uuid4().hex,
+        "phrase": phrase
+    })
+
+#批量读取test_data.txt中的测试用例,并调用接口进行测试
+# with open("样本数据打标结果-12w-终版.xlsx", "r", encoding="utf-8") as f:
+#     for line in f:
+#         phrase = line.strip().split(" ")
+#         if len(phrase) < 2:
+#             continue
+#         if len(phrase) ==2:
+#             phrase = "职业:"+phrase[0]+" "+"投向:"+phrase[1]
+#         if len(phrase) == 3:
+#             phrase = "职业:"+phrase[0]+" "+"投向:"+phrase[1]+" "+"用途:"+phrase[2]
+
+#         res = requests.post("http://10.192.72.13:9876/api/aitag/v1/tagging", json={
+#             "esb_seq_no": uuid.uuid4().hex,
+#             "business_attr": uuid.uuid4().hex,
+#             "phrase": phrase
+#         })
+
+

+ 17 - 0
agent/tests/test_tagging_24w.py

@@ -0,0 +1,17 @@
+import requests
+import uuid
+from openpyxl import load_workbook
+
+wb = load_workbook('./data/24-all.xlsx')
+ws = wb.active
+for row in ws.iter_rows(min_row=2, values_only=True):
+    zhiye = row[1] if row[1] is not None else ""
+    touxiang = row[2] if row[2] is not None else ""
+    yongtu = row[3] if row[3] is not None else ""
+    phrase = f"职业:{zhiye}; 投向:{touxiang}; 用途:{yongtu}"
+    print(phrase)
+    requests.post("http://10.192.72.13:9876/api/aitag/v1/tagging", json={
+        "esb_seq_no": uuid.uuid4().hex,
+        "business_attr": uuid.uuid4().hex,
+        "phrase": phrase
+    })