custom promtp no esstaba funcionando
This commit is contained in:
@@ -3032,13 +3032,13 @@ function InspectionModal({ checklist, user, onClose, onComplete }) {
|
||||
const filesArray = Array.from(files)
|
||||
|
||||
// Update photos immediately
|
||||
setAnswers({
|
||||
...answers,
|
||||
setAnswers(prev => ({
|
||||
...prev,
|
||||
[questionId]: {
|
||||
...answers[questionId],
|
||||
...(prev[questionId] || { value: '', observations: '', photos: [] }),
|
||||
photos: filesArray
|
||||
}
|
||||
})
|
||||
}))
|
||||
|
||||
// If AI mode is assisted or full, analyze the photos
|
||||
if ((checklist.ai_mode === 'assisted' || checklist.ai_mode === 'full') && filesArray.length > 0) {
|
||||
@@ -3050,6 +3050,10 @@ function InspectionModal({ checklist, user, onClose, onComplete }) {
|
||||
const question = questions.find(q => q.id === questionId)
|
||||
if (!question) return
|
||||
|
||||
console.log('🔍 Iniciando análisis IA para pregunta:', questionId)
|
||||
console.log('📸 Archivos a analizar:', files.length)
|
||||
console.log('🎯 Modo IA del checklist:', checklist.ai_mode)
|
||||
|
||||
setAiAnalyzing(true)
|
||||
|
||||
try {
|
||||
@@ -3106,9 +3110,11 @@ function InspectionModal({ checklist, user, onClose, onComplete }) {
|
||||
}
|
||||
|
||||
if (analyses.length > 0) {
|
||||
console.log('✅ Análisis recibidos:', analyses.length)
|
||||
// Process analysis results
|
||||
const firstResult = analyses[0]
|
||||
const analysis = firstResult.analysis
|
||||
console.log('📊 Análisis completo:', analysis)
|
||||
let suggestedAnswer = null
|
||||
let observationsText = ''
|
||||
|
||||
@@ -3193,6 +3199,19 @@ function InspectionModal({ checklist, user, onClose, onComplete }) {
|
||||
console.log(`🤖 ASSISTED MODE: Sugerencia agregada a observaciones`)
|
||||
console.log(`📝 Observaciones guardadas:`, `${suggestedAnswer ? `[IA Sugiere: ${suggestedAnswer}]\n` : ''}${observationsText}`)
|
||||
}
|
||||
// Siempre guardar observaciones incluso si no hay modo específico o sugerencia
|
||||
else if (observationsText) {
|
||||
setAnswers(prev => ({
|
||||
...prev,
|
||||
[questionId]: {
|
||||
...(prev[questionId] || { value: '', observations: '', photos: [] }),
|
||||
observations: observationsText,
|
||||
photos: files,
|
||||
aiAnalysis: firstResult.analysis
|
||||
}
|
||||
}))
|
||||
console.log(`🤖 Análisis IA guardado en observaciones:`, observationsText)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('❌ Error al analizar fotos con IA:', error)
|
||||
|
||||
Reference in New Issue
Block a user