-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_formatting.js
More file actions
38 lines (32 loc) · 1.35 KB
/
Copy pathtest_formatting.js
File metadata and controls
38 lines (32 loc) · 1.35 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
38
import fetch from 'node-fetch';
async function testChat() {
console.log("Testing Chat Formatting...");
try {
const response = await fetch('http://localhost:3000/chat/german', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message: "Hello" })
});
const data = await response.json();
console.log("Response Status:", response.status);
if (response.status === 200) {
console.log("\n--- AI REPLY ---\n");
console.log(data.reply);
console.log("\n----------------\n");
console.log("Provider:", data.provider);
// Validation (Updated to match User's Exact Requirements)
const sections = ["GER:", "ENG:", "IND:", "Response:", "Response ENG:", "Feedback:", "Pro-Tip:", "Example:"];
const missing = sections.filter(s => !data.reply.includes(s) && !data.reply.includes('**' + s));
if (missing.length === 0) {
console.log("✅ ALL format sections present!");
} else {
console.log("❌ MISSING sections:", missing);
}
} else {
console.log("Error Body:", data);
}
} catch (err) {
console.error("Test Failed:", err);
}
}
testChat();