iatoolkit 0.16.7__tar.gz → 0.18.0__tar.gz

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.

Files changed (117) hide show
  1. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/PKG-INFO +1 -1
  2. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/pyproject.toml +1 -1
  3. iatoolkit-0.18.0/src/iatoolkit/static/js/chat_history.js +133 -0
  4. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/static/js/chat_main.js +18 -4
  5. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/static/styles/chat_iatoolkit.css +18 -19
  6. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/static/styles/chat_modal.css +18 -0
  7. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/templates/chat.html +2 -1
  8. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/templates/chat_modals.html +4 -7
  9. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit.egg-info/PKG-INFO +1 -1
  10. iatoolkit-0.16.7/src/iatoolkit/static/js/chat_history.js +0 -118
  11. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/readme.md +0 -0
  12. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/requirements.txt +0 -0
  13. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/setup.cfg +0 -0
  14. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/__init__.py +0 -0
  15. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/base_company.py +0 -0
  16. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/cli_commands.py +0 -0
  17. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/common/__init__.py +0 -0
  18. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/common/auth.py +0 -0
  19. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/common/exceptions.py +0 -0
  20. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/common/routes.py +0 -0
  21. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/common/session_manager.py +0 -0
  22. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/common/util.py +0 -0
  23. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/company_registry.py +0 -0
  24. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/iatoolkit.py +0 -0
  25. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/__init__.py +0 -0
  26. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/call_service.py +0 -0
  27. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/connectors/__init__.py +0 -0
  28. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/connectors/file_connector.py +0 -0
  29. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/connectors/file_connector_factory.py +0 -0
  30. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/connectors/google_cloud_storage_connector.py +0 -0
  31. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/connectors/google_drive_connector.py +0 -0
  32. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/connectors/local_file_connector.py +0 -0
  33. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/connectors/s3_connector.py +0 -0
  34. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/gemini_adapter.py +0 -0
  35. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/google_chat_app.py +0 -0
  36. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/llm_client.py +0 -0
  37. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/llm_proxy.py +0 -0
  38. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/llm_response.py +0 -0
  39. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/mail_app.py +0 -0
  40. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/openai_adapter.py +0 -0
  41. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/infra/redis_session_manager.py +0 -0
  42. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/repositories/__init__.py +0 -0
  43. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/repositories/database_manager.py +0 -0
  44. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/repositories/document_repo.py +0 -0
  45. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/repositories/llm_query_repo.py +0 -0
  46. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/repositories/models.py +0 -0
  47. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/repositories/profile_repo.py +0 -0
  48. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/repositories/tasks_repo.py +0 -0
  49. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/repositories/vs_repo.py +0 -0
  50. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/__init__.py +0 -0
  51. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/benchmark_service.py +0 -0
  52. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/branding_service.py +0 -0
  53. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/dispatcher_service.py +0 -0
  54. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/document_service.py +0 -0
  55. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/excel_service.py +0 -0
  56. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/file_processor_service.py +0 -0
  57. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/history_service.py +0 -0
  58. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/jwt_service.py +0 -0
  59. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/load_documents_service.py +0 -0
  60. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/mail_service.py +0 -0
  61. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/onboarding_service.py +0 -0
  62. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/profile_service.py +0 -0
  63. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/prompt_manager_service.py +0 -0
  64. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/query_service.py +0 -0
  65. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/search_service.py +0 -0
  66. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/sql_service.py +0 -0
  67. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/tasks_service.py +0 -0
  68. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/user_feedback_service.py +0 -0
  69. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/services/user_session_context_service.py +0 -0
  70. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/static/images/arrow_up.png +0 -0
  71. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/static/images/diagrama_iatoolkit.jpg +0 -0
  72. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/static/images/logo_clinica.png +0 -0
  73. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/static/images/logo_iatoolkit.png +0 -0
  74. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/static/images/logo_maxxa.png +0 -0
  75. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/static/images/logo_notaria.png +0 -0
  76. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/static/images/logo_tarjeta.png +0 -0
  77. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/static/images/logo_umayor.png +0 -0
  78. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/static/images/upload.png +0 -0
  79. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/static/js/chat_feedback.js +0 -0
  80. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/static/js/chat_filepond.js +0 -0
  81. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/static/styles/chat_info.css +0 -0
  82. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/static/styles/llm_output.css +0 -0
  83. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/system_prompts/format_styles.prompt +0 -0
  84. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/system_prompts/query_main.prompt +0 -0
  85. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/system_prompts/sql_rules.prompt +0 -0
  86. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/templates/about.html +0 -0
  87. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/templates/base.html +0 -0
  88. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/templates/change_password.html +0 -0
  89. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/templates/error.html +0 -0
  90. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/templates/forgot_password.html +0 -0
  91. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/templates/header.html +0 -0
  92. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/templates/home.html +0 -0
  93. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/templates/login.html +0 -0
  94. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/templates/onboarding_shell.html +0 -0
  95. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/templates/signup.html +0 -0
  96. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/templates/test.html +0 -0
  97. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/__init__.py +0 -0
  98. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/change_password_view.py +0 -0
  99. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/chat_token_request_view.py +0 -0
  100. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/download_file_view.py +0 -0
  101. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/external_login_view.py +0 -0
  102. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/file_store_view.py +0 -0
  103. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/forgot_password_view.py +0 -0
  104. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/history_view.py +0 -0
  105. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/home_view.py +0 -0
  106. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/llmquery_view.py +0 -0
  107. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/login_view.py +0 -0
  108. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/prompt_view.py +0 -0
  109. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/signup_view.py +0 -0
  110. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/tasks_review_view.py +0 -0
  111. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/tasks_view.py +0 -0
  112. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/user_feedback_view.py +0 -0
  113. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit/views/verify_user_view.py +0 -0
  114. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit.egg-info/SOURCES.txt +0 -0
  115. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit.egg-info/dependency_links.txt +0 -0
  116. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit.egg-info/requires.txt +0 -0
  117. {iatoolkit-0.16.7 → iatoolkit-0.18.0}/src/iatoolkit.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iatoolkit
