28 lines
821 B
Python
28 lines
821 B
Python
|
|
import asyncio
|
||
|
|
import sys
|
||
|
|
sys.path.insert(0, '/app')
|
||
|
|
|
||
|
|
async def test():
|
||
|
|
from app.services.graph_query_service import get_graph_query_service
|
||
|
|
from app.services.neo4j_client import get_neo4j_client
|
||
|
|
|
||
|
|
neo4j_client = await get_neo4j_client()
|
||
|
|
graph_service = await get_graph_query_service(neo4j_client)
|
||
|
|
|
||
|
|
# 测试关键词提取
|
||
|
|
question = "打印机驱动安装"
|
||
|
|
keywords = graph_service._extract_keywords(question)
|
||
|
|
print(f"Question: {question}")
|
||
|
|
print(f"Keywords: {keywords}")
|
||
|
|
|
||
|
|
# 测试每个关键词的查询
|
||
|
|
for kw in keywords:
|
||
|
|
print(f"\n=== Querying keyword: {kw} ===")
|
||
|
|
try:
|
||
|
|
result = await graph_service._query_by_keyword(kw)
|
||
|
|
print(f"Result: {result}")
|
||
|
|
except Exception as e:
|
||
|
|
print(f"Error: {e}")
|
||
|
|
|
||
|
|
asyncio.run(test())
|