-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_react.py
More file actions
37 lines (30 loc) · 1.34 KB
/
test_react.py
File metadata and controls
37 lines (30 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import asyncio
import httpx
async def test_react_suggestion():
"""Test with React content to see voice adaptation"""
url = "http://localhost:8001/api/suggest"
payload = {
"current_text": "React components should be small and focused on a single responsibility.",
"context": [
"Building scalable React applications requires careful architecture decisions.",
"Component composition is more powerful than inheritance in React."
]
}
print("=== Testing with React Content ===")
print(f"Input: {payload['current_text']}")
async with httpx.AsyncClient(timeout=60.0) as client:
response = await client.post(url, json=payload)
if response.status_code == 200:
data = response.json()
print("\n✅ Suggestions:")
for i, suggestion in enumerate(data["suggestions"], 1):
print(f"{i}. {suggestion}")
print(f"\nChunks found: {len(data['source_chunks'])}")
if data['source_chunks']:
print("Sample chunk (cleaned):")
chunk_text = data['source_chunks'][0]['text'][:200]
print(f" {chunk_text}...")
else:
print(f"❌ Error: {response.status_code}")
if __name__ == "__main__":
asyncio.run(test_react_suggestion())