-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_knowledge.py
More file actions
34 lines (28 loc) · 846 Bytes
/
Copy pathtest_knowledge.py
File metadata and controls
34 lines (28 loc) · 846 Bytes
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
import requests
print("Testing chatbot knowledge...")
# Test questions about the website
questions = [
"How do I sign in?",
"Where can I upload my resume?",
"How do I start a test?",
"What is a mock interview?"
]
for q in questions:
print(f"\n{'='*60}")
print(f"Q: {q}")
try:
r = requests.post("http://localhost:8001/chat", json={
"user_id": "test",
"message": q
})
if r.status_code == 200:
data = r.json()
if data.get("messages"):
answer = data["messages"][-1]["content"]
print(f"A: {answer[:200]}...")
else:
print(f"Error: {r.status_code}")
except Exception as e:
print(f"Error: {e}")
print(f"\n{'='*60}")
print("✅ Your chatbot now knows about your website!")