iatoolkit 0.11.0__py3-none-any.whl → 0.11.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of iatoolkit might be problematic. Click here for more details.
- iatoolkit/services/branding_service.py +2 -1
- iatoolkit/static/js/chat_history.js +1 -0
- iatoolkit/static/js/chat_main.js +76 -51
- iatoolkit/static/styles/chat_iatoolkit.css +17 -1
- iatoolkit/templates/chat.html +1 -0
- {iatoolkit-0.11.0.dist-info → iatoolkit-0.11.1.dist-info}/METADATA +1 -1
- {iatoolkit-0.11.0.dist-info → iatoolkit-0.11.1.dist-info}/RECORD +9 -9
- {iatoolkit-0.11.0.dist-info → iatoolkit-0.11.1.dist-info}/WHEEL +0 -0
- {iatoolkit-0.11.0.dist-info → iatoolkit-0.11.1.dist-info}/top_level.txt +0 -0
|
@@ -104,5 +104,6 @@ class BrandingService:
|
|
|
104
104
|
"secondary_text_style": secondary_text_style,
|
|
105
105
|
"tertiary_text_style": tertiary_text_style,
|
|
106
106
|
"header_text_color": final_branding_values['header_text_color'],
|
|
107
|
-
"css_variables": css_variables
|
|
107
|
+
"css_variables": css_variables,
|
|
108
|
+
"send_button_color": final_branding_values['send_button_color']
|
|
108
109
|
}
|
iatoolkit/static/js/chat_main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Global variables for request management
|
|
2
|
-
let currentAbortController = null;
|
|
3
2
|
let isRequestInProgress = false;
|
|
3
|
+
let abortController = null;
|
|
4
4
|
|
|
5
5
|
let selectedPrompt = null; // Will hold a lightweight prompt object
|
|
6
6
|
|
|
@@ -8,6 +8,8 @@ $(document).ready(function () {
|
|
|
8
8
|
// --- MAIN EVENT HANDLERS ---
|
|
9
9
|
$('#send-button').on('click', handleChatMessage);
|
|
10
10
|
$('#stop-button').on('click', abortCurrentRequest);
|
|
11
|
+
if (window.sendButtonColor)
|
|
12
|
+
$('#send-button i').css('color', window.sendButtonColor);
|
|
11
13
|
|
|
12
14
|
// --- PROMPT ASSISTANT FUNCTIONALITY ---
|
|
13
15
|
$('.input-area').on('click', '.dropdown-menu a.dropdown-item', function (event) {
|
|
@@ -118,75 +120,99 @@ function renderDynamicInputs(fields) {
|
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
|
|
123
|
+
|
|
121
124
|
/**
|
|
122
125
|
* Main function to handle sending a chat message.
|
|
123
126
|
*/
|
|
124
127
|
const handleChatMessage = async function () {
|
|
125
|
-
if (isRequestInProgress || $('#send-button').hasClass('disabled'))
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const promptName = selectedPrompt ? selectedPrompt.prompt : null;
|
|
128
|
+
if (isRequestInProgress || $('#send-button').hasClass('disabled')) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
129
131
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const clientData = {};
|
|
132
|
+
isRequestInProgress = true;
|
|
133
|
+
toggleSendStopButtons(true);
|
|
133
134
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
try {
|
|
136
|
+
const question = $('#question').val().trim();
|
|
137
|
+
const promptName = selectedPrompt ? selectedPrompt.prompt : null;
|
|
137
138
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
clientData[field.data_key] = value;
|
|
142
|
-
}
|
|
143
|
-
});
|
|
139
|
+
let displayMessage = question;
|
|
140
|
+
let isEditable = true;
|
|
141
|
+
const clientData = {};
|
|
144
142
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
if (selectedPrompt) {
|
|
144
|
+
displayMessage = selectedPrompt.description;
|
|
145
|
+
isEditable = false;
|
|
146
|
+
|
|
147
|
+
(selectedPrompt.custom_fields || []).forEach(field => {
|
|
148
|
+
const value = $('#' + field.data_key + '-id').val().trim();
|
|
149
|
+
if (value) {
|
|
150
|
+
clientData[field.data_key] = value;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
const paramsString = Object.values(clientData).join(', ');
|
|
155
|
+
if (paramsString) { displayMessage += `: ${paramsString}`; }
|
|
149
156
|
}
|
|
150
|
-
}
|
|
151
157
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
toggleSendStopButtons(true);
|
|
158
|
+
// Simplificado: Si no hay mensaje, el 'finally' se encargará de limpiar.
|
|
159
|
+
// Simplemente salimos de la función.
|
|
160
|
+
if (!displayMessage) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
158
163
|
|
|
159
|
-
|
|
164
|
+
displayUserMessage(displayMessage, isEditable, question);
|
|
165
|
+
showSpinner();
|
|
166
|
+
resetAllInputs();
|
|
160
167
|
|
|
161
|
-
|
|
162
|
-
|
|
168
|
+
const files = window.filePond.getFiles();
|
|
169
|
+
const filesBase64 = await Promise.all(files.map(fileItem => toBase64(fileItem.file)));
|
|
163
170
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
};
|
|
171
|
+
const data = {
|
|
172
|
+
question: question,
|
|
173
|
+
prompt_name: promptName,
|
|
174
|
+
client_data: clientData,
|
|
175
|
+
files: filesBase64.map(f => ({ filename: f.name, content: f.base64 })),
|
|
176
|
+
external_user_id: window.externalUserId
|
|
177
|
+
};
|
|
172
178
|
|
|
173
|
-
try {
|
|
174
179
|
const responseData = await callLLMAPI("/llm_query", data, "POST");
|
|
175
180
|
if (responseData && responseData.answer) {
|
|
176
181
|
const answerSection = $('<div>').addClass('answer-section llm-output').append(responseData.answer);
|
|
177
182
|
displayBotMessage(answerSection);
|
|
178
183
|
}
|
|
179
184
|
} catch (error) {
|
|
180
|
-
|
|
181
|
-
|
|
185
|
+
if (error.name === 'AbortError') {
|
|
186
|
+
console.log('Petición abortada por el usuario.');
|
|
187
|
+
|
|
188
|
+
// Usando jQuery estándar para construir el elemento ---
|
|
189
|
+
const icon = $('<i>').addClass('bi bi-stop-circle me-2'); // Icono sin "fill" para un look más ligero
|
|
190
|
+
const textSpan = $('<span>').text('La generación de la respuesta ha sido detenida.');
|
|
191
|
+
|
|
192
|
+
const abortMessage = $('<div>')
|
|
193
|
+
.addClass('system-message')
|
|
194
|
+
.append(icon)
|
|
195
|
+
.append(textSpan);
|
|
196
|
+
|
|
197
|
+
displayBotMessage(abortMessage);
|
|
198
|
+
} else {
|
|
199
|
+
console.error("Error in handleChatMessage:", error);
|
|
200
|
+
const errorSection = $('<div>').addClass('error-section').append('<p>Ocurrió un error al procesar la solicitud.</p>');
|
|
201
|
+
displayBotMessage(errorSection);
|
|
202
|
+
}
|
|
182
203
|
} finally {
|
|
204
|
+
// Este bloque se ejecuta siempre, garantizando que el estado se limpie.
|
|
205
|
+
isRequestInProgress = false;
|
|
183
206
|
hideSpinner();
|
|
184
207
|
toggleSendStopButtons(false);
|
|
185
208
|
updateSendButtonState();
|
|
186
|
-
window.filePond
|
|
209
|
+
if (window.filePond) {
|
|
210
|
+
window.filePond.removeFiles();
|
|
211
|
+
}
|
|
187
212
|
}
|
|
188
213
|
};
|
|
189
214
|
|
|
215
|
+
|
|
190
216
|
/**
|
|
191
217
|
* Resets all inputs to their initial state.
|
|
192
218
|
*/
|
|
@@ -274,16 +300,15 @@ const callLLMAPI = async function(apiPath, data, method, timeoutMs = 500000) {
|
|
|
274
300
|
headers['X-Chat-Token'] = window.sessionJWT;
|
|
275
301
|
}
|
|
276
302
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
303
|
+
abortController = new AbortController();
|
|
304
|
+
const timeoutId = setTimeout(() => abortController.abort(), timeoutMs);
|
|
280
305
|
|
|
281
306
|
try {
|
|
282
307
|
const response = await fetch(url, {
|
|
283
308
|
method: method,
|
|
284
309
|
headers: headers,
|
|
285
310
|
body: JSON.stringify(data),
|
|
286
|
-
signal:
|
|
311
|
+
signal: abortController.signal, // Se usa el signal del controlador global
|
|
287
312
|
credentials: 'include'
|
|
288
313
|
});
|
|
289
314
|
clearTimeout(timeoutId);
|
|
@@ -325,7 +350,8 @@ const displayUserMessage = function(message, isEditable, originalQuestion) {
|
|
|
325
350
|
const editIcon = $('<i>').addClass('p-2 bi bi-pencil-fill edit-icon').attr('title', 'Edit query').on('click', function () {
|
|
326
351
|
$('#question').val(originalQuestion).focus();
|
|
327
352
|
autoResizeTextarea($('#question')[0]);
|
|
328
|
-
|
|
353
|
+
|
|
354
|
+
$('#send-button').removeClass('disabled');
|
|
329
355
|
});
|
|
330
356
|
userMessage.append(editIcon);
|
|
331
357
|
}
|
|
@@ -347,9 +373,8 @@ function displayBotMessage(section) {
|
|
|
347
373
|
* Aborts the current in-progress API request.
|
|
348
374
|
*/
|
|
349
375
|
const abortCurrentRequest = function () {
|
|
350
|
-
if (
|
|
351
|
-
|
|
352
|
-
currentAbortController.abort();
|
|
376
|
+
if (isRequestInProgress && abortController) {
|
|
377
|
+
abortController.abort();
|
|
353
378
|
}
|
|
354
379
|
};
|
|
355
380
|
|
|
@@ -186,6 +186,20 @@
|
|
|
186
186
|
box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
/* Estilo para mensajes sutiles del sistema (ej. abortado) */
|
|
190
|
+
.system-message {
|
|
191
|
+
color: var(--brand-secondary-color, #6c757d); /* Usa el color secundario o un gris por defecto */
|
|
192
|
+
font-style: italic;
|
|
193
|
+
font-size: 0.9rem;
|
|
194
|
+
display: flex;
|
|
195
|
+
align-items: center;
|
|
196
|
+
justify-content: start;
|
|
197
|
+
margin: 10px 0;
|
|
198
|
+
padding: 10px;
|
|
199
|
+
opacity: 0.8;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
|
|
189
203
|
#prompt-assistant-collapse .card {
|
|
190
204
|
border-radius: 1.5rem; /* Mismo radio que el chat-input-bar */
|
|
191
205
|
border: 1px solid #dee2e6; /* Mismo borde que el chat-input-bar */
|
|
@@ -233,7 +247,6 @@
|
|
|
233
247
|
|
|
234
248
|
/* 6. Anulación específica para el botón de ENVIAR usando su ID (Máxima Prioridad) */
|
|
235
249
|
#send-button i {
|
|
236
|
-
color: var(--brand-send-button-color); /* Usa la variable de branding */
|
|
237
250
|
font-size: 1.7rem; /* Ligeramente más grande */
|
|
238
251
|
}
|
|
239
252
|
#send-button:hover i {
|
|
@@ -421,4 +434,7 @@
|
|
|
421
434
|
color: #ffc107;
|
|
422
435
|
}
|
|
423
436
|
|
|
437
|
+
#send-button i {
|
|
438
|
+
color: var(--brand-send-button-color);
|
|
439
|
+
}
|
|
424
440
|
|
iatoolkit/templates/chat.html
CHANGED
|
@@ -164,6 +164,7 @@
|
|
|
164
164
|
window.iatoolkit_base_url = "{{ iatoolkit_base_url }}";
|
|
165
165
|
window.externalUserId = "{{ external_user_id }}";
|
|
166
166
|
window.availablePrompts = {{ prompts.message | tojson }};
|
|
167
|
+
window.sendButtonColor = "{{ branding.send_button_color }}";
|
|
167
168
|
|
|
168
169
|
{% if auth_method == 'jwt' and session_jwt %}
|
|
169
170
|
// Store session JWT if it exists, defined in the same global scope
|
|
@@ -36,7 +36,7 @@ iatoolkit/repositories/tasks_repo.py,sha256=icVO_r2oPagGnnBhwVFzznnvEEU2EAx-2dlW
|
|
|
36
36
|
iatoolkit/repositories/vs_repo.py,sha256=UkpmQQiocgM5IwRBmmWhw3HHzHP6zK1nN3J3TcQgjhc,5300
|
|
37
37
|
iatoolkit/services/__init__.py,sha256=5JqK9sZ6jBuK83zDQokUhxQ0wuJJJ9DXB8pYCLkX7X4,102
|
|
38
38
|
iatoolkit/services/benchmark_service.py,sha256=CdbFYyS3FHFhNzWQEa9ZNjUlmON10DT1nKNbZQ1EUi8,5880
|
|
39
|
-
iatoolkit/services/branding_service.py,sha256=
|
|
39
|
+
iatoolkit/services/branding_service.py,sha256=iYjlUy-5X-x2F6Yg9C70FTMjuItBaUYVHcrXgiKuDbA,4976
|
|
40
40
|
iatoolkit/services/dispatcher_service.py,sha256=ykR1ye6McyCCuaBgwH6r3-PqcLAr4v4ApkPazMSBzbs,14040
|
|
41
41
|
iatoolkit/services/document_service.py,sha256=nMXrNtbHQuc9pSaten0LvKY0kT8_WngBDmZJUP3jNPw,5936
|
|
42
42
|
iatoolkit/services/excel_service.py,sha256=CJGhu7cQl9J6y_ZWSJ-M63Xm-RXR9Zs66oOR2NJErZQ,3868
|
|
@@ -64,9 +64,9 @@ iatoolkit/static/images/logo_umayor.png,sha256=FHr1wvI8uDn1YRbRcLSRLBOc0mYusHx9U
|
|
|
64
64
|
iatoolkit/static/images/upload.png,sha256=zh5FiINURpaWZQF86bF_gALBX4W1c4aLp5wPQO9xGXI,296
|
|
65
65
|
iatoolkit/static/js/chat_feedback.js,sha256=_izl49hFEUZYREcJoaPukpTs0YjDgJYUu-QfPt5Ll2s,4398
|
|
66
66
|
iatoolkit/static/js/chat_filepond.js,sha256=mzXafm7a506EpM37KATTK3zvAswO1E0KSUY1vKbwuRc,3163
|
|
67
|
-
iatoolkit/static/js/chat_history.js,sha256=
|
|
68
|
-
iatoolkit/static/js/chat_main.js,sha256=
|
|
69
|
-
iatoolkit/static/styles/chat_iatoolkit.css,sha256=
|
|
67
|
+
iatoolkit/static/js/chat_history.js,sha256=G01rKSXOpLpIavycGPbfpfYg5vmPrLhkHYbCLhY3_zs,3964
|
|
68
|
+
iatoolkit/static/js/chat_main.js,sha256=BLKN5a3xP2uu0z6iF6qmgIpT1vClaZf3apcAVQBhU0g,16229
|
|
69
|
+
iatoolkit/static/styles/chat_iatoolkit.css,sha256=z1sYkvredKjU4Ag75ZB8CzsRGHi3t69vgxVW6rjSBMU,10073
|
|
70
70
|
iatoolkit/static/styles/chat_info.css,sha256=17DbgoNYE21VYWfb5L9-QLCpD2R1idK4imKRLwXtJLY,1058
|
|
71
71
|
iatoolkit/static/styles/chat_modal.css,sha256=pE7JY5D63Ds_d2FKdmxym4sevvg-2Mf7yo-gB7KA9vE,3730
|
|
72
72
|
iatoolkit/static/styles/llm_output.css,sha256=AlxgRSOleeCk2dLAqFWVaQ-jwZiJjcpC5rHuUv3T6VU,2312
|
|
@@ -76,7 +76,7 @@ iatoolkit/system_prompts/sql_rules.prompt,sha256=y4nURVnb9AyFwt-lrbMNBHHtZlhk6kC
|
|
|
76
76
|
iatoolkit/templates/about.html,sha256=ciC08grUVz5qLzdzDDqDX31xirg5PrJIRYabWpV9oA8,294
|
|
77
77
|
iatoolkit/templates/base.html,sha256=LXXB8oPrcBFkf2pLfOSyAaSh66kHbs4SEujpFL3h9Nw,2163
|
|
78
78
|
iatoolkit/templates/change_password.html,sha256=DFfQSFcZ2YJZNFis2IXfzEKStxTf4i9f4eQ_6GiyNs8,2342
|
|
79
|
-
iatoolkit/templates/chat.html,sha256=
|
|
79
|
+
iatoolkit/templates/chat.html,sha256=xaQk5McHRO8VF2LCBbr4vT0d2fFNy2GW61DwCYht-_M,9371
|
|
80
80
|
iatoolkit/templates/chat_modals.html,sha256=3CQ430bwhebq6rAJ6Bk12PQDjt9YenqNXm5thC5WP2Y,5771
|
|
81
81
|
iatoolkit/templates/error.html,sha256=BNF-7z8AYL5vF4ZMUFMrOBt8c85kCFrm9qSHn9EiHWg,540
|
|
82
82
|
iatoolkit/templates/forgot_password.html,sha256=1lUbKg9CKnQdnySplceY_pibwYne1-mOlM38fqI1kW8,1563
|
|
@@ -104,7 +104,7 @@ iatoolkit/views/tasks_review_view.py,sha256=keLsLCyOTTlcoIapnB_lbuSvLwrPVZVpBiFC
|
|
|
104
104
|
iatoolkit/views/tasks_view.py,sha256=a3anTXrJTTvbQuc6PSpOzidLKQFL4hWa7PI2Cppcz8w,4110
|
|
105
105
|
iatoolkit/views/user_feedback_view.py,sha256=G37zmP8P4LvZrSymNJ5iFXhLZg1A3BEwRfTpH1Iam5w,2652
|
|
106
106
|
iatoolkit/views/verify_user_view.py,sha256=a3q4wHJ8mKAEmgbNTOcnX4rMikROjOR3mHvCr30qGGA,2351
|
|
107
|
-
iatoolkit-0.11.
|
|
108
|
-
iatoolkit-0.11.
|
|
109
|
-
iatoolkit-0.11.
|
|
110
|
-
iatoolkit-0.11.
|
|
107
|
+
iatoolkit-0.11.1.dist-info/METADATA,sha256=5vmAxDm05jysqCbNZe1lJqpc3N--YhpxBizGrQ1-CJ8,9301
|
|
108
|
+
iatoolkit-0.11.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
109
|
+
iatoolkit-0.11.1.dist-info/top_level.txt,sha256=V_w4QvDx0b1RXiy8zTCrD1Bp7AZkFe3_O0-9fMiwogg,10
|
|
110
|
+
iatoolkit-0.11.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|