iatoolkit 0.3.9__py3-none-any.whl → 0.107.4__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.

Files changed (150) hide show
  1. iatoolkit/__init__.py +27 -35
  2. iatoolkit/base_company.py +3 -35
  3. iatoolkit/cli_commands.py +18 -47
  4. iatoolkit/common/__init__.py +0 -0
  5. iatoolkit/common/exceptions.py +48 -0
  6. iatoolkit/common/interfaces/__init__.py +0 -0
  7. iatoolkit/common/interfaces/asset_storage.py +34 -0
  8. iatoolkit/common/interfaces/database_provider.py +39 -0
  9. iatoolkit/common/model_registry.py +159 -0
  10. iatoolkit/common/routes.py +138 -0
  11. iatoolkit/common/session_manager.py +26 -0
  12. iatoolkit/common/util.py +353 -0
  13. iatoolkit/company_registry.py +66 -29
  14. iatoolkit/core.py +514 -0
  15. iatoolkit/infra/__init__.py +5 -0
  16. iatoolkit/infra/brevo_mail_app.py +123 -0
  17. iatoolkit/infra/call_service.py +140 -0
  18. iatoolkit/infra/connectors/__init__.py +5 -0
  19. iatoolkit/infra/connectors/file_connector.py +17 -0
  20. iatoolkit/infra/connectors/file_connector_factory.py +57 -0
  21. iatoolkit/infra/connectors/google_cloud_storage_connector.py +53 -0
  22. iatoolkit/infra/connectors/google_drive_connector.py +68 -0
  23. iatoolkit/infra/connectors/local_file_connector.py +46 -0
  24. iatoolkit/infra/connectors/s3_connector.py +33 -0
  25. iatoolkit/infra/google_chat_app.py +57 -0
  26. iatoolkit/infra/llm_providers/__init__.py +0 -0
  27. iatoolkit/infra/llm_providers/deepseek_adapter.py +278 -0
  28. iatoolkit/infra/llm_providers/gemini_adapter.py +350 -0
  29. iatoolkit/infra/llm_providers/openai_adapter.py +124 -0
  30. iatoolkit/infra/llm_proxy.py +268 -0
  31. iatoolkit/infra/llm_response.py +45 -0
  32. iatoolkit/infra/redis_session_manager.py +122 -0
  33. iatoolkit/locales/en.yaml +222 -0
  34. iatoolkit/locales/es.yaml +225 -0
  35. iatoolkit/repositories/__init__.py +5 -0
  36. iatoolkit/repositories/database_manager.py +187 -0
  37. iatoolkit/repositories/document_repo.py +33 -0
  38. iatoolkit/repositories/filesystem_asset_repository.py +36 -0
  39. iatoolkit/repositories/llm_query_repo.py +105 -0
  40. iatoolkit/repositories/models.py +279 -0
  41. iatoolkit/repositories/profile_repo.py +171 -0
  42. iatoolkit/repositories/vs_repo.py +150 -0
  43. iatoolkit/services/__init__.py +5 -0
  44. iatoolkit/services/auth_service.py +193 -0
  45. {services → iatoolkit/services}/benchmark_service.py +7 -7
  46. iatoolkit/services/branding_service.py +153 -0
  47. iatoolkit/services/company_context_service.py +214 -0
  48. iatoolkit/services/configuration_service.py +375 -0
  49. iatoolkit/services/dispatcher_service.py +134 -0
  50. {services → iatoolkit/services}/document_service.py +20 -8
  51. iatoolkit/services/embedding_service.py +148 -0
  52. iatoolkit/services/excel_service.py +156 -0
  53. {services → iatoolkit/services}/file_processor_service.py +36 -21
  54. iatoolkit/services/history_manager_service.py +208 -0
  55. iatoolkit/services/i18n_service.py +104 -0
  56. iatoolkit/services/jwt_service.py +80 -0
  57. iatoolkit/services/language_service.py +89 -0
  58. iatoolkit/services/license_service.py +82 -0
  59. iatoolkit/services/llm_client_service.py +438 -0
  60. iatoolkit/services/load_documents_service.py +174 -0
  61. iatoolkit/services/mail_service.py +213 -0
  62. {services → iatoolkit/services}/profile_service.py +200 -101
  63. iatoolkit/services/prompt_service.py +303 -0
  64. iatoolkit/services/query_service.py +467 -0
  65. iatoolkit/services/search_service.py +55 -0
  66. iatoolkit/services/sql_service.py +169 -0
  67. iatoolkit/services/tool_service.py +246 -0
  68. iatoolkit/services/user_feedback_service.py +117 -0
  69. iatoolkit/services/user_session_context_service.py +213 -0
  70. iatoolkit/static/images/fernando.jpeg +0 -0
  71. iatoolkit/static/images/iatoolkit_core.png +0 -0
  72. iatoolkit/static/images/iatoolkit_logo.png +0 -0
  73. iatoolkit/static/js/chat_feedback_button.js +80 -0
  74. iatoolkit/static/js/chat_filepond.js +85 -0
  75. iatoolkit/static/js/chat_help_content.js +124 -0
  76. iatoolkit/static/js/chat_history_button.js +110 -0
  77. iatoolkit/static/js/chat_logout_button.js +36 -0
  78. iatoolkit/static/js/chat_main.js +401 -0
  79. iatoolkit/static/js/chat_model_selector.js +227 -0
  80. iatoolkit/static/js/chat_onboarding_button.js +103 -0
  81. iatoolkit/static/js/chat_prompt_manager.js +94 -0
  82. iatoolkit/static/js/chat_reload_button.js +38 -0
  83. iatoolkit/static/styles/chat_iatoolkit.css +559 -0
  84. iatoolkit/static/styles/chat_modal.css +133 -0
  85. iatoolkit/static/styles/chat_public.css +135 -0
  86. iatoolkit/static/styles/documents.css +598 -0
  87. iatoolkit/static/styles/landing_page.css +398 -0
  88. iatoolkit/static/styles/llm_output.css +148 -0
  89. iatoolkit/static/styles/onboarding.css +176 -0
  90. iatoolkit/system_prompts/__init__.py +0 -0
  91. iatoolkit/system_prompts/query_main.prompt +30 -23
  92. iatoolkit/system_prompts/sql_rules.prompt +47 -12
  93. iatoolkit/templates/_company_header.html +45 -0
  94. iatoolkit/templates/_login_widget.html +42 -0
  95. iatoolkit/templates/base.html +78 -0
  96. iatoolkit/templates/change_password.html +66 -0
  97. iatoolkit/templates/chat.html +337 -0
  98. iatoolkit/templates/chat_modals.html +185 -0
  99. iatoolkit/templates/error.html +51 -0
  100. iatoolkit/templates/forgot_password.html +51 -0
  101. iatoolkit/templates/onboarding_shell.html +106 -0
  102. iatoolkit/templates/signup.html +79 -0
  103. iatoolkit/views/__init__.py +5 -0
  104. iatoolkit/views/base_login_view.py +96 -0
  105. iatoolkit/views/change_password_view.py +116 -0
  106. iatoolkit/views/chat_view.py +76 -0
  107. iatoolkit/views/embedding_api_view.py +65 -0
  108. iatoolkit/views/forgot_password_view.py +75 -0
  109. iatoolkit/views/help_content_api_view.py +54 -0
  110. iatoolkit/views/history_api_view.py +56 -0
  111. iatoolkit/views/home_view.py +63 -0
  112. iatoolkit/views/init_context_api_view.py +74 -0
  113. iatoolkit/views/llmquery_api_view.py +59 -0
  114. iatoolkit/views/load_company_configuration_api_view.py +49 -0
  115. iatoolkit/views/load_document_api_view.py +65 -0
  116. iatoolkit/views/login_view.py +170 -0
  117. iatoolkit/views/logout_api_view.py +57 -0
  118. iatoolkit/views/profile_api_view.py +46 -0
  119. iatoolkit/views/prompt_api_view.py +37 -0
  120. iatoolkit/views/root_redirect_view.py +22 -0
  121. iatoolkit/views/signup_view.py +100 -0
  122. iatoolkit/views/static_page_view.py +27 -0
  123. iatoolkit/views/user_feedback_api_view.py +60 -0
  124. iatoolkit/views/users_api_view.py +33 -0
  125. iatoolkit/views/verify_user_view.py +60 -0
  126. iatoolkit-0.107.4.dist-info/METADATA +268 -0
  127. iatoolkit-0.107.4.dist-info/RECORD +132 -0
  128. iatoolkit-0.107.4.dist-info/licenses/LICENSE +21 -0
  129. iatoolkit-0.107.4.dist-info/licenses/LICENSE_COMMUNITY.md +15 -0
  130. {iatoolkit-0.3.9.dist-info → iatoolkit-0.107.4.dist-info}/top_level.txt +0 -1
  131. iatoolkit/iatoolkit.py +0 -413
  132. iatoolkit/system_prompts/arquitectura.prompt +0 -32
  133. iatoolkit-0.3.9.dist-info/METADATA +0 -252
  134. iatoolkit-0.3.9.dist-info/RECORD +0 -32
  135. services/__init__.py +0 -5
  136. services/api_service.py +0 -75
  137. services/dispatcher_service.py +0 -351
  138. services/excel_service.py +0 -98
  139. services/history_service.py +0 -45
  140. services/jwt_service.py +0 -91
  141. services/load_documents_service.py +0 -212
  142. services/mail_service.py +0 -62
  143. services/prompt_manager_service.py +0 -172
  144. services/query_service.py +0 -334
  145. services/search_service.py +0 -32
  146. services/sql_service.py +0 -42
  147. services/tasks_service.py +0 -188
  148. services/user_feedback_service.py +0 -67
  149. services/user_session_context_service.py +0 -85
  150. {iatoolkit-0.3.9.dist-info → iatoolkit-0.107.4.dist-info}/WHEEL +0 -0
