Files
trading_bot_v3/test-direct-analysis.mjs
mindesbunister 483d4c6576 🔧 Fix AI Analysis Service - Improved Prompts & Error Handling
 FIXED: AI analysis prompts to bypass OpenAI safety guardrails
 FIXED: Added technical analysis focus instead of trading advice tone
 FIXED: Improved JSON parsing and error handling
 ADDED: Option to use existing screenshots for testing (useExisting param)
 IMPROVED: Better image detail settings and temperature for consistency

🐛 DEBUGGING: Still investigating why AI claims it can't see images
- OpenAI vision capabilities confirmed working with public images
- Model gpt-4o has proper vision support
- Issue appears to be with chart image content or encoding

🎯 NEXT: Debug image encoding and model response inconsistency
2025-07-12 15:08:24 +02:00

38 lines
1.1 KiB
JavaScript

import { aiAnalysisService } from '../lib/ai-analysis.js'
import fs from 'fs'
async function testDirectAnalysis() {
try {
console.log('🧪 Testing AI analysis with existing screenshot...')
const screenshotDir = '/app/screenshots'
const screenshots = fs.readdirSync(screenshotDir).filter(f =>
f.includes('SOLUSD_60') && f.endsWith('.png') && !f.includes('debug')
)
console.log('📸 Available screenshots:', screenshots)
if (screenshots.length > 0) {
const filename = screenshots[0]
console.log(`🔍 Analyzing: ${filename}`)
const result = await aiAnalysisService.analyzeScreenshot(filename)
if (result) {
console.log('✅ Analysis successful!')
console.log('📊 Analysis result:')
console.log(JSON.stringify(result, null, 2))
} else {
console.log('❌ Analysis failed - returned null')
}
} else {
console.log('❌ No suitable screenshots found')
}
} catch (error) {
console.error('❌ Error in direct analysis test:', error)
}
}
testDirectAnalysis()