refactor: 重构RAG核心组件,简化代码结构和测试文件
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Failing after 6m53s
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Failing after 6m53s
This commit is contained in:
34
rag_indexer/reset_qdrant.py
Normal file
34
rag_indexer/reset_qdrant.py
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
删除 Qdrant 集合并重新索引
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
|
||||
from backend.rag_core import QdrantHybridStore
|
||||
|
||||
|
||||
async def delete_and_recreate():
|
||||
"""删除并重新创建集合"""
|
||||
print("="*70)
|
||||
print("删除旧集合并重新创建...")
|
||||
print("="*70)
|
||||
|
||||
vs = QdrantHybridStore(collection_name="rag_documents")
|
||||
|
||||
# 删除旧集合
|
||||
try:
|
||||
vs.delete_collection()
|
||||
print("✅ 旧集合已删除")
|
||||
except Exception as e:
|
||||
print(f"⚠️ 删除集合时出错(可能不存在): {e}")
|
||||
|
||||
# 重新创建
|
||||
vs.create_collection()
|
||||
print("✅ 新集合已创建")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(delete_and_recreate())
|
||||
Reference in New Issue
Block a user