-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdirect-fix.js
More file actions
executable file
·78 lines (62 loc) · 2.7 KB
/
Copy pathdirect-fix.js
File metadata and controls
executable file
·78 lines (62 loc) · 2.7 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env node
/**
* Direct Fix for ElizaOS Model Settings
*
* Based on the error message, it appears ElizaOS is looking for a key in the
* settings object with the pattern: modelProvider / size
* e.g., "openai / LARGE"
*/
const fs = require('fs');
const path = require('path');
// Create a modified character file
const characterPath = 'characters/aengel.json';
const outputPath = 'characters/aengel-fixed.json';
console.log(`Reading character from ${characterPath}...`);
const character = JSON.parse(fs.readFileSync(characterPath, 'utf8'));
// Ensure settings exist
character.settings = character.settings || {};
// Add the EXACT format needed based on the error message
const modelProvider = character.modelProvider.toUpperCase();
console.log(`Setting up model keys for provider: ${modelProvider}`);
// Format 1: The normal format that should work
character.settings.LARGE_OPENAI_MODEL = 'gpt-4o';
character.settings.MEDIUM_OPENAI_MODEL = 'gpt-4o';
character.settings.SMALL_OPENAI_MODEL = 'gpt-4o-mini';
character.settings.EMBEDDING_OPENAI_MODEL = 'text-embedding-3-small';
// Format 2: Special format based on error message pattern
character.settings['openai / LARGE'] = 'gpt-4o';
character.settings['openai / MEDIUM'] = 'gpt-4o';
character.settings['openai / SMALL'] = 'gpt-4o-mini';
character.settings['openai / EMBEDDING'] = 'text-embedding-3-small';
// Save the modified character file
fs.writeFileSync(outputPath, JSON.stringify(character, null, 2));
console.log(`Created modified character at ${outputPath}`);
// Create startup script
const startupScript = `#!/bin/bash
# Kill any existing agent processes
pkill -f "node packages/agent" || echo "No agent processes to kill"
# Set environment variables
export OPENAI_API_KEY="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"
export LARGE_OPENAI_MODEL="gpt-4o"
export MEDIUM_OPENAI_MODEL="gpt-4o"
export SMALL_OPENAI_MODEL="gpt-4o-mini"
export EMBEDDING_OPENAI_MODEL="text-embedding-3-small"
export LOG_LEVEL="debug"
# Start the agent with our fixed character file
echo "Starting agent with fixed character file..."
node packages/agent/dist/index.js --character=${outputPath} > /tmp/fixed_agent.log 2>&1 &
AGENT_PID=$!
# Show agent PID
echo "Agent started with PID: $AGENT_PID"
# Follow logs
sleep 2
echo "Initial logs:"
tail -30 /tmp/fixed_agent.log
echo ""
echo "Continuing to follow logs (press Ctrl+C to stop viewing logs):"
tail -f /tmp/fixed_agent.log
`;
fs.writeFileSync('start-fixed-agent.sh', startupScript);
fs.chmodSync('start-fixed-agent.sh', '755');
console.log('Created start-fixed-agent.sh script');
console.log('Run with: ./start-fixed-agent.sh');