Actualizar configuracion.html
This commit is contained in:
@@ -151,13 +151,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<div class="p-4 border-b border-slate-100 mb-2 bg-slate-50">
|
||||
<label class="block text-sm font-medium text-gray-700">Instrucciones extra para la IA (Opcional)</label>
|
||||
<p class="text-xs text-gray-500 mb-2">Dale personalidad o reglas específicas a tu asistente (ej: "Avisa que cobramos desplazamiento", "Despídete siempre con un '¡Un saludo!'").</p>
|
||||
<textarea id="ai_custom_prompt" rows="3" class="w-full border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm" placeholder="Escribe aquí las reglas personalizadas para tu empresa..."></textarea>
|
||||
<p class="text-xs text-gray-500 mb-2">Dale personalidad o reglas específicas a tu asistente.</p>
|
||||
<textarea id="ai_custom_prompt" rows="3" class="w-full border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm p-2" placeholder="Escribe aquí las reglas personalizadas..."></textarea>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="p-4 hover:bg-slate-50 transition-colors flex items-center justify-between border-b border-slate-100">
|
||||
<div>
|
||||
<p class="font-bold text-slate-700 text-sm">Modo "Escribiendo..."</p>
|
||||
@@ -252,7 +251,6 @@
|
||||
<label for="cfg_evt_survey" class="toggle-label block overflow-hidden h-6 rounded-full bg-slate-200 cursor-pointer"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -428,11 +426,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<label class="block text-xs font-bold text-slate-600 mb-1">Texto para "Observaciones"</label>
|
||||
<textarea id="hs_cfg_date_obs" rows="2" class="w-full border border-slate-300 rounded-lg p-3 text-sm outline-none focus:border-red-500" placeholder="Ej: Cita confirmada con el cliente para el {{FECHA}} a las {{HORA}}."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-xl shadow-sm border border-slate-200 overflow-hidden">
|
||||
<div class="p-4 bg-slate-50 border-b border-slate-200 flex justify-between items-center">
|
||||
@@ -722,6 +715,9 @@
|
||||
let cachedTemplates = {};
|
||||
let currentTemplateType = null;
|
||||
let localGuilds = [];
|
||||
const API_URL = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'
|
||||
? 'http://localhost:3000'
|
||||
: 'https://integrarepara-api.integrarepara.es';
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
if (!localStorage.getItem("token")) window.location.href = "index.html";
|
||||
@@ -754,7 +750,7 @@
|
||||
if(tabId === 'providers') {
|
||||
loadProviderCredentials();
|
||||
loadIaRules();
|
||||
loadRobotConfig(); // 👇 ¡AQUÍ ESTABA EL FALLO! Faltaba llamar a esta función
|
||||
loadRobotConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -915,12 +911,10 @@
|
||||
const data = await res.json();
|
||||
const s = data.settings || {};
|
||||
|
||||
// Cargar el estado del nuevo botón de IA
|
||||
if(document.getElementById('cfg_ai_enabled')) {
|
||||
document.getElementById('cfg_ai_enabled').checked = s.wa_ai_enabled || false;
|
||||
}
|
||||
|
||||
// 👇 NUEVO: Cargar el texto de las instrucciones extra
|
||||
if(document.getElementById('ai_custom_prompt')) {
|
||||
document.getElementById('ai_custom_prompt').value = s.ai_custom_prompt || "";
|
||||
}
|
||||
@@ -937,12 +931,8 @@
|
||||
|
||||
async function saveWaSettings() {
|
||||
const settings = {
|
||||
// Guardar el valor de la IA
|
||||
wa_ai_enabled: document.getElementById('cfg_ai_enabled').checked,
|
||||
|
||||
// 👇 NUEVO: Guardar el texto de las instrucciones extra
|
||||
ai_custom_prompt: document.getElementById('ai_custom_prompt') ? document.getElementById('ai_custom_prompt').value : "",
|
||||
|
||||
wa_delay_enabled: document.getElementById('cfg_delay').checked,
|
||||
wa_evt_welcome: document.getElementById('cfg_evt_welcome').checked,
|
||||
wa_evt_assigned: document.getElementById('cfg_evt_assigned').checked,
|
||||
@@ -1214,7 +1204,7 @@
|
||||
// Cargar Asignación
|
||||
if (hsSettings.assign) {
|
||||
document.getElementById('hs_cfg_assign_enabled').checked = hsSettings.assign.enabled;
|
||||
document.getElementById('hs_cfg_assign_status').value = hsSettings.assign.status || "307"; // 307: Espera profesional inicio
|
||||
document.getElementById('hs_cfg_assign_status').value = hsSettings.assign.status || "307";
|
||||
document.getElementById('hs_cfg_assign_days').value = hsSettings.assign.days_next ?? 1;
|
||||
document.getElementById('hs_cfg_assign_inform').checked = hsSettings.assign.check_inform || false;
|
||||
document.getElementById('hs_cfg_assign_obs').value = hsSettings.assign.obs || "";
|
||||
@@ -1224,8 +1214,7 @@
|
||||
// Cargar Cita
|
||||
if (hsSettings.date) {
|
||||
document.getElementById('hs_cfg_date_enabled').checked = hsSettings.date.enabled;
|
||||
document.getElementById('hs_cfg_date_status').value = hsSettings.date.status || "307"; // 307: Concertado
|
||||
document.getElementById('hs_cfg_date_days').value = hsSettings.date.days_next ?? 0;
|
||||
document.getElementById('hs_cfg_date_status').value = hsSettings.date.status || "307";
|
||||
document.getElementById('hs_cfg_date_inform').checked = hsSettings.date.check_inform || false;
|
||||
document.getElementById('hs_cfg_date_obs').value = hsSettings.date.obs || "";
|
||||
toggleHsConfig('date');
|
||||
@@ -1234,7 +1223,7 @@
|
||||
// Cargar No Localizado
|
||||
if (hsSettings.notfound) {
|
||||
document.getElementById('hs_cfg_notfound_enabled').checked = hsSettings.notfound.enabled;
|
||||
document.getElementById('hs_cfg_notfound_status').value = hsSettings.notfound.status || "348"; // 348: Espera cliente
|
||||
document.getElementById('hs_cfg_notfound_status').value = hsSettings.notfound.status || "348";
|
||||
document.getElementById('hs_cfg_notfound_days').value = hsSettings.notfound.days_next ?? 1;
|
||||
document.getElementById('hs_cfg_notfound_inform').checked = hsSettings.notfound.check_inform || false;
|
||||
document.getElementById('hs_cfg_notfound_obs').value = hsSettings.notfound.obs || "";
|
||||
@@ -1261,7 +1250,6 @@
|
||||
date: {
|
||||
enabled: document.getElementById('hs_cfg_date_enabled').checked,
|
||||
status: document.getElementById('hs_cfg_date_status').value,
|
||||
// Ya no guardamos "days_next" aquí, el servidor usará la fecha de la cita
|
||||
check_inform: document.getElementById('hs_cfg_date_inform').checked,
|
||||
obs: document.getElementById('hs_cfg_date_obs').value
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user