iatoolkit 0.55.0__tar.gz → 0.55.1__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 (127) hide show
  1. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/PKG-INFO +1 -1
  2. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/pyproject.toml +1 -1
  3. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/common/routes.py +3 -2
  4. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/iatoolkit.py +1 -1
  5. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/templates/chat.html +13 -12
  6. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/templates/chat_modals.html +1 -1
  7. iatoolkit-0.55.1/src/iatoolkit/templates/login_test.html +118 -0
  8. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/templates/onboarding_shell.html +12 -8
  9. iatoolkit-0.55.1/src/iatoolkit/views/login_simulation_view.py +60 -0
  10. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/login_view.py +1 -1
  11. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit.egg-info/PKG-INFO +1 -1
  12. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit.egg-info/SOURCES.txt +1 -1
  13. iatoolkit-0.55.0/src/iatoolkit/templates/login_test.html +0 -150
  14. iatoolkit-0.55.0/src/iatoolkit/views/login_test_view.py +0 -46
  15. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/readme.md +0 -0
  16. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/requirements.txt +0 -0
  17. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/setup.cfg +0 -0
  18. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/__init__.py +0 -0
  19. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/base_company.py +0 -0
  20. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/cli_commands.py +0 -0
  21. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/common/__init__.py +0 -0
  22. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/common/exceptions.py +0 -0
  23. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/common/session_manager.py +0 -0
  24. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/common/util.py +0 -0
  25. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/company_registry.py +0 -0
  26. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/__init__.py +0 -0
  27. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/call_service.py +0 -0
  28. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/connectors/__init__.py +0 -0
  29. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/connectors/file_connector.py +0 -0
  30. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/connectors/file_connector_factory.py +0 -0
  31. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/connectors/google_cloud_storage_connector.py +0 -0
  32. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/connectors/google_drive_connector.py +0 -0
  33. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/connectors/local_file_connector.py +0 -0
  34. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/connectors/s3_connector.py +0 -0
  35. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/gemini_adapter.py +0 -0
  36. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/google_chat_app.py +0 -0
  37. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/llm_client.py +0 -0
  38. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/llm_proxy.py +0 -0
  39. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/llm_response.py +0 -0
  40. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/mail_app.py +0 -0
  41. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/openai_adapter.py +0 -0
  42. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/infra/redis_session_manager.py +0 -0
  43. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/repositories/__init__.py +0 -0
  44. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/repositories/database_manager.py +0 -0
  45. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/repositories/document_repo.py +0 -0
  46. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/repositories/llm_query_repo.py +0 -0
  47. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/repositories/models.py +0 -0
  48. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/repositories/profile_repo.py +0 -0
  49. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/repositories/tasks_repo.py +0 -0
  50. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/repositories/vs_repo.py +0 -0
  51. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/__init__.py +0 -0
  52. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/auth_service.py +0 -0
  53. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/benchmark_service.py +0 -0
  54. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/branding_service.py +0 -0
  55. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/dispatcher_service.py +0 -0
  56. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/document_service.py +0 -0
  57. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/excel_service.py +0 -0
  58. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/file_processor_service.py +0 -0
  59. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/history_service.py +0 -0
  60. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/jwt_service.py +0 -0
  61. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/load_documents_service.py +0 -0
  62. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/mail_service.py +0 -0
  63. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/onboarding_service.py +0 -0
  64. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/profile_service.py +0 -0
  65. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/prompt_manager_service.py +0 -0
  66. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/query_service.py +0 -0
  67. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/search_service.py +0 -0
  68. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/sql_service.py +0 -0
  69. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/tasks_service.py +0 -0
  70. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/user_feedback_service.py +0 -0
  71. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/services/user_session_context_service.py +0 -0
  72. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/images/arrow_up.png +0 -0
  73. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/images/diagrama_iatoolkit.jpg +0 -0
  74. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/images/logo_clinica.png +0 -0
  75. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/images/logo_iatoolkit.png +0 -0
  76. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/images/logo_maxxa.png +0 -0
  77. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/images/logo_notaria.png +0 -0
  78. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/images/logo_tarjeta.png +0 -0
  79. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/images/logo_umayor.png +0 -0
  80. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/images/upload.png +0 -0
  81. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/js/chat_feedback.js +0 -0
  82. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/js/chat_filepond.js +0 -0
  83. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/js/chat_history.js +0 -0
  84. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/js/chat_main.js +0 -0
  85. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/js/chat_onboarding.js +0 -0
  86. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/styles/chat_iatoolkit.css +0 -0
  87. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/styles/chat_info.css +0 -0
  88. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/styles/chat_modal.css +0 -0
  89. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/styles/landing_page.css +0 -0
  90. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/styles/llm_output.css +0 -0
  91. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/static/styles/onboarding.css +0 -0
  92. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/system_prompts/format_styles.prompt +0 -0
  93. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/system_prompts/query_main.prompt +0 -0
  94. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/system_prompts/sql_rules.prompt +0 -0
  95. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/templates/_branding_styles.html +0 -0
  96. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/templates/_login_widget.html +0 -0
  97. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/templates/_navbar.html +0 -0
  98. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/templates/about.html +0 -0
  99. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/templates/base.html +0 -0
  100. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/templates/change_password.html +0 -0
  101. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/templates/error.html +0 -0
  102. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/templates/forgot_password.html +0 -0
  103. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/templates/header.html +0 -0
  104. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/templates/index.html +0 -0
  105. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/templates/signup.html +0 -0
  106. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/templates/test.html +0 -0
  107. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/__init__.py +0 -0
  108. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/base_login_view.py +0 -0
  109. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/change_password_view.py +0 -0
  110. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/chat_token_request_view.py +0 -0
  111. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/external_login_view.py +0 -0
  112. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/file_store_api_view.py +0 -0
  113. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/forgot_password_view.py +0 -0
  114. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/history_api_view.py +0 -0
  115. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/index_view.py +0 -0
  116. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/init_context_api_view.py +0 -0
  117. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/llmquery_api_view.py +0 -0
  118. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/llmquery_web_view.py +0 -0
  119. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/prompt_api_view.py +0 -0
  120. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/signup_view.py +0 -0
  121. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/tasks_review_view.py +0 -0
  122. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/tasks_view.py +0 -0
  123. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/user_feedback_api_view.py +0 -0
  124. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit/views/verify_user_view.py +0 -0
  125. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit.egg-info/dependency_links.txt +0 -0
  126. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/src/iatoolkit.egg-info/requires.txt +0 -0
  127. {iatoolkit-0.55.0 → iatoolkit-0.55.1}/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.55.0
