warbler-cda / test_npcs.py
Bellok
feat(docs, refactor): add NPC Chat API integration guide and update data ingestion
ec2d906
raw
history blame
1.16 kB
import requests
import json
print('=== TESTING PERSONALITY-DRIVEN RESPONSES ===')
print('Asking all NPCs the same question: "What should I prioritize when facing a great challenge?"')
npcs = [
('elara', 'Elara (Nature Healer)'),
('thorne-warrior', 'Thorne (Combat Warrior)'),
('mira-scholar', 'Mira (Arcane Scholar)'),
('bob-skeptic', 'Bob (Skeptic)'),
('alice-clean', 'Alice (Content Moderator)')
]
test_question = 'What should I prioritize when facing a great challenge?'
for npc_id, description in npcs:
print(f'\n--- {description} ---')
chat_data = {
'npc_id': npc_id,
'player_id': f'player_test_{npc_id}',
'message': test_question
}
response = requests.post('http://localhost:8000/npc/chat', json=chat_data)
if response.status_code == 200:
data = response.json()
print('Response:', data['npc_response'][:150] + '...' if len(data['npc_response']) > 150 else data['npc_response'])
print('Emotion:', data['emotion'], '| Intent:', data['intent'], '| Coherence:', '%.3f' % data['coherence_score'])
else:
print('Error:', response.status_code, response.text)