geo/backend/test_wiki.py

25 lines
704 B
Python

import asyncio
import httpx
async def test_wiki():
from app.workers.platforms.search_engine import search_wikipedia
result = await search_wikipedia("华为手机", max_chars=1000)
print("Wikipedia result length:", len(result))
print("First 500 chars:", result[:500])
print("Contains 华为:", "华为" in result)
async def test_health():
try:
async with httpx.AsyncClient() as c:
r = await c.get("http://localhost:8000/health")
print("Health status:", r.status_code, r.text)
except Exception as e:
print("Health check failed:", e)
async def main():
await test_health()
print("---")
await test_wiki()
asyncio.run(main())