3
+ Version: 0.55.1
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.55.0"
7
+ version = "0.55.1"
8
8
  requires-python = ">=3.12"
9
9
  description = "IAToolkit"
10
10
  readme = "readme.md"
@@ -25,7 +25,7 @@ def register_views(injector, app):
25
25
  from iatoolkit.views.llmquery_api_view import LLMQueryApiView
26
26
  from iatoolkit.views.tasks_view import TaskView
27
27
  from iatoolkit.views.tasks_review_view import TaskReviewView
28
- from iatoolkit.views.login_test_view import LoginTest
28
+ from iatoolkit.views.login_simulation_view import LoginSimulationView
29
29
  from iatoolkit.views.login_view import LoginView, FinalizeContextView
30
30
  from iatoolkit.views.external_login_view import ExternalLoginView
31
31
  from iatoolkit.views.signup_view import SignupView
@@ -112,7 +112,8 @@ def register_views(injector, app):
112
112
  abort(404)
113
113
 
114
114
  # login testing (old home page)
115
- app.add_url_rule('/login_test', view_func=LoginTest.as_view('login_test'))
115
+ app.add_url_rule('/login_test/<company_short_name>/<external_user_id>',
116
+ view_func=LoginSimulationView.as_view('login_test'))
116
117
 
117
118
  app.add_url_rule(
118
119
  '/about', # URL de la ruta
@@ -19,7 +19,7 @@ from werkzeug.middleware.proxy_fix import ProxyFix
19
19
  from injector import Binder, singleton, Injector
20
20
  from importlib.metadata import version as _pkg_version, PackageNotFoundError
21
21
 
22
- IATOOLKIT_VERSION = "0.55.0"
22
+ IATOOLKIT_VERSION = "0.55.1"
23
23
 
24
24
  # global variable for the unique instance of IAToolkit
25
25
  _iatoolkit_instance: Optional['IAToolkit'] = None
@@ -4,12 +4,15 @@
4
4
 
5
5
  {% block content %}
6
6
 
7
- <style>
8
- {{ branding.css_variables | safe }}
9
- </style>
10
- <link rel="stylesheet" href="{{ url_for('static', filename='css/onboarding.css', _external=True) }}">
11
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
12
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
7
+ {% block styles %}
8
+ {# Movemos los estilos y los links aquí para que se rendericen en el <head> #}
9
+ <style>
10
+ {{ branding.css_variables | safe }}
11
+ </style>
12
+ <link rel="stylesheet" href="{{ url_for('static', filename='styles/onboarding.css', _external=True) }}">
13
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
14
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
15
+ {% endblock %}
13
16
 
14
17
  <!-- Sección de encabezado con el usuario conectado -->
15
18
  <div id="company-section" class="company-section d-flex justify-content-between align-items-center px-3 py-2"
@@ -59,12 +62,10 @@
59
62
  </a>
60
63
 
61
64
  <!-- Icono de cerrar sesión (al final) -->
62
- {% if user_is_local %}
63
- <a href="{{ url_for('logout', company_short_name=company_short_name, _external=True) }}"
64
- class="ms-3 action-icon-style" title="Cerrar sesión" style="color: {{ branding.header_text_color }} !important;">
65
- <i class="bi bi-box-arrow-right"></i>
66
- </a>
67
- {% endif %}
65
+ <a href="{{ url_for('logout', company_short_name=company_short_name, _external=True) }}"
66
+ class="ms-3 action-icon-style" title="Cerrar sesión" style="color: {{ branding.header_text_color }} !important;">
67
+ <i class="bi bi-box-arrow-right"></i>
68
+ </a>
68
69
  </div>
69
70
 
70
71
  </div>
@@ -136,7 +136,7 @@
136
136
  </div>
137
137
 
138
138
  <div class="modal-footer">
139
- <button id="ob-close" type="button" class="btn btn-branded-secondary" data-bs-dismiss="modal">
139
+ <button id="ob-close" type="button" class="btn btn-branded-primary" data-bs-dismiss="modal">
140
140
  Cerrar
141
141
  </button>
142
142
  </div>
@@ -0,0 +1,118 @@
1
+ {% extends "base.html" %}
2
+
3
+ {% block title %}Prueba de Login para {{ branding.name }}{% endblock %}
4
+
5
+ {% block styles %}
6
+ {# Este bloque asegura que los colores de la marca estén disponibles como variables CSS #}
7
+ {% if branding and branding.css_variables %}
8
+ <style>
9
+ {{ branding.css_variables|safe }}
10
+ /* Usa la variable de CSS para el color primario del botón */
11
+ #initiateJwtChatButton {
12
+ background-color: var(--brand-primary-color, #0d6efd);
13
+ border-color: var(--brand-primary-color, #0d6efd);
14
+ }
15
+ </style>
16
+ {% endif %}
17
+ {% endblock %}
18
+
19
+ {% block content %}
20
+ <div class="container-fluid">
21
+ <div class="row flex-fill mt-5 justify-content-center">
22
+ <!-- login desde sistema externo -->
23
+ <div class="col-12 col-lg-6">
24
+ <div class="border rounded p-4 p-md-5 shadow-sm bg-light">
25
+ {# El título ahora muestra dinámicamente el nombre de la empresa #}
26
+ <h3 class="text-muted fw-semibold text-start mb-3">
27
+ Login Externo para <span style="color: var(--brand-primary-color, #0d6efd);">{{ branding.name }}</span>
28
+ </h3>
29
+ <div class="text-center mb-4">
30
+ <p class="text-muted widget-intro-text">
31
+ Este formulario permite testear el acceso a IAToolkit desde un portal externo utilizando una api-key. El external user ID es el nombre del usuario ya autentificado en algún portal interno de la empresa.
32
+ </p>
33
+ </div>
34
+
35
+ {# El 'action' y 'method' son manejados por JS, pero el id es crucial #}
36
+ <form id="jwt-form">
37
+
38
+ <div class="mb-3">
39
+ <label for="external_user_id" class="form-label d-block">External user ID</label>
40
+ <input type="text" id="external_user_id" name="external_user_id" class="form-control" required>
41
+ </div>
42
+
43
+ <button type="submit" id="initiateJwtChatButton" class="btn btn-primary">
44
+ <span class="spinner-border spinner-border-sm d-none" role="status" aria-hidden="true"></span>
45
+ Iniciar Sesión
46
+ </button>
47
+ </form>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ {% endblock %}
53
+
54
+ {% block scripts %}
55
+ <script>
56
+ document.addEventListener('DOMContentLoaded', function() {
57
+ const companyShortName = "{{ company_short_name }}";
58
+ const apiKey = "{{ api_key }}";
59
+ const loginForm = document.getElementById('jwt-form');
60
+ const userIdInput = document.getElementById('external_user_id');
61
+ const submitButton = document.getElementById('initiateJwtChatButton');
62
+ const spinner = submitButton.querySelector('.spinner-border');
63
+
64
+ loginForm.addEventListener('submit', function(event) {
65
+ event.preventDefault();
66
+ const userIdentifier = userIdInput.value.trim();
67
+ if (!userIdentifier) return;
68
+
69
+ // Deshabilitar botón y mostrar spinner
70
+ submitButton.disabled = true;
71
+ spinner.classList.remove('d-none');
72
+
73
+ const newWindow = window.open('', '_blank');
74
+ const apiUrl = `/${companyShortName}/external_login`;
75
+
76
+ fetch(apiUrl, {
77
+ method: 'POST',
78
+ headers: {
79
+ 'Content-Type': 'application/json',
80
+ 'Authorization': `Bearer ${apiKey}`
81
+ },
82
+ body: JSON.stringify({ external_user_id: userIdentifier })
83
+ })
84
+ .then(response => response.ok ? response.text() : response.text().then(text => { throw new Error(text) }))
85
+ .then(html => {
86
+ newWindow.document.documentElement.innerHTML = html;
87
+ // Buscamos todos los scripts en el HTML inyectado y los re-ejecutamos.
88
+ const scripts = newWindow.document.querySelectorAll('script');
89
+ scripts.forEach(oldScript => {
90
+ const newScript = newWindow.document.createElement('script');
91
+
92
+ // Copiamos los atributos (como 'src' para archivos externos)
93
+ Array.from(oldScript.attributes).forEach(attr => {
94
+ newScript.setAttribute(attr.name, attr.value);
95
+ });
96
+
97
+ // Copiamos el contenido para scripts inline
98
+ newScript.appendChild(newWindow.document.createTextNode(oldScript.innerHTML));
99
+
100
+ // Reemplazamos el script viejo por el nuevo para que se ejecute.
101
+ oldScript.parentNode.replaceChild(newScript, oldScript);
102
+ });
103
+
104
+ })
105
+ .catch(error => {
106
+ console.error("Falló la prueba de login externo:", error);
107
+ const errorMessage = error.message || "Error desconocido.";
108
+ newWindow.document.body.innerHTML = `<div style="padding: 20px; font-family: monospace;"><h2>Error</h2><pre>${errorMessage}</pre></div>`;
109
+ })
110
+ .finally(() => {
111
+ // Volver a habilitar el botón y ocultar el spinner
112
+ submitButton.disabled = false;
113
+ spinner.classList.add('d-none');
114
+ });
115
+ });
116
+ });
117
+ </script>
118
+ {% endblock %}
@@ -3,9 +3,20 @@
3
3
  {% block title %}Iniciando {{ branding.name | default('IAToolkit') }} IA...{% endblock %}
4
4
 
5
5
  {% block styles %}
6
+ {% endblock %}
7
+
8
+ {% block content %}
9
+
6
10
  <link rel="stylesheet" href="{{ url_for('static', filename='styles/llm_output.css', _external=True) }}?v=6">
7
- <link rel="stylesheet" href="{{ url_for('static', filename='css/onboarding.css', _external=True) }}?v=6">
11
+ <link rel="stylesheet" href="{{ url_for('static', filename='styles/onboarding.css', _external=True) }}?v=6">
12
+
8
13
  <style>
14
+ {# 1. Definimos las variables de la marca PRIMERO #}
15
+ {% if branding and branding.css_variables %}
16
+ {{ branding.css_variables|safe }}
17
+ {% endif %}
18
+
19
+ {# 2. Ahora definimos las reglas que usan esas variables #}
9
20
  .onboarding-shell-root { position: relative; height: 100vh; }
10
21
  .onboarding-shell-root #loader-wrapper { position: absolute; inset: 0; background: #f4f7f6; z-index: 1000; display:flex; align-items:center; justify-content:center; padding:20px; box-sizing:border-box; transition: opacity .5s; }
11
22
  .onboarding-shell-root .ob-stack { width:100%; max-width:520px; display:flex; flex-direction:column; gap:16px; }
@@ -22,14 +33,7 @@
22
33
  .onboarding-shell-root .ob-btn { background-color: var(--brand-secondary-color, #06326B) !important; color: var(--brand-text-on-secondary, #FFFFFF) !important; border:none !important; }
23
34
  .onboarding-shell-root .ob-dots > div.active { background-color: var(--brand-primary-color, #FF5100) !important; }
24
35
  </style>
25
- {% if branding and branding.css_variables %}
26
- <style>
27
- {{ branding.css_variables|safe }}
28
- </style>
29
- {% endif %}
30
- {% endblock %}
31
36
 
32
- {% block content %}
33
37
  <div class="onboarding-shell-root ob-root">
34
38
  <div id="loader-wrapper">
35
39
  <div class="ob-stack">
@@ -0,0 +1,60 @@
1
+ import requests
2
+ import json
3
+ import os
4
+ from flask.views import MethodView
5
+ from flask import Response, abort, request, make_response
6
+
7
+
8
+ class LoginSimulationView(MethodView):
9
+ """
10
+ Simula un portal externo que llama a la API de IAToolkit de servidor a servidor,
11
+ replicando el flujo real de `dispatch_request`.
12
+ Para usarlo, visita /login_test/<company_short_name>/<external_user_id>
13
+ """
14
+
15
+ def get(self, company_short_name: str, external_user_id: str):
16
+ api_key = os.getenv("IATOOLKIT_API_KEY")
17
+ base_url = request.host_url.rstrip('/')
18
+
19
+ if not api_key:
20
+ abort(500, "Error: IATOOLKIT_API_KEY no está configurada en el servidor de prueba.")
21
+ if not external_user_id:
22
+ abort(400, "Error: Debes proporcionar un external_user_id en la URL.")
23
+
24
+ target_url = f"{base_url}/{company_short_name}/external_login"
25
+
26
+ # --- INICIO DE LA CORRECCIÓN ---
27
+ # Usamos el formato de header 'Authorization: Bearer' como solicitaste.
28
+ headers = {
29
+ 'Content-Type': 'application/json',
30
+ 'Authorization': f'Bearer {api_key}'
31
+ }
32
+ # --- FIN DE LA CORRECCIÓN ---
33
+
34
+ payload = {'external_user_id': external_user_id}
35
+
36
+ try:
37
+ # Llamada POST interna. 'stream=True' es importante para manejar la respuesta.
38
+ internal_response = requests.post(target_url, headers=headers, data=json.dumps(payload), timeout=120,
39
+ stream=True)
40
+ internal_response.raise_for_status()
41
+
42
+ # Creamos una nueva Response de Flask para el navegador del usuario.
43
+ user_response = Response(
44
+ internal_response.iter_content(chunk_size=1024),
45
+ status=internal_response.status_code
46
+ )
47
+
48
+ # Copiamos TODAS las cabeceras de la respuesta interna a la respuesta final,
49
+ # incluyendo 'Content-Type' y, crucialmente, 'Set-Cookie'.
50
+ for key, value in internal_response.headers.items():
51
+ if key.lower() not in ['content-encoding', 'content-length', 'transfer-encoding', 'connection']:
52
+ user_response.headers[key] = value
53
+
54
+ return user_response
55
+
56
+ except requests.exceptions.HTTPError as e:
57
+ error_text = f"Error en la llamada interna a la API: {e.response.status_code}. Respuesta: {e.response.text}"
58
+ return Response(error_text, status=e.response.status_code, mimetype='text/plain')
59
+ except requests.exceptions.RequestException as e:
60
+ return Response(f'Error de conexión con el servicio de IA: {str(e)}', status=502, mimetype='text/plain')
@@ -84,7 +84,7 @@ class FinalizeContextView(MethodView):
84
84
 
85
85
  if not user_identifier:
86
86
  # This can happen if the session expires or is invalid.
87
- return redirect(url_for('login_page', company_short_name=company_short_name))
87
+ return redirect(url_for('index', company_short_name=company_short_name))
88
88
 
89
89
  company = self.profile_service.get_company_by_short_name(company_short_name)
90
90
  if not company:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iatoolkit
3
- Version: 0.55.0
3
+ Version: 0.55.1
4
4
  Summary: IAToolkit
5
5
  Author: Fernando Libedinsky
6
6
  License-Expression: MIT
@@ -113,7 +113,7 @@ src/iatoolkit/views/index_view.py
113
113
  src/iatoolkit/views/init_context_api_view.py
114
114
  src/iatoolkit/views/llmquery_api_view.py
115
115
  src/iatoolkit/views/llmquery_web_view.py
116
- src/iatoolkit/views/login_test_view.py
116
+ src/iatoolkit/views/login_simulation_view.py
117
117
  src/iatoolkit/views/login_view.py
118
118
  src/iatoolkit/views/prompt_api_view.py
119
119
  src/iatoolkit/views/signup_view.py
@@ -1,150 +0,0 @@
1
- {% extends "base.html" %}
2
-
3
- {% block title %}Inicio - IAToolkit{% endblock %}
4
-
5
- {% block content %}
6
-
7
- <!-- Contenido principal con espaciado adicional respecto al header -->
8
- <div class="row flex-fill mt-5 flex-wrap">
9
-
10
-
11
- <!-- login desde sistema externo -->
12
- <div class="col-12 col-lg-5 offset-lg-1">
13
- <div class="border rounded p-4 shadow-sm bg-light">
14
- <h3 class="text-muted fw-semibold text-start mb-3">login externo (api-key)</h3>
15
- <div class="text-center mb-4">
16
- <p class="text-muted widget-intro-text">
17
- Este formulario permite testear el acceso a IAToolkit desde un portal externo utilizando una api-key.
18
- El external user ID es el nombre del usuario ya autentificado en algún portal interno de la empresa.
19
- </p>
20
- </div>
21
- <form id="jwt-form" method="post">
22
- <div class="mb-3">
23
- <label for="company_name" class="form-label d-block">Empresa</label>
24
- <select id="company_name" name="company_short_name" class="form-select" required>
25
- <option value="" disabled selected>Selecciona una empresa</option>
26
- {% for company in companies %}
27
- {% if company.allow_jwt %}
28
- <option value="{{ company.short_name }}"> {{ company.short_name }}
29
- </option>
30
- {% endif %}
31
- {% endfor %}
32
- </select>
33
- </div>
34
-
35
- <div class="mb-3">
36
- <label for="external_user_id" class="form-label d-block">External user ID</label>
37
- <input type="text" id="external_user_id" name="external_user_id" class="form-control" required>
38
- </div>
39
-
40
- <button type="button"
41
- id="initiateJwtChatButton"
42
- class="ml-5 btn btn-primary">
43
- <span class="spinner-border spinner-border-sm d-none" role="status" aria-hidden="true"></span>
44
- Iniciar Sesión
45
- </button>
46
- </form>
47
- </div>
48
- </div>
49
-
50
- </div>
51
-
52
- {% endblock %}
53
-
54
- {% block scripts %}
55
-
56
- <script>
57
- // Variables pasadas desde Flask (HomeView)
58
- const API_KEY = "{{ api_key|safe }}";
59
-
60
- $(document).ready(function () {
61
- // Función para actualizar el enlace de "Registrarse" y el action del formulario "Iniciar Sesión"
62
- function updateLinksAndForm() {
63
- const selectedCompany = $('#company_short_name').val(); // Obtenemos el valor del select
64
-
65
- // Actualizar enlace "Registrarse"
66
- if (selectedCompany && selectedCompany.trim() !== '') {
67
- const signupUrl = '/' + selectedCompany + '/signup';
68
- $('#signup-link').attr('href', signupUrl); // Actualizamos el href del botón "Registrarse"
69
- } else {
70
- $('#signup-link').attr('href', '#'); // Enlace a "#" si no hay empresa seleccionada
71
- }
72
-
73
- // Actualizar action del formulario "Iniciar Sesión"
74
- if (selectedCompany && selectedCompany.trim() !== '') {
75
- const loginAction = '/' + selectedCompany + '/external_login';
76
- $('#login-form').attr('action', loginAction); // Actualizamos la URL del form
77
- } else {
78
- $('#login-form').attr('action', '#'); // URL genérica si no hay selección
79
- }
80
- }
81
-
82
- // Actualizamos al cargar la página
83
- updateLinksAndForm();
84
-
85
- // Escuchamos el evento de cambio en el dropdown para actualizar dinámicamente
86
- $('#company_short_name').on('change', function () {
87
- updateLinksAndForm();
88
- });
89
-
90
- // Interceptamos el click en "Registrarse"
91
- $('#signup-link').on('click', function (e) {
92
- const selectedCompany = $('#company_short_name').val();
93
-
94
- if (!selectedCompany || selectedCompany.trim() === '') {
95
- e.preventDefault(); // evitar navegación al #
96
- Swal.fire({
97
- icon: 'warning',
98
- title: 'Empresa no seleccionada',
99
- text: 'Por favor, selecciona una empresa antes de registrarte.'
100
- });
101
- }
102
- });
103
-
104
- // Event listener para el botón de "Abrir Chat (JWT)"
105
- $('#initiateJwtChatButton').on('click', function() {
106
-
107
- const selectedCompany = $('#company_name').val();
108
- const externalUserId = $('#external_user_id').val();
109
-
110
- if (!selectedCompany || !externalUserId.trim()) {
111
- Swal.fire({ icon: 'warning', title: 'Campos Requeridos', text: 'Por favor, selecciona una empresa e ingresa un ID de usuario.' });
112
- return;
113
- }
114
- if (!API_KEY || API_KEY.includes("defecto")) {
115
- Swal.fire({ icon: 'error', title: 'Error de Configuración', text: 'La API Key de la aplicación no está disponible.' });
116
- return;
117
- }
118
-
119
- fetch(`/${selectedCompany}/external_login`, {
120
- method: 'POST',
121
- headers: {
122
- 'Content-Type': 'application/json',
123
- 'Authorization': `Bearer ${API_KEY}`
124
- },
125
- body: JSON.stringify({
126
- external_user_id: externalUserId
127
- })
128
- })
129
- .then(async response => {
130
- if (response.ok) { // Si el status es 200, la respuesta es el HTML
131
- return response.text();
132
- } else { // Si hay un error, el cuerpo es JSON
133
- const errorData = await response.json();
134
- throw new Error(errorData.error || 'Ocurrió un error desconocido.');
135
- }
136
- })
137
- .then(htmlContent => {
138
- // Éxito: Abrimos el HTML que nos devolvió el servidor en una nueva pestaña.
139
- const newTab = window.open();
140
- newTab.document.write(htmlContent);
141
- newTab.document.close();
142
- })
143
- .catch(error => {
144
- Swal.fire({ icon: 'error', title: 'Error de Inicio de Sesión', text: error.message });
145
- })
146
-
147
- });
148
- });
149
- </script>
150
- {% endblock %}
@@ -1,46 +0,0 @@
1
- # Copyright (c) 2024 Fernando Libedinsky
2
- # Product: IAToolkit
3
- #
4
- # IAToolkit is open source software.
5
-
6
- from flask.views import MethodView
7
- from flask import render_template, request
8
- from injector import inject
9
- from iatoolkit.services.profile_service import ProfileService
10
- from iatoolkit.services.branding_service import BrandingService
11
- from iatoolkit.services.onboarding_service import OnboardingService
12
- import os
13
-
14
-
15
- class LoginTest(MethodView):
16
- @inject
17
- def __init__(self,
18
- profile_service: ProfileService,
19
- branding_service: BrandingService,
20
- onboarding_service: OnboardingService):
21
- self.profile_service = profile_service
22
- self.branding_service = branding_service
23
- self.onboarding_service = onboarding_service
24
-
25
- def get(self):
26
- alert_message = request.args.get('alert_message', None)
27
- companies = self.profile_service.get_companies()
28
- branding_data = None
29
- onboarding_cards = {}
30
- if companies:
31
- # Obtener el branding de la primera empresa para la página de prueba
32
- first_company = companies[0]
33
- branding_data = self.branding_service.get_company_branding(first_company)
34
- onboarding_cards = self.onboarding_service.get_onboarding_cards(first_company)
35
-
36
- # Esta API_KEY para el login
37
- api_key_for_login = os.getenv("IATOOLKIT_API_KEY", "tu_api_key_por_defecto_o_error")
38
-
39
- return render_template('login_test.html',
40
- companies=companies,
41
- branding=branding_data,
42
- onboarding_cards=onboarding_cards,
43
- alert_message=alert_message,
44
- alert_icon='success' if alert_message else None,
45
- api_key=api_key_for_login
46
- )
File without changes
File without changes
File without changes