-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-command-format.js
More file actions
57 lines (47 loc) · 1.78 KB
/
test-command-format.js
File metadata and controls
57 lines (47 loc) · 1.78 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
#!/usr/bin/env node
// Test the command format produced by the workflow
import { WorkflowEngine, TrendLineWorkflow, initializeWorkflows } from './functions/dist/lib/workflows/index.js';
// Initialize workflows
initializeWorkflows();
// Create mock trend line result
const mockResult = {
points: [
{ timestamp: 1700000000000, price: 45000 },
{ timestamp: 1700100000000, price: 46000 },
{ timestamp: 1700200000000, price: 47000 }
],
equation: { slope: 0.01, intercept: 44000 },
confidence: 0.95,
trendLine: {
startTime: 1700000000000,
endTime: 1700200000000,
startPrice: 45000,
endPrice: 47000,
color: '#FF5733',
lineWidth: 2,
style: 'solid'
},
type: 'resistance'
};
console.log('Testing WorkflowEngine.convertToToolCalls...\n');
// Convert to tool calls
const toolCalls = WorkflowEngine.convertToToolCalls(mockResult, 'TrendLineWorkflow');
console.log('Generated tool calls:');
console.log(JSON.stringify(toolCalls, null, 2));
// Check the format
if (toolCalls.length > 0) {
const toolCall = toolCalls[0];
console.log('\nTool call details:');
console.log('- Function name:', toolCall.function.name);
console.log('- Expected name: add_trend_line');
console.log('- Names match:', toolCall.function.name === 'add_trend_line');
const args = JSON.parse(toolCall.function.arguments);
console.log('\nArguments structure:');
console.log('- Has start object:', !!args.start);
console.log('- Has end object:', !!args.end);
console.log('- Start has timestamp and price:', !!(args.start?.timestamp && args.start?.price));
console.log('- End has timestamp and price:', !!(args.end?.timestamp && args.end?.price));
console.log('\n✅ Command format looks correct for useChartCommands.ts');
} else {
console.log('\n❌ No tool calls generated!');
}