✅ Problema solucionado - Backend v1.2.6 / Frontend v1.2.8
Cambios implementados: Frontend: Ahora envía context_answers con todas las respuestas de preguntas anteriores (texto + observaciones) Incluye el texto de la pregunta para mejor contexto Funciona con la configuración de IDs de preguntas o todas las anteriores Backend: Recibe y procesa context_answers Agrega sección "RESPUESTAS DE PREGUNTAS ANTERIORES" al system prompt Muestra pregunta, respuesta y observaciones de cada pregunta previa
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "checklist-frontend",
|
||||
"private": true,
|
||||
"version": "1.2.7",
|
||||
"version": "1.2.8",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Service Worker para PWA con detección de actualizaciones
|
||||
// IMPORTANTE: Actualizar esta versión cada vez que se despliegue una nueva versión
|
||||
const CACHE_NAME = 'ayutec-v1.2.7';
|
||||
const CACHE_NAME = 'ayutec-v1.2.8';
|
||||
const urlsToCache = [
|
||||
'/',
|
||||
'/index.html'
|
||||
|
||||
@@ -5632,6 +5632,7 @@ function AIAssistantChatModal({ question, inspection, allAnswers, messages, setM
|
||||
|
||||
// Recopilar fotos de preguntas anteriores según configuración
|
||||
const contextPhotos = []
|
||||
const contextAnswers = [] // NUEVO: respuestas de texto de preguntas anteriores
|
||||
const contextQuestionIds = config.context_questions
|
||||
? config.context_questions.split(',').map(id => parseInt(id.trim()))
|
||||
: Object.keys(allAnswers).map(id => parseInt(id))
|
||||
@@ -5641,6 +5642,8 @@ function AIAssistantChatModal({ question, inspection, allAnswers, messages, setM
|
||||
|
||||
previousQuestionIds.forEach(qId => {
|
||||
const answer = allAnswers[qId]
|
||||
|
||||
// Agregar fotos si existen
|
||||
if (answer?.photos && answer.photos.length > 0) {
|
||||
answer.photos.forEach(photoUrl => {
|
||||
contextPhotos.push({
|
||||
@@ -5650,9 +5653,22 @@ function AIAssistantChatModal({ question, inspection, allAnswers, messages, setM
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// NUEVO: Agregar respuestas de texto (incluyendo observations)
|
||||
if (answer?.value || answer?.observations) {
|
||||
// Buscar la pregunta para obtener su texto
|
||||
const questionData = inspection.checklist.questions.find(q => q.id === qId)
|
||||
contextAnswers.push({
|
||||
questionId: qId,
|
||||
questionText: questionData?.text || `Pregunta ${qId}`,
|
||||
answer: answer.value || '',
|
||||
observations: answer.observations || ''
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
formData.append('context_photos', JSON.stringify(contextPhotos))
|
||||
formData.append('context_answers', JSON.stringify(contextAnswers)) // NUEVO
|
||||
formData.append('vehicle_info', JSON.stringify({
|
||||
brand: inspection.vehicle_brand,
|
||||
model: inspection.vehicle_model,
|
||||
|
||||
@@ -153,7 +153,7 @@ export default function Sidebar({ user, activeTab, setActiveTab, sidebarOpen, se
|
||||
className="w-10 h-10 object-contain bg-white rounded p-1"
|
||||
/>
|
||||
<p className="text-xs text-indigo-300 font-medium hover:text-indigo-200">
|
||||
Ayutec v1.2.7
|
||||
Ayutec v1.2.8
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user