forked from shreyan001/backend-socials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug-wager.js
More file actions
58 lines (47 loc) · 2.17 KB
/
debug-wager.js
File metadata and controls
58 lines (47 loc) · 2.17 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Debug script to trace wager flow execution
const { createWagerGraph } = require('./dist/ai/graph.js');
async function debugWagerFlow() {
console.log("🔍 Debugging wager flow...");
const graph = createWagerGraph("0x1234567890123456789012345678901234567890"); // Test with complete wager info
const testInput = "I want to bet with Alex on tomorrow's cricket match India vs England, 1 USDC, I think India will win";
try {
console.log("📨 Input:", testInput);
const result = await graph.invoke({
input: testInput
});
console.log("\n📊 FINAL RESULT:");
console.log("Operation:", result.operation);
console.log("Current Step:", result.currentStep);
console.log("Need More Info:", result.needsMoreInfo);
console.log("Missing Fields:", result.missingFields);
console.log("User Prediction:", result.userPrediction);
console.log("Player B:", result.playerB?.name);
console.log("Event:", result.wagerDetails?.description);
console.log("Amount:", result.asset?.amount);
console.log("\n💬 MESSAGES:");
if (result.messages && result.messages.length > 0) {
result.messages.forEach((msg, i) => {
console.log(`${i + 1}. ${msg.substring(0, 200)}...`);
});
const lastMessage = result.messages[result.messages.length - 1];
if (lastMessage.includes('[OBJ]') && lastMessage.includes('[/OBJ]')) {
console.log("\n✅ SUCCESS: Got OBJ format!");
} else {
console.log("\n❌ FAILED: No OBJ format found");
console.log("Last message starts with:", lastMessage.substring(0, 100));
// Check if it's a conversational response instead
if (lastMessage.includes("Wager Summary") ||
lastMessage.includes("You're all set") ||
lastMessage.includes("Event Details")) {
console.log("🚨 ISSUE: AI generated conversational response instead of OBJ format");
console.log("This means the flow didn't reach the validation node properly!");
}
}
} else {
console.log("No messages found!");
}
} catch (error) {
console.error("❌ Test failed:", error);
}
}
debugWagerFlow();