3
- Version: 0.16.7
3
+ Version: 0.18.0
4
4
  Summary: IAToolkit
5
5
  Author: Fernando Libedinsky
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "iatoolkit"
7
- version = "0.16.7"
7
+ version = "0.18.0"
8
8
  requires-python = ">=3.11"
9
9
  description = "IAToolkit"
10
10
  readme = "readme.md"
@@ -0,0 +1,133 @@
1
+ $(document).ready(function () {
2
+ // Evento para abrir el modal de historial
3
+ $('#history-button').on('click', function() {
4
+ loadHistory();
5
+ $('#historyModal').modal('show');
6
+ });
7
+
8
+ // Evento delegado para el icono de copiar.
9
+ // Se adjunta UNA SOLA VEZ al cuerpo de la tabla y funciona para todas las filas
10
+ // que se añadan dinámicamente.
11
+ $('#history-table-body').on('click', '.copy-query-icon', function() {
12
+ const queryText = $(this).data('query');
13
+
14
+ // Copiar el texto al textarea del chat
15
+ if (queryText) { // Buena práctica: Asegurarse de que el dato no es indefinido
16
+ $('#question').val(queryText);
17
+ autoResizeTextarea($('#question')[0]);
18
+ $('#send-button').removeClass('disabled');
19
+
20
+ // Cerrar el modal
21
+ $('#historyModal').modal('hide');
22
+
23
+ // Hacer focus en el textarea
24
+ $('#question').focus();
25
+ }
26
+ });
27
+
28
+ // Variables globales para el historial
29
+ let historyData = [];
30
+
31
+ // Función para cargar el historial
32
+ async function loadHistory() {
33
+ const historyLoading = $('#history-loading');
34
+ const historyError = $('#history-error');
35
+ const historyContent = $('#history-content');
36
+
37
+ // Mostrar loading
38
+ historyLoading.show();
39
+ historyError.hide();
40
+ historyContent.hide();
41
+
42
+ try {
43
+ const data = {
44
+ external_user_id: window.externalUserId
45
+ };
46
+
47
+ const responseData = await callLLMAPI("/history", data, "POST");
48
+
49
+ if (responseData && responseData.history) {
50
+ // Guardar datos globalmente
51
+ historyData = responseData.history;
52
+
53
+ // Mostrar todos los datos
54
+ displayAllHistory();
55
+
56
+ // Mostrar contenido
57
+ historyContent.show();
58
+ } else {
59
+ throw new Error('La respuesta del servidor no contenía el formato esperado.');
60
+ }
61
+ } catch (error) {
62
+ console.error("Error al cargar historial:", error);
63
+
64
+ const friendlyErrorMessage = "No hemos podido cargar tu historial en este momento. Por favor, cierra esta ventana y vuelve a intentarlo en unos instantes.";
65
+ const errorHtml = `
66
+ <div class="text-center p-4">
67
+ <i class="bi bi-exclamation-triangle text-danger" style="font-size: 2.5rem; opacity: 0.8;"></i>
68
+ <h5 class="mt-3 mb-2">Ocurrió un Problema</h5>
69
+ <p class="text-muted">${friendlyErrorMessage}</p>
70
+ </div>
71
+ `;
72
+ historyError.html(errorHtml).show();
73
+ } finally {
74
+ historyLoading.hide();
75
+ }
76
+ }
77
+
78
+ // Función para mostrar todo el historial
79
+ function displayAllHistory() {
80
+ const historyTableBody = $('#history-table-body');
81
+
82
+ // Limpiar tabla
83
+ historyTableBody.empty();
84
+
85
+ // Filtrar solo consultas que son strings simples
86
+ const filteredHistory = historyData.filter(item => {
87
+ try {
88
+ JSON.parse(item.query);
89
+ return false;
90
+ } catch (e) {
91
+ return true;
92
+ }
93
+ });
94
+
95
+ // Poblar tabla con un método más seguro
96
+ filteredHistory.forEach((item, index) => {
97
+ const icon = $('<i>').addClass('bi bi-pencil-fill');
98
+
99
+ const link = $('<a>')
100
+ .attr('href', 'javascript:void(0);')
101
+ .addClass('copy-query-icon')
102
+ .attr('title', 'Copiar consulta al chat')
103
+ .data('query', item.query) // Usar .data() es más seguro que un atributo de string
104
+ .append(icon);
105
+
106
+ const row = $('<tr>').append(
107
+ $('<td>').text(index + 1),
108
+ $('<td>').addClass('date-cell').text(formatDate(item.created_at)),
109
+ $('<td>').text(item.query), // Usar .text() para evitar inyección de HTML
110
+ $('<td>').addClass('text-center').append(link)
111
+ );
112
+
113
+ historyTableBody.append(row);
114
+ });
115
+
116
+ // El event handler ya no se adjunta aquí.
117
+ }
118
+
119
+ // Función para formatear fecha (sin cambios)
120
+ function formatDate(dateString) {
121
+ const date = new Date(dateString);
122
+
123
+ const padTo2Digits = (num) => num.toString().padStart(2, '0');
124
+
125
+ const day = padTo2Digits(date.getDate());
126
+ const month = padTo2Digits(date.getMonth() + 1);
127
+ const year = date.getFullYear();
128
+ const hours = padTo2Digits(date.getHours());
129
+ const minutes = padTo2Digits(date.getMinutes());
130
+
131
+ return `${day}-${month}-${year} ${hours}:${minutes}`;
132
+ }
133
+ });
@@ -314,9 +314,21 @@ const callLLMAPI = async function(apiPath, data, method, timeoutMs = 500000) {
314
314
  clearTimeout(timeoutId);
315
315
 
316
316
  if (!response.ok) {
317
- const errorData = await response.json();
318
- const endpointError = $('<div>').addClass('error-section').append(`<p>${errorData.error_message || 'Unknown server error'}</p>`);
319
- displayBotMessage(endpointError);
317
+ try {
318
+ // Intentamos leer el error como JSON, que es el formato esperado de nuestra API.
319
+ const errorData = await response.json();
320
+ const errorMessage = errorData.error_message || 'Error desconocido del servidor.';
321
+ const errorIcon = '<i class="bi bi-exclamation-triangle"></i>';
322
+ const endpointError = $('<div>').addClass('error-section').html(errorIcon + `<p>${errorMessage}</p>`);
323
+ displayBotMessage(endpointError);
324
+ } catch (e) {
325
+ // Si response.json() falla, es porque el cuerpo no era JSON (ej. un 502 con HTML).
326
+ // Mostramos un error genérico y más claro para el usuario.
327
+ const errorMessage = `Error de comunicación con el servidor (${response.status}). Por favor, intente de nuevo más tarde.`;
328
+ const errorIcon = '<i class="bi bi-exclamation-triangle"></i>';
329
+ const infrastructureError = $('<div>').addClass('error-section').html(errorIcon + `<p>${errorMessage}</p>`);
330
+ displayBotMessage(infrastructureError);
331
+ }
320
332
  return null;
321
333
  }
322
334
  return await response.json();
@@ -325,7 +337,9 @@ const callLLMAPI = async function(apiPath, data, method, timeoutMs = 500000) {
325
337
  if (error.name === 'AbortError') {
326
338
  throw error; // Re-throw to be handled by handleChatMessage
327
339
  } else {
328
- const commError = $('<div>').addClass('error-section').append(`<p>Connection error: ${error.message}</p>`);
340
+ const friendlyMessage = "Ocurrió un error de red. Por favor, inténtalo de nuevo en unos momentos.";
341
+ const errorIcon = '<i class="bi bi-exclamation-triangle"></i>';
342
+ const commError = $('<div>').addClass('error-section').html(errorIcon + `<p>${friendlyMessage}</p>`);
329
343
  displayBotMessage(commError);
330
344
  }
331
345
  return null;
@@ -123,32 +123,31 @@
123
123
  word-wrap: break-word;
124
124
  padding-top: 0.5em;
125
125
  }
126
-
127
126
  .error-section {
128
127
  align-self: flex-start;
129
128
  max-width: 75%;
130
- min-width: fit-content;
131
- width: fit-content;
132
- margin-top: 10px;
129
+ min-width: 250px;
130
+
131
+ color: var(--brand-danger-text, #842029); /* Color de texto de error de la marca */
132
+ background-color: var(--brand-danger-bg, #f8d7da); /* Fondo de error de la marca */
133
+ border: 1px solid var(--brand-danger-border, #f5c2c7); /* Borde de error de la marca */
134
+ font-style: italic;
135
+ font-size: 0.9rem;
133
136
  display: flex;
134
- align-items: flex-start;
135
- gap: 12px;
136
- background-color: #fff0f0;
137
- color: #5c0f0f;
138
- border: 1px solid #ffcccc;
139
- padding: 12px 18px;
140
- border-radius: 0 12px 12px 12px;
141
- font-family: Arial, sans-serif;
142
- font-size: 15px;
143
- line-height: 1.5;
144
- word-wrap: break-word;
145
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
137
+ align-items: center;
138
+ justify-content: start;
139
+ margin: 10px 0;
140
+ padding: 10px 15px; /* Un poco más de padding lateral */
141
+ opacity: 0.9;
142
+ border-radius: 8px; /* Bordes redondeados */
143
+ word-wrap: break-word; /* Asegura que el texto no se desborde */
146
144
  }
147
145
 
148
146
  .error-section i {
149
- color: #d32f2f;
150
- font-size: 1.2em;
151
- padding-top: 2px;
147
+ color: var(--brand-danger-color, #dc3545); /* Color del icono, el rojo principal */
148
+ font-size: 1.2rem; /* Tamaño del icono */
149
+ margin-right: 10px; /* Espacio entre el icono y el texto */
150
+ flex-shrink: 0; /* Evita que el icono se encoja */
152
151
  }
153
152
 
154
153
  #question {
@@ -97,6 +97,24 @@
97
97
  width: auto; /* Columna de la consulta - ocupa el resto */
98
98
  }
99
99
 
100
+ /* Evita el salto de línea en la celda de la fecha */
101
+ #historyModal .date-cell {
102
+ white-space: nowrap;
103
+ }
104
+
105
+ /* Estilo para el icono de copiar/editar en cada fila */
106
+ #historyModal .copy-query-icon {
107
+ color: var(--brand-secondary-color, #6c757d); /* Usa el color secundario de la marca */
108
+ text-decoration: none;
109
+ opacity: 0.6;
110
+ transition: opacity 0.2s ease-in-out;
111
+ }
112
+
113
+ #historyModal .copy-query-icon:hover {
114
+ opacity: 1; /* El icono se vuelve completamente opaco al pasar el ratón */
115
+ cursor: pointer; /* Asegura que el cursor cambie a una mano */
116
+ }
117
+
100
118
  /* ######################################################### */
101
119
  /* Modal de feedback */
102
120
  /* ######################################################### */
@@ -17,7 +17,8 @@
17
17
  <span style="{{ branding.primary_text_style }}">
18
18
  {{ branding.name }}
19
19
  </span>
20
- <span class="ms-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Powered by IAToolkit ({{ iatoolkit_version }})">
20
+ <span class="ms-2" data-bs-toggle="tooltip" data-bs-placement="bottom"
21
+ title="Powered by IAToolkit ({{ iatoolkit_version }})">
21
22
  <i class="bi bi-info-circle" style="color: {{ branding.header_text_color }}; opacity: 0.7; font-size: 0.9rem;"></i>
22
23
  </span>
23
24
  </div>
@@ -80,22 +80,19 @@
80
80
  </div>
81
81
  <p class="mt-2">Cargando historial...</p>
82
82
  </div>
83
- <div id="history-error" style="display: none;" class="alert alert-danger">
83
+ <div id="history-error" style="display: none;">
84
84
  <!-- Los errores se mostrarán aquí -->
85
85
  </div>
86
86
  <div id="history-content" style="display: none;">
87
- <!-- Texto explicativo -->
88
- <div class="alert alert-branded-info mb-3" role="alert">
89
- <i class="bi bi-info-circle me-2"></i>
90
- <strong>Tip:</strong> Haz clic en cualquier pregunta del historial para copiarla automáticamente al área de texto.
91
- </div>
87
+
92
88
  <div class="table-responsive">
93
89
  <table class="table table-striped table-hover">
94
90
  <thead class="thead-branded">
95
91
  <tr>
96
- <th scope="col">#</th>
92
+ <th scope="col" style="width: 5%;">#</th>
97
93
  <th scope="col">Fecha</th>
98
94
  <th scope="col">Consulta</th>
95
+ <th scope="col" style="width: 5%;"></th>
99
96
  </tr>
100
97
  </thead>
101
98
  <tbody id="history-table-body">
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iatoolkit
3
- Version: 0.16.7
3
+ Version: 0.18.0
4
4
  Summary: IAToolkit
5
5
  Author: Fernando Libedinsky
6
6
  License-Expression: MIT
@@ -1,118 +0,0 @@
1
- $(document).ready(function () {
2
- // Evento para abrir el modal de historial
3
- $('#history-button').on('click', function() {
4
- loadHistory();
5
- $('#historyModal').modal('show');
6
- });
7
-
8
- // Variables globales para el historial
9
- let historyData = [];
10
-
11
- // Función para cargar el historial
12
- async function loadHistory() {
13
- const historyLoading = $('#history-loading');
14
- const historyError = $('#history-error');
15
- const historyContent = $('#history-content');
16
-
17
- // Mostrar loading
18
- historyLoading.show();
19
- historyError.hide();
20
- historyContent.hide();
21
-
22
- try {
23
- const data = {
24
- external_user_id: window.externalUserId
25
- };
26
-
27
- const responseData = await callLLMAPI("/history", data, "POST");
28
-
29
- if (responseData && responseData.history) {
30
- // Guardar datos globalmente
31
- historyData = responseData.history;
32
-
33
- // Mostrar todos los datos
34
- displayAllHistory();
35
-
36
- // Mostrar contenido
37
- historyContent.show();
38
- } else {
39
- throw new Error('No se recibieron datos del historial');
40
- }
41
- } catch (error) {
42
- console.error("Error al cargar historial:", error);
43
- const errorHtml = `
44
- <div class="alert alert-branded-danger alert-dismissible show" role="alert">
45
- <strong>Error al cargar el historial:</strong> ${error.message}
46
- <button type="button" class="close" data-dismiss="alert">
47
- <span>&times;</span>
48
- </button>
49
- </div>
50
- `;
51
- historyError.html(errorHtml).show();
52
- } finally {
53
- historyLoading.hide();
54
- }
55
- }
56
-
57
- // Función para mostrar todo el historial
58
- function displayAllHistory() {
59
- const historyTableBody = $('#history-table-body');
60
-
61
- // Limpiar tabla
62
- historyTableBody.empty();
63
-
64
- // Filtrar solo consultas que son strings simples (no objetos JSON)
65
- const filteredHistory = historyData.filter(item => {
66
- try {
67
- // Intentar parsear como JSON
68
- const parsed = JSON.parse(item.query);
69
- // Si se puede parsear y es un objeto, filtrarlo
70
- return false;
71
- } catch (e) {
72
- // Si no se puede parsear, es un string simple, incluirlo
73
- return true;
74
- }
75
- });
76
-
77
- // Poblar tabla solo con las consultas filtradas
78
- filteredHistory.forEach((item, index) => {
79
- const row = $(`
80
- <tr>
81
- <td>${index + 1}</td>
82
- <td>${formatDate(item.created_at)}</td>
83
- <td class="query-cell" style="cursor: pointer;" title="Haz clic para copiar esta consulta al chat">${item.query}</td>
84
- </tr>
85
- `);
86
- historyTableBody.append(row);
87
- });
88
-
89
- // Agregar evento de clic a las celdas de consulta
90
- historyTableBody.on('click', '.query-cell', function() {
91
- const queryText = $(this).text();
92
-
93
- // Copiar el texto al textarea del chat
94
- $('#question').val(queryText);
95
- $('#send-button').removeClass('disabled');
96
-
97
- // Cerrar el modal
98
- $('#historyModal').modal('hide');
99
-
100
- // Hacer focus en el textarea para que el usuario pueda editar si lo desea
101
- $('#question').focus();
102
- });
103
- }
104
-
105
- // Función para formatear fecha
106
- function formatDate(dateString) {
107
- const date = new Date(dateString);
108
- return date.toLocaleDateString('es-CL', {
109
- day: '2-digit',
110
- month: '2-digit',
111
- year: 'numeric',
112
- hour: '2-digit',
113
- minute: '2-digit'
114
- });
115
- }
116
-
117
- });
118
-
File without changes
File without changes
File without changes