@@ -0,0 +1,103 @@
1
+ (function (global) {
2
+ function qs(root, sel) { return (typeof sel === 'string') ? root.querySelector(sel) : sel; }
3
+
4
+ function createDots(container, count, activeIdx, activeColor) {
5
+ container.innerHTML = '';
6
+ for (let i = 0; i < count; i++) {
7
+ const d = document.createElement('div');
8
+ if (i === activeIdx) d.classList.add('active');
9
+ d.style.width = '10px';
10
+ d.style.height = '10px';
11
+ d.style.borderRadius = '50%';
12
+ d.style.backgroundColor = i === activeIdx ? (activeColor || 'var(--brand-primary-color, #FF5100)') : '#ddd';
13
+ d.style.transition = 'background-color .3s';
14
+ container.appendChild(d);
15
+ }
16
+ }
17
+
18
+ function initOnboarding(opts) {
19
+ const {
20
+ mode = 'modal',
21
+ cards = [],
22
+ ui = {},
23
+ autoRotateMs = 5000,
24
+ shell = {}
25
+ } = opts;
26
+
27
+ const root = document;
28
+ const elIcon = qs(root, ui.icon);
29
+ const elTitle = qs(root, ui.title);
30
+ const elText = qs(root, ui.text);
31
+ const elExample = qs(root, ui.example);
32
+ const elDots = qs(root, ui.dots);
33
+ const elPrev = qs(root, ui.prev);
34
+ const elNext = qs(root, ui.next);
35
+
36
+ let idx = 0;
37
+ let autoTimer = null;
38
+
39
+ function hasCards() { return Array.isArray(cards) && cards.length > 0; }
40
+
41
+ function render() {
42
+ if (!hasCards()) return;
43
+ const c = cards[idx] || {};
44
+ if (elIcon) elIcon.innerHTML = `<i class="${c.icon || 'bi bi-lightbulb'}"></i>`;
45
+ if (elTitle) elTitle.textContent = c.title || '';
46
+ if (elText) elText.innerHTML = c.text || '';
47
+ if (elExample && c.example) {
48
+ elExample.innerHTML = ('Example ' + ': ' + c.example) || '';
49
+ }
50
+ else
51
+ elExample.innerHTML = '';
52
+ if (elDots) createDots(elDots, cards.length, idx);
53
+ }
54
+
55
+ function next() { if (!hasCards()) return; idx = (idx + 1) % cards.length; render(); }
56
+ function prev() { if (!hasCards()) return; idx = (idx - 1 + cards.length) % cards.length; render(); }
57
+
58
+ function startAuto() {
59
+ stopAuto();
60
+ if (!hasCards()) return;
61
+ autoTimer = setInterval(next, autoRotateMs);
62
+ }
63
+ function stopAuto() { if (autoTimer) { clearInterval(autoTimer); autoTimer = null; } }
64
+
65
+ function setupShellIfNeeded() {
66
+ if (mode !== 'shell') return;
67
+ const loader = ui.loader ? qs(root, ui.loader) : null;
68
+ const container = ui.container ? qs(root, ui.container) : null;
69
+ if (!container || !shell.iframeSrc) return;
70
+
71
+ const iframe = document.createElement('iframe');
72
+ iframe.src = shell.iframeSrc;
73
+ iframe.style.width = '100%';
74
+ iframe.style.height = '100%';
75
+ iframe.style.border = 'none';
76
+ iframe.style.display = 'none';
77
+
78
+ iframe.onload = function () {
79
+ iframe.style.display = 'block';
80
+ if (loader) {
81
+ loader.style.opacity = '0';
82
+ setTimeout(() => loader.style.display = 'none', 500);
83
+ }
84
+ };
85
+ container.appendChild(iframe);
86
+ }
87
+
88
+ if (elPrev) elPrev.addEventListener('click', () => { prev(); startAuto(); });
89
+ if (elNext) elNext.addEventListener('click', () => { next(); startAuto(); });
90
+
91
+ function start() {
92
+ idx = 0;
93
+ render();
94
+ startAuto();
95
+ if (mode === 'shell') setupShellIfNeeded();
96
+ }
97
+
98
+ return { start, stop: stopAuto, next, prev, hasCards };
99
+ }
100
+
101
+ // Export global
102
+ global.initOnboarding = initOnboarding;
103
+ })(window);
@@ -0,0 +1,94 @@
1
+ $(document).ready(function () {
2
+ // --- PROMPT ASSISTANT FUNCTIONALITY ---
3
+ const $promptCollapse = $('#prompt-assistant-collapse');
4
+
5
+ if ($promptCollapse.length) {
6
+ $promptCollapse.on('shown.bs.collapse', function () {
7
+ // Scroll to bottom smoothly when the collapse is shown
8
+ $('html, body').animate(
9
+ { scrollTop: $(document).height() },
10
+ 'slow'
11
+ );
12
+ });
13
+ }
14
+
15
+ $('.input-area').on('click', '.dropdown-menu a.dropdown-item', function (event) {
16
+ event.preventDefault();
17
+ const promptData = $(this).data();
18
+
19
+ const promptObject = {
20
+ prompt: promptData.promptName,
21
+ description: promptData.promptDescription,
22
+ custom_fields: typeof promptData.customFields === 'string' ? JSON.parse(promptData.customFields) : promptData.customFields
23
+ };
24
+ selectPrompt(promptObject);
25
+ });
26
+
27
+ // Handles the 'clear' button for the prompt selector
28
+ $('#clear-selection-button').on('click', function() {
29
+ resetPromptSelection();
30
+ updateSendButtonState();
31
+ });
32
+ });
33
+
34
+ /**
35
+ * Handles the selection of a prompt from the dropdown.
36
+ * @param {object} prompt The prompt object read from data attributes.
37
+ */
38
+ function selectPrompt(prompt) {
39
+ selectedPrompt = prompt;
40
+
41
+ // Update the dropdown button to show the selected prompt's description
42
+ $('#prompt-select-button').text(prompt.description).addClass('item-selected');
43
+ $('#clear-selection-button').show();
44
+
45
+ // Clear the main textarea, as we are now in "prompt mode"
46
+ $('#question').val('');
47
+ autoResizeTextarea($('#question')[0]); // Reset height after clearing
48
+
49
+ // Store values in hidden fields for backward compatibility or other uses
50
+ $('#prompt-select-value').val(prompt.prompt);
51
+ $('#prompt-select-description').val(prompt.description);
52
+
53
+ // Render the dynamic input fields required by the selected prompt
54
+ renderDynamicInputs(prompt.custom_fields || []);
55
+ updateSendButtonState();
56
+ }
57
+
58
+ /**
59
+ * Resets the prompt selection and clears associated UI elements.
60
+ */
61
+ function resetPromptSelection() {
62
+ selectedPrompt = null;
63
+
64
+ $('#prompt-select-button').text('Prompts disponibles ....').removeClass('item-selected');
65
+ $('#clear-selection-button').hide();
66
+ $('#prompt-select-value').val('');
67
+ $('#prompt-select-description').val('');
68
+
69
+ // Clear any dynamically generated input fields
70
+ $('#dynamic-inputs-container').empty();
71
+ }
72
+
73
+ /**
74
+ * Renders the custom input fields for the selected prompt.
75
+ * @param {Array<object>} fields The array of custom field configurations.
76
+ */
77
+ function renderDynamicInputs(fields) {
78
+ const container = $('#dynamic-inputs-container');
79
+ container.empty();
80
+
81
+ const row = $('<div class="row g-2"></div>');
82
+ fields.forEach(field => {
83
+ const colDiv = $('<div class="col-md"></div>');
84
+ const formFloating = $('<div class="form-floating"></div>');
85
+ const input = $(`<input type="${field.type || 'text'}" class="form-control form-control-soft" id="${field.data_key}-id" ">`);
86
+ const label = $(`<label for="${field.data_key}-id">${field.label}</label>`);
87
+
88
+ formFloating.append(input, label);
89
+ colDiv.append(formFloating);
90
+ row.append(colDiv);
91
+ });
92
+
93
+ container.append(row);
94
+ }
@@ -0,0 +1,38 @@
1
+ $(document).ready(function () {
2
+ $('#force-reload-button').on('click', function() {
3
+ reloadButton(this);
4
+ });
5
+
6
+ async function reloadButton(button) {
7
+ const originalIconClass = 'bi bi-arrow-clockwise';
8
+ const spinnerIconClass = 'spinner-border spinner-border-sm';
9
+
10
+ // Configuración de Toastr para que aparezca abajo a la derecha
11
+ toastr.options = {"positionClass": "toast-bottom-right", "preventDuplicates": true};
12
+
13
+ // 1. Deshabilitar y mostrar spinner
14
+ button.disabled = true;
15
+ const icon = button.querySelector('i');
16
+ icon.className = spinnerIconClass;
17
+ toastr.info(t_js('reload_init'));
18
+
19
+ // 2. prepare the api parameters
20
+ const apiPath = '/api/init-context';
21
+ const payload = {
22
+ 'user_identifier': window.user_identifier,
23
+ 'model': (window.currentLlmModel || window.defaultLlmModel || '')
24
+ };
25
+
26
+ // 3. make the call to callToolkit
27
+ const data = await callToolkit(apiPath, payload, 'POST');
28
+ if (data) {
29
+ if (data.status === 'OK')
30
+ toastr.success(data.message || 'Contexto reloaded.');
31
+ else
32
+ toastr.error(data.error_message || 'error during reload');
33
+ }
34
+
35
+ button.disabled = false;
36
+ icon.className = originalIconClass;
37
+ }
38
+ });