feat: make Trade Follow-up Assistant responses concise and actionable

- Updated system prompt to match main analysis style: precision of proprietary desk trader
- Reduced max tokens from 800 to 200 for main responses
- Reduced screenshot analysis tokens from 1000 to 150
- Made welcome messages more compact and focused
- Shortened quick action buttons (Exit now?, Move stop loss, etc.)
- Condensed status report to essential information only
- Eliminated verbose explanations, focus on exact price levels and immediate actions
- Changed temperature from 0.3 to 0.1 for more consistent responses

Addresses user feedback that responses were 'way too vague and too much talk'.
This commit is contained in:
mindesbunister
2025-07-17 16:44:32 +02:00
parent 303c19fe30
commit 39de37e7eb
2 changed files with 32 additions and 36 deletions

View File

@@ -96,7 +96,7 @@ export default function TradeFollowUpPanel({ onClose }: TradeFollowUpPanelProps)
setChatMessages([{
id: Date.now().toString(),
type: 'system',
content: `🎯 **Trade Follow-up Assistant**\n\n**System Status (${systemStatus?.timestamp || 'Loading...'})**\n${statusEmoji}\n\nI'm here to help you manage your active ${data.positions[0].symbol} ${data.positions[0].side} position.\n\n**Current Position:**\n• Entry: $${data.positions[0].entryPrice}\n• Size: ${data.positions[0].amount}\n• Current P&L: ${data.positions[0].unrealizedPnl > 0 ? '+' : ''}$${data.positions[0].unrealizedPnl.toFixed(2)}\n\n**Available Commands:**\n• "status" - System and trading status\n• "analysis" - Fresh chart analysis\n• "risk" - Risk assessment\n• "exit" - Exit strategy\n\nAsk me anything about your trade!`,
content: `🎯 **Trade Follow-up Assistant**\n\n**System:** ${statusEmoji}\n\n**Active Position:**\n• ${data.positions[0].symbol} ${data.positions[0].side}\n• Entry: $${data.positions[0].entryPrice} | Size: ${data.positions[0].amount}\n• P&L: ${data.positions[0].unrealizedPnl > 0 ? '+' : ''}$${data.positions[0].unrealizedPnl.toFixed(2)}\n\nAsk: "exit?", "analysis", "risk", or type your question.`,
timestamp: new Date().toISOString()
}])
} else {
@@ -107,7 +107,7 @@ export default function TradeFollowUpPanel({ onClose }: TradeFollowUpPanelProps)
setChatMessages([{
id: Date.now().toString(),
type: 'system',
content: `⚠️ **No Active Positions Found**\n\n**System Status (${systemStatus?.timestamp || 'Loading...'})**\n${statusEmoji}\n\nI don't see any active positions to analyze. Please:\n1. Enter a trade first\n2. Mark it as traded using the blue button\n3. Come back for follow-up analysis\n\nOr type "status" for detailed system information.`,
content: `⚠️ **No Active Positions**\n\n**System:** ${statusEmoji}\n\nExecute a trade first, then mark it as traded for follow-up analysis.\n\nType "status" for system diagnostics.`,
timestamp: new Date().toISOString()
}])
}
@@ -116,7 +116,7 @@ export default function TradeFollowUpPanel({ onClose }: TradeFollowUpPanelProps)
setChatMessages([{
id: Date.now().toString(),
type: 'system',
content: `❌ **Error Loading Positions**\n\n**System Status:** ${systemStatus ? `API ${systemStatus.api ? '✓' : '✗'} Wallet ${systemStatus.wallet ? '✓' : '✗'} Trading ${systemStatus.trading ? '✓' : '✗'}` : 'Unknown'}\n\nCouldn't load your active positions. Please check:\n• Docker container is running (port 9001)\n• API endpoints are responding\n• Database connection is working\n\nType "status" for detailed diagnostics.`,
content: `❌ **Error Loading Positions**\n\n**System:** ${systemStatus ? `API ${systemStatus.api ? '✓' : '✗'} Wallet ${systemStatus.wallet ? '✓' : '✗'} Trading ${systemStatus.trading ? '✓' : '✗'}` : 'Unknown'}\n\nConnection issues detected. Type "status" for diagnostics.`,
timestamp: new Date().toISOString()
}])
}
@@ -150,7 +150,7 @@ export default function TradeFollowUpPanel({ onClose }: TradeFollowUpPanelProps)
const statusMessage: ChatMessage = {
id: (Date.now() + 1).toString(),
type: 'assistant',
content: `📊 **System Status Report** (${new Date().toLocaleTimeString()})\n\n**🐳 Docker Container:**\n• Status: ${systemStatus?.api ? '🟢 Running' : '🔴 Issues detected'}\n• Port: 9001 → 3000\n• Health: ${systemStatus?.api ? 'Healthy' : 'Unhealthy'}\n\n**🌐 API Services:**\n• Main API: ${systemStatus?.api ? '🟢 Online' : '🔴 Offline'}\n• Wallet API: ${systemStatus?.wallet ? '🟢 Connected' : '🔴 Disconnected'}\n• Trading API: ${systemStatus?.trading ? '🟢 Active' : '🔴 Inactive'}\n\n**📈 Trading Services:**\n• Drift Protocol: ${systemStatus?.trading ? '🟢 Connected' : '🔴 Not connected'}\n• Jupiter DEX: ${systemStatus?.trading ? '🟢 Available' : '🔴 Unavailable'}\n• Screenshot Service: ${systemStatus?.api ? '🟢 Ready' : '🔴 Not ready'}\n\n**🧠 AI Services:**\n• OpenAI GPT-4o mini: ${process.env.OPENAI_API_KEY ? '🟢 Configured' : '🔴 Not configured'}\n• Analysis Engine: ${systemStatus?.api ? '🟢 Ready' : '🔴 Not ready'}\n\n**💾 Database:**\n• SQLite: 🟢 Connected\n• Position Tracking: ${activePosition ? '🟢 Active position found' : '🟡 No active positions'}\n\n${!activePosition ? '**💡 Tip:** Execute a trade and mark it as traded to enable full follow-up features!' : '**✅ Ready:** All systems operational for trade follow-up!'}`,
content: `📊 **System Status** (${new Date().toLocaleTimeString()})\n\n**Core Services:**\n• API: ${systemStatus?.api ? '🟢' : '🔴'} | Wallet: ${systemStatus?.wallet ? '🟢' : '🔴'} | Trading: ${systemStatus?.trading ? '🟢' : '🔴'}\n\n**Trading:**\n• Drift Protocol: ${systemStatus?.trading ? '🟢 Connected' : '🔴 Disconnected'}\n• Screenshot Service: ${systemStatus?.api ? '🟢 Ready' : '🔴 Not ready'}\n• AI Analysis: ${process.env.OPENAI_API_KEY ? '🟢 Ready' : '🔴 No API key'}\n\n**Container:**\n• Docker: 🟢 Running (Port 9001)\n• Database: 🟢 SQLite Connected\n\n${!activePosition ? '⚠️ No active positions for follow-up' : '✅ Ready for trade management'}`,
timestamp: new Date().toISOString()
}
setChatMessages(prev => [...prev, statusMessage])
@@ -173,7 +173,7 @@ export default function TradeFollowUpPanel({ onClose }: TradeFollowUpPanelProps)
const thinkingMessage: ChatMessage = {
id: (Date.now() + 1).toString(),
type: 'assistant',
content: '🔄 **Getting Updated Analysis...**\n\nCapturing fresh screenshots and analyzing current market conditions for your position...',
content: '🔄 **Capturing fresh screenshots and analyzing...**',
timestamp: new Date().toISOString()
}
setChatMessages(prev => [...prev, thinkingMessage])
@@ -262,12 +262,11 @@ export default function TradeFollowUpPanel({ onClose }: TradeFollowUpPanelProps)
}
const quickActions = [
"status",
"Should I exit now?",
"Update my stop loss",
"Current market analysis",
"Risk assessment",
"Take profit strategy"
"Exit now?",
"Move stop loss",
"Fresh analysis",
"Risk check",
"status"
]
return (