From 0fb0c2c61ef6f48089b941f0e185e51288fe01b0 Mon Sep 17 00:00:00 2001
From: shidong <shidong@jhsoft.cc>
Date: 星期二, 08 七月 2025 19:07:04 +0800
Subject: [PATCH] #2025/7/8 #增了读取知识库ID
---
qwen_detect_batch.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/qwen_detect_batch.py b/qwen_detect_batch.py
index 6389eb6..301c1b5 100644
--- a/qwen_detect_batch.py
+++ b/qwen_detect_batch.py
@@ -94,7 +94,7 @@
output_fields=["id", "zh_desc_class", "text_vector", "bounding_box", "video_point_name", "task_id",
"task_name", "event_level_id", "event_level_name",
"video_point_id", "detect_num", "is_waning", "is_desc", "waning_value", "rule_id",
- "detect_id",
+ "detect_id","knowledge_id",
"detect_time", "image_path", "image_desc_path", "video_path"],
consistency_level="Strong",
order_by_field="id", # 鎸塱d瀛楁鎺掑簭
@@ -106,7 +106,7 @@
if len(res_a) > 0:
sorted_results = sorted(res_a, key=itemgetter("id"), reverse=True)
# 鏌ヨ鍓峃涓渶澶х殑ID
- res_a = sorted_results[:int(self.config.get("detectnum"))-1]
+ res_a = sorted_results[:int(self.config.get("detectnum"))]
res_data = []
for res in res_a:
data = {
@@ -129,14 +129,14 @@
"image_path": res['image_path'], # image_path
"image_desc_path": res['image_desc_path'], # image_desc_path
"video_path": res['video_path'],
- "text_vector": res['text_vector']
+ "text_vector": res['text_vector'],
+ "knowledge_id": res['knowledge_id']
}
# logging.info(f"璇诲彇鍥惧儚鎴愬姛: {res['id']}")
# 淇濆瓨鍒癿ilvus
image_id = self.collection.upsert(data).primary_keys
res['id'] = image_id[0]
res_data.append(res)
- # logging.info(f"璇诲彇鍥惧儚鎴愬姛: {image_id}")
self.pool.submit(res_data)
# image_id = pool.tark_do(image_id,self.config.get("ragurl"),self.config.get("ragmode"),self.config.get("max_tokens"))
# logging.info(f"澶勭悊鍥惧儚鎴愬姛: {image_id}")
--
Gitblit v1.8.0