iatoolkit 0.63.1__py3-none-any.whl → 0.67.0__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 (78) hide show
  1. iatoolkit/__init__.py +2 -0
  2. iatoolkit/base_company.py +1 -20
  3. iatoolkit/common/routes.py +11 -2
  4. iatoolkit/common/session_manager.py +2 -0
  5. iatoolkit/common/util.py +17 -0
  6. iatoolkit/company_registry.py +1 -2
  7. iatoolkit/iatoolkit.py +41 -5
  8. iatoolkit/locales/en.yaml +167 -0
  9. iatoolkit/locales/es.yaml +163 -0
  10. iatoolkit/repositories/database_manager.py +3 -3
  11. iatoolkit/repositories/document_repo.py +1 -1
  12. iatoolkit/repositories/models.py +2 -3
  13. iatoolkit/repositories/profile_repo.py +0 -4
  14. iatoolkit/services/auth_service.py +14 -9
  15. iatoolkit/services/branding_service.py +32 -22
  16. iatoolkit/services/configuration_service.py +140 -0
  17. iatoolkit/services/dispatcher_service.py +20 -18
  18. iatoolkit/services/document_service.py +5 -2
  19. iatoolkit/services/excel_service.py +15 -11
  20. iatoolkit/services/file_processor_service.py +4 -12
  21. iatoolkit/services/history_service.py +8 -7
  22. iatoolkit/services/i18n_service.py +104 -0
  23. iatoolkit/services/jwt_service.py +7 -9
  24. iatoolkit/services/language_service.py +79 -0
  25. iatoolkit/services/load_documents_service.py +4 -4
  26. iatoolkit/services/mail_service.py +9 -4
  27. iatoolkit/services/onboarding_service.py +10 -4
  28. iatoolkit/services/profile_service.py +58 -38
  29. iatoolkit/services/prompt_manager_service.py +20 -16
  30. iatoolkit/services/query_service.py +15 -14
  31. iatoolkit/services/sql_service.py +6 -2
  32. iatoolkit/services/user_feedback_service.py +16 -14
  33. iatoolkit/static/js/chat_feedback_button.js +57 -87
  34. iatoolkit/static/js/chat_help_content.js +124 -0
  35. iatoolkit/static/js/chat_history_button.js +48 -65
  36. iatoolkit/static/js/chat_main.js +27 -24
  37. iatoolkit/static/js/chat_reload_button.js +28 -45
  38. iatoolkit/static/styles/chat_iatoolkit.css +223 -315
  39. iatoolkit/static/styles/chat_modal.css +63 -97
  40. iatoolkit/static/styles/chat_public.css +107 -0
  41. iatoolkit/static/styles/landing_page.css +0 -1
  42. iatoolkit/templates/_company_header.html +6 -2
  43. iatoolkit/templates/_login_widget.html +42 -0
  44. iatoolkit/templates/base.html +34 -19
  45. iatoolkit/templates/change_password.html +22 -20
  46. iatoolkit/templates/chat.html +58 -27
  47. iatoolkit/templates/chat_modals.html +113 -74
  48. iatoolkit/templates/error.html +12 -13
  49. iatoolkit/templates/forgot_password.html +11 -7
  50. iatoolkit/templates/index.html +8 -3
  51. iatoolkit/templates/login_simulation.html +16 -5
  52. iatoolkit/templates/onboarding_shell.html +0 -1
  53. iatoolkit/templates/signup.html +14 -14
  54. iatoolkit/views/base_login_view.py +12 -1
  55. iatoolkit/views/change_password_view.py +49 -33
  56. iatoolkit/views/forgot_password_view.py +20 -19
  57. iatoolkit/views/help_content_api_view.py +54 -0
  58. iatoolkit/views/history_api_view.py +13 -9
  59. iatoolkit/views/home_view.py +30 -38
  60. iatoolkit/views/init_context_api_view.py +16 -11
  61. iatoolkit/views/llmquery_api_view.py +38 -26
  62. iatoolkit/views/login_simulation_view.py +14 -2
  63. iatoolkit/views/login_view.py +47 -35
  64. iatoolkit/views/logout_api_view.py +26 -22
  65. iatoolkit/views/profile_api_view.py +46 -0
  66. iatoolkit/views/prompt_api_view.py +6 -6
  67. iatoolkit/views/signup_view.py +26 -24
  68. iatoolkit/views/user_feedback_api_view.py +19 -18
  69. iatoolkit/views/verify_user_view.py +30 -29
  70. {iatoolkit-0.63.1.dist-info → iatoolkit-0.67.0.dist-info}/METADATA +40 -22
  71. iatoolkit-0.67.0.dist-info/RECORD +120 -0
  72. iatoolkit-0.67.0.dist-info/licenses/LICENSE +21 -0
  73. iatoolkit/static/styles/chat_info.css +0 -53
  74. iatoolkit/templates/header.html +0 -31
  75. iatoolkit/templates/test.html +0 -9
  76. iatoolkit-0.63.1.dist-info/RECORD +0 -112
  77. {iatoolkit-0.63.1.dist-info → iatoolkit-0.67.0.dist-info}/WHEEL +0 -0
  78. {iatoolkit-0.63.1.dist-info → iatoolkit-0.67.0.dist-info}/top_level.txt +0 -0
iatoolkit/__init__.py CHANGED
@@ -13,6 +13,7 @@ from .base_company import BaseCompany
13
13
  from iatoolkit.repositories.database_manager import DatabaseManager
14
14
 
15
15
  # --- Services ---
16
+ from iatoolkit.services.configuration_service import ConfigurationService
16
17
  from iatoolkit.services.query_service import QueryService
17
18
  from iatoolkit.services.sql_service import SqlService
18
19
  from iatoolkit.services.document_service import DocumentService
@@ -29,6 +30,7 @@ __all__ = [
29
30
  'BaseCompany',
30
31
  'DatabaseManager',
31
32
  'QueryService',
33
+ 'ConfigurationService',
32
34
  'SqlService',
33
35
  'ExcelService',
34
36
  'DocumentService',
iatoolkit/base_company.py CHANGED
@@ -7,7 +7,6 @@
7
7
  from abc import ABC, abstractmethod
8
8
  from iatoolkit.repositories.profile_repo import ProfileRepo
9
9
  from iatoolkit.repositories.llm_query_repo import LLMQueryRepo
10
-
11
10
  from iatoolkit.services.prompt_manager_service import PromptService
12
11
  from iatoolkit.repositories.models import Company, Function, PromptCategory
13
12
  from iatoolkit import IAToolkit
@@ -22,22 +21,14 @@ class BaseCompany(ABC):
22
21
  self.prompt_service: PromptService = injector.get(PromptService)
23
22
  self.company: Company | None = None
24
23
 
25
- def _load_company_by_short_name(self, short_name: str) -> Company:
26
- self.company = self.profile_repo.get_company_by_short_name(short_name)
27
- return self.company
28
-
29
24
  def _create_company(self,
30
25
  short_name: str,
31
26
  name: str,
32
27
  parameters: dict | None = None,
33
- branding: dict | None = None,
34
- onboarding_cards: dict | None = None,
35
28
  ) -> Company:
36
29
  company_obj = Company(short_name=short_name,
37
30
  name=name,
38
- parameters=parameters,
39
- branding=branding,
40
- onboarding_cards=onboarding_cards)
31
+ parameters=parameters)
41
32
  self.company = self.profile_repo.create_company(company_obj)
42
33
  return self.company
43
34
 
@@ -78,11 +69,6 @@ class BaseCompany(ABC):
78
69
  )
79
70
 
80
71
 
81
- @abstractmethod
82
- # initialize all the database tables needed
83
- def register_company(self):
84
- raise NotImplementedError("La subclase debe implementar el método create_company()")
85
-
86
72
  @abstractmethod
87
73
  # get context specific for this company
88
74
  def get_company_context(self, **kwargs) -> str:
@@ -98,11 +84,6 @@ class BaseCompany(ABC):
98
84
  def handle_request(self, tag: str, params: dict) -> dict:
99
85
  raise NotImplementedError("La subclase debe implementar el método handle_request()")
100
86
 
101
- @abstractmethod
102
- # get context specific for the query
103
- def start_execution(self):
104
- raise NotImplementedError("La subclase debe implementar el método start_execution()")
105
-
106
87
  @abstractmethod
107
88
  # get context specific for the query
108
89
  def get_metadata_from_filename(self, filename: str) -> dict:
@@ -5,7 +5,6 @@
5
5
 
6
6
  from flask import render_template, redirect, url_for,send_from_directory, current_app, abort
7
7
  from flask import jsonify
8
- from iatoolkit.views.history_api_view import HistoryApiView
9
8
 
10
9
 
11
10
  # this function register all the views
@@ -24,6 +23,10 @@ def register_views(injector, app):
24
23
  from iatoolkit.views.file_store_api_view import FileStoreApiView
25
24
  from iatoolkit.views.user_feedback_api_view import UserFeedbackApiView
26
25
  from iatoolkit.views.prompt_api_view import PromptApiView
26
+ from iatoolkit.views.history_api_view import HistoryApiView
27
+ from iatoolkit.views.help_content_api_view import HelpContentApiView
28
+ from iatoolkit.views.profile_api_view import UserLanguageApiView # <-- Importa la nueva vista
29
+
27
30
  from iatoolkit.views.login_view import LoginView, FinalizeContextView
28
31
  from iatoolkit.views.external_login_view import ExternalLoginView, RedeemTokenApiView
29
32
  from iatoolkit.views.logout_api_view import LogoutApiView
@@ -53,6 +56,11 @@ def register_views(injector, app):
53
56
  view_func=FinalizeContextView.as_view('finalize_with_token')
54
57
  )
55
58
 
59
+ app.add_url_rule(
60
+ '/api/profile/language',
61
+ view_func=UserLanguageApiView.as_view('user_language_api')
62
+ )
63
+
56
64
  # logout
57
65
  app.add_url_rule('/<company_short_name>/api/logout',
58
66
  view_func=LogoutApiView.as_view('logout'))
@@ -79,9 +87,10 @@ def register_views(injector, app):
79
87
  # open the promt directory
80
88
  app.add_url_rule('/<company_short_name>/api/prompts', view_func=PromptApiView.as_view('prompt'))
81
89
 
82
- # feedback and history
90
+ # toolbar buttons
83
91
  app.add_url_rule('/<company_short_name>/api/feedback', view_func=UserFeedbackApiView.as_view('feedback'))
84
92
  app.add_url_rule('/<company_short_name>/api/history', view_func=HistoryApiView.as_view('history'))
93
+ app.add_url_rule('/<company_short_name>/api/help-content', view_func=HelpContentApiView.as_view('help-content'))
85
94
 
86
95
  # tasks management endpoints: create task, and review answer
87
96
  app.add_url_rule('/tasks', view_func=TaskApiView.as_view('tasks'))
@@ -3,6 +3,8 @@
3
3
  #
4
4
  # IAToolkit is open source software.
5
5
 
6
+ # This is the Flask connected session manager for IAToolkit
7
+
6
8
  from flask import session
7
9
 
8
10
  class SessionManager:
iatoolkit/common/util.py CHANGED
@@ -81,6 +81,23 @@ class Utility:
81
81
  f'No se pudo renderizar el template desde el string, error: {str(e)}') from e
82
82
 
83
83
 
84
+ def get_company_template(self, company_short_name: str, template_name: str) -> str:
85
+ # 1. get the path to the company specific template
86
+ template_path = os.path.join(os.getcwd(), f'companies/{company_short_name}/templates/{template_name}')
87
+ if not os.path.exists(template_path):
88
+ return None
89
+
90
+ # 2. read the file
91
+ try:
92
+ with open(template_path, 'r') as f:
93
+ template_string = f.read()
94
+
95
+ return template_string
96
+ except Exception as e:
97
+ logging.exception(e)
98
+ return None
99
+
100
+
84
101
  def serialize(self, obj):
85
102
  if isinstance(obj, datetime) or isinstance(obj, date):
86
103
  return obj.isoformat()
@@ -31,10 +31,9 @@ class CompanyRegistry:
31
31
 
32
32
  # save the created instance in the registry
33
33
  self._company_instances[company_key] = company_instance
34
- logging.info(f"company '{company_key}' instantiated")
35
34
 
36
35
  except Exception as e:
37
- logging.error(f"Error instanciando empresa {company_key}: {e}")
36
+ logging.error(f"Error while creating company instance for {company_key}: {e}")
38
37
  logging.exception(e)
39
38
  raise
40
39
 
iatoolkit/iatoolkit.py CHANGED
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # IAToolkit is open source software.
5
5
 
6
- from flask import Flask, url_for
6
+ from flask import Flask, url_for, get_flashed_messages
7
7
  from flask_session import Session
8
8
  from flask_injector import FlaskInjector
9
9
  from flask_bcrypt import Bcrypt
@@ -19,7 +19,7 @@ from werkzeug.middleware.proxy_fix import ProxyFix
19
19
  from injector import Binder, Injector, singleton
20
20
  from importlib.metadata import version as _pkg_version, PackageNotFoundError
21
21
 
22
- IATOOLKIT_VERSION = "0.63.1"
22
+ IATOOLKIT_VERSION = "0.67.0"
23
23
 
24
24
  # global variable for the unique instance of IAToolkit
25
25
  _iatoolkit_instance: Optional['IAToolkit'] = None
@@ -96,6 +96,7 @@ class IAToolkit:
96
96
  self._setup_cors()
97
97
  self._setup_additional_services()
98
98
  self._setup_cli_commands()
99
+ self._setup_request_globals()
99
100
  self._setup_context_processors()
100
101
 
101
102
  # Step 8: define the download_dir for excel's
@@ -109,6 +110,22 @@ class IAToolkit:
109
110
  # get a value from the config dict or the environment variable
110
111
  return self.config.get(key, os.getenv(key, default))
111
112
 
113
+ def _setup_request_globals(self):
114
+ """
115
+ Configures functions to run before each request to set up
116
+ request-global variables, such as language.
117
+ """
118
+ injector = self._injector
119
+
120
+ @self.app.before_request
121
+ def set_request_language():
122
+ """
123
+ Determines and caches the language for the current request in g.lang.
124
+ """
125
+ from iatoolkit.services.language_service import LanguageService
126
+ language_service = injector.get(LanguageService)
127
+ language_service.get_current_language()
128
+
112
129
  def _setup_logging(self):
113
130
  # Lee el nivel de log desde una variable de entorno, con 'INFO' como valor por defecto.
114
131
  log_level_name = os.getenv('LOG_LEVEL', 'INFO').upper()
@@ -299,6 +316,10 @@ class IAToolkit:
299
316
  from iatoolkit.services.jwt_service import JWTService
300
317
  from iatoolkit.services.dispatcher_service import Dispatcher
301
318
  from iatoolkit.services.branding_service import BrandingService
319
+ from iatoolkit.services.i18n_service import I18nService
320
+ from iatoolkit.services.language_service import LanguageService
321
+ from iatoolkit.services.onboarding_service import OnboardingService
322
+ from iatoolkit.services.configuration_service import ConfigurationService
302
323
 
303
324
  binder.bind(QueryService, to=QueryService)
304
325
  binder.bind(TaskService, to=TaskService)
@@ -312,6 +333,10 @@ class IAToolkit:
312
333
  binder.bind(JWTService, to=JWTService)
313
334
  binder.bind(Dispatcher, to=Dispatcher)
314
335
  binder.bind(BrandingService, to=BrandingService)
336
+ binder.bind(OnboardingService, to=OnboardingService)
337
+ binder.bind(I18nService, to=I18nService)
338
+ binder.bind(LanguageService, to=LanguageService)
339
+ binder.bind(ConfigurationService, to=ConfigurationService)
315
340
 
316
341
  def _bind_infrastructure(self, binder: Binder):
317
342
  from iatoolkit.infra.llm_client import llmClient
@@ -338,9 +363,9 @@ class IAToolkit:
338
363
  # instantiate all the registered companies
339
364
  get_company_registry().instantiate_companies(self._injector)
340
365
 
341
- # use the dispatcher to start the execution of every company
366
+ # use the dispatcher to load the config and prepare the execution
342
367
  dispatcher = self._injector.get(Dispatcher)
343
- dispatcher.start_execution()
368
+ dispatcher.load_company_configs()
344
369
 
345
370
  def _setup_cli_commands(self):
346
371
  from iatoolkit.cli_commands import register_core_commands
@@ -366,8 +391,18 @@ class IAToolkit:
366
391
  def inject_globals():
367
392
  from iatoolkit.common.session_manager import SessionManager
368
393
  from iatoolkit.services.profile_service import ProfileService
394
+ from iatoolkit.services.i18n_service import I18nService
369
395
 
396
+ # Get services from the injector
370
397
  profile_service = self._injector.get(ProfileService)
398
+ i18n_service = self._injector.get(I18nService)
399
+
400
+ # The 't' function wrapper no longer needs to determine the language itself.
401
+ # It will be automatically handled by the refactored I18nService.
402
+ def translate_for_template(key: str, **kwargs):
403
+ return i18n_service.t(key, **kwargs)
404
+
405
+ # Get user profile if a session exists
371
406
  user_profile = profile_service.get_current_session_info().get('profile', {})
372
407
 
373
408
  return {
@@ -379,9 +414,10 @@ class IAToolkit:
379
414
  'user_is_local': user_profile.get('user_is_local'),
380
415
  'user_email': user_profile.get('user_email'),
381
416
  'iatoolkit_base_url': os.environ.get('IATOOLKIT_BASE_URL', ''),
417
+ 'flashed_messages': get_flashed_messages(with_categories=True),
418
+ 't': translate_for_template
382
419
  }
383
420
 
384
-
385
421
  def _get_default_static_folder(self) -> str:
386
422
  try:
387
423
  current_dir = os.path.dirname(os.path.abspath(__file__)) # .../src/iatoolkit
@@ -0,0 +1,167 @@
1
+ # Language: English
2
+ ui:
3
+ login_widget:
4
+ title: "Sign In"
5
+ welcome_message: "Enter your credentials or register to access Sample Company’s AI platform."
6
+ email_placeholder: "Email address"
7
+ password_placeholder: "Password"
8
+ login_button: "Login"
9
+ forgot_password_link: "Forgot your password?"
10
+ no_account_prompt: "Don't have an account?"
11
+ signup_link: "Sign Up"
12
+
13
+ signup:
14
+ title: "Create an Account"
15
+ subtitle: "Start your journey with us today."
16
+ first_name_label: "First Name"
17
+ last_name_label: "Last Name"
18
+ email_label: "Email Address"
19
+ password_label: "Password"
20
+ confirm_password_label: "Confirm Password"
21
+ signup_button: "Create Account"
22
+ already_have_account: "Already have an account?"
23
+ login_link: "Log In"
24
+ disclaimer: "🔒We value your privacy. Your data will be used exclusively for the operation of the platform."
25
+
26
+ forgot_password:
27
+ title: "Recover Password"
28
+ subtitle: "Enter your email address and we will send you a link to reset your password."
29
+ submit_button: "Send Recovery Link"
30
+ back_to_login: "Back to Login"
31
+
32
+ change_password:
33
+ title: "Create New Password"
34
+ subtitle: "You are changing the password for <strong>{email}</strong>."
35
+ temp_code_label: "Temporary Code"
36
+ temp_code_placeholder: "Check your email"
37
+ new_password_label: "New Password"
38
+ password_instructions: "Must contain at least 8 characters, an uppercase letter, a lowercase letter, a number, and a special character."
39
+ confirm_password_label: "Confirm New Password"
40
+ save_button: "Save Password"
41
+ back_to_home: "Back to home"
42
+
43
+ chat:
44
+ welcome_message: "Hello! How can I help you today?"
45
+ input_placeholder: "Type your query here..."
46
+ prompts_available: "Available prompts"
47
+
48
+ tooltips:
49
+ history: "History of my queries"
50
+ reload_context: "Force Context Reload"
51
+ feedback: "Your feedback is very important"
52
+ usage_guide: "Usage Guide"
53
+ onboarding: "How to ask better questions"
54
+ logout: "Log out"
55
+ use_prompt_assistant: "Use Prompt Assistant"
56
+ attach_files: "Attach files"
57
+ view_attached_files: "View attached files"
58
+ send: "Send"
59
+ stop: "Stop"
60
+
61
+ modals:
62
+ files_title: "Uploaded Files"
63
+ feedback_title: "Your Opinion is Important"
64
+ feedback_prompt: "How useful was the assistant's response?"
65
+ feedback_comment_label: "Your feedback helps us improve:"
66
+ feedback_comment_placeholder: "Write your opinion, suggestions, or comments here..."
67
+ history_title: "Query History"
68
+ history_table_date: "Date"
69
+ history_table_query: "Query"
70
+ loading_history: "Loading history..."
71
+ no_history_found: "No query history found."
72
+ help_title: "AI Assistant User Guide"
73
+
74
+ buttons:
75
+ cancel: "Close"
76
+ send: "Send"
77
+ stop: "Stop"
78
+
79
+ errors:
80
+ company_not_found: "The company {company_short_name} does not exist."
81
+ timeout: "timeout expired."
82
+ auth:
83
+ invalid_password: "The provided password is incorrect."
84
+ user_not_found: "A user with that email address was not found."
85
+ invalid_or_expired_token: "Invalid or expired token."
86
+ session_creation_failed: "Could not create user session."
87
+ authentication_required: "Authentication required. No session cookie or API Key provided."
88
+ invalid_api_key: "Invalid or inactive API Key."
89
+ no_user_identifier_api: "No user_identifier provided for API call."
90
+ templates:
91
+ company_not_found: "Company not found."
92
+ home_template_not_found: "The home page template for the company '{company_name}' is not configured."
93
+ template_not_found: "Template not found: '{template_name}'."
94
+
95
+ processing_error: "An error occurred while processing the custom home page template: {error}"
96
+ general:
97
+ unexpected_error: "An unexpected error has occurred. Please contact support."
98
+ unsupported_language: "The selected language is not supported."
99
+ signup:
100
+ company_not_found: "The company {company_name} does not exist."
101
+ incorrect_password_for_existing_user: "The password for the user {email} is incorrect."
102
+ user_already_registered: "The user with email '{email}' already exists in this company."
103
+ password_mismatch: "The passwords do not match. Please try again."
104
+ change_password:
105
+ token_expired: "The password change link has expired. Please request a new one."
106
+ password_mismatch: "The passwords do not match. Please try again."
107
+ invalid_temp_code: "The temporary code is not valid. Please check it or request a new one."
108
+ forgot_password:
109
+ user_not_registered: "The user with email {email} is not registered."
110
+ verification:
111
+ token_expired: "The verification link has expired. Please contact support if you need a new one."
112
+ user_not_found: "The user you are trying to verify does not exist."
113
+ validation:
114
+ password_too_short: "Password must be at least 8 characters long."
115
+ password_no_uppercase: "Password must contain at least one uppercase letter."
116
+ password_no_lowercase: "Password must contain at least one lowercase letter."
117
+ password_no_digit: "Password must contain at least one number."
118
+ password_no_special_char: "Password must contain at least one special character."
119
+
120
+ services:
121
+ no_text_file: "The file is not text or the encoding is not UTF-8"
122
+ no_output_file: "Missing output file name"
123
+ no_data_for_excel: "Missing data or it is not a list of dictionaries"
124
+ no_download_directory: "Temporary directory for saving Excel files is not configured"
125
+ cannot_create_excel: "Could not create the Excel file"
126
+ invalid_filename: "Invalid filename"
127
+ file_not_exist: "File not found"
128
+ path_is_not_a_file: "The path does not correspond to a file"
129
+ file_validation_error: "Error validating file"
130
+ user_not_authorized: "user is not authorized for this company"
131
+ account_not_verified: "Your account has not been verified. Please check your email."
132
+ missing_response_id: "Can not found 'previous_response_id' for '{company_short_name}/{user_identifier}'. Reinit context"
133
+
134
+
135
+ api_responses:
136
+ context_reloaded_success: "The context has been successfully reloaded."
137
+
138
+ services:
139
+ mail_sent: "Email sent successfully."
140
+ start_query: "Hello, what can I help you with today?"
141
+
142
+
143
+ flash_messages:
144
+ password_changed_success: "Your password has been successfully reset. You can now log in."
145
+ login_required: "Please log in to continue."
146
+ signup_success: "Registration successful. Please check your email to verify your account."
147
+ user_associated_success: "Existing user successfully associated with the new company."
148
+ account_verified_success: "Your account has been successfully verified. Welcome!"
149
+ forgot_password_success: "If your email is registered, you will receive a link to reset your password."
150
+
151
+ # Keys specifically for JavaScript
152
+ js_messages:
153
+ feedback_sent_success_title: "Feedback Sent"
154
+ feedback_sent_success_body: "Thank you for your feedback!"
155
+ feedback_sent_error: "Could not send feedback, please try again."
156
+ feedback_rating_error: "Please rate the assistant using the stars."
157
+ feedback_comment_error: "Please write your comment before sending."
158
+ context_reloaded: "Context has been reloaded."
159
+ error_loading_history: "An error occurred while loading the history."
160
+ request_aborted: "The response generation has been stopped."
161
+ processing_error: "An error occurred while processing the request."
162
+ server_comm_error: "Server communication error ({status}). Please try again later."
163
+ network_error: "A network error occurred. Please try again in a few moments."
164
+ unknown_server_error: "Unknown server error."
165
+ loading: "Loading..."
166
+ reload_init: "init reloading context in background..."
167
+ no_history_found: "No query history found."
@@ -0,0 +1,163 @@
1
+ # locales/es.yaml
2
+ ui:
3
+ login_widget:
4
+ title: "Iniciar Sesión"
5
+ welcome_message: "Ingresa tus credenciales o registrate para acceder a la plataforma IA de Sample Company."
6
+ email_placeholder: "Correo electrónico"
7
+ login_button: "Acceder"
8
+ forgot_password_link: "¿Olvidaste tu contraseña?"
9
+ no_account_prompt: "¿No tienes una cuenta?"
10
+ signup_link: "Regístrate"
11
+
12
+ signup:
13
+ title: "Crear una Cuenta"
14
+ subtitle: "Comienza tu viaje con nosotros hoy."
15
+ first_name_label: "Nombre"
16
+ last_name_label: "Apellido"
17
+ email_label: "Correo Electrónico"
18
+ password_label: "Contraseña"
19
+ confirm_password_label: "Confirmar Contraseña"
20
+ signup_button: "Crear Cuenta"
21
+ already_have_account: "¿Ya tienes una cuenta?"
22
+ login_link: "Inicia Sesión"
23
+ disclaimer: "🔒 Valoramos tu privacidad. Tus datos se usarán exclusivamente para el funcionamiento de la plataforma."
24
+
25
+ forgot_password:
26
+ title: "Recuperar Contraseña"
27
+ subtitle: "Ingresa tu correo electrónico y te enviaremos un enlace para restablecer tu contraseña."
28
+ submit_button: "Enviar Enlace de Recuperación"
29
+ back_to_login: "Volver a Iniciar Sesión"
30
+
31
+ change_password:
32
+ title: "Crear Nueva Contraseña"
33
+ subtitle: "Estás cambiando la contraseña para <strong>{email}</strong>."
34
+ temp_code_label: "Código Temporal"
35
+ temp_code_placeholder: "Revisa tu correo electrónico"
36
+ new_password_label: "Nueva Contraseña"
37
+ password_instructions: "Debe contener al menos 8 caracteres, mayúscula, minúscula, número y un carácter especial."
38
+ confirm_password_label: "Confirmar Nueva Contraseña"
39
+ save_button: "Guardar Contraseña"
40
+ back_to_home: "Volver al inicio"
41
+
42
+ chat:
43
+ welcome_message: "¡Hola! ¿En qué te puedo ayudar hoy?"
44
+ input_placeholder: "Escribe tu consulta aquí..."
45
+ prompts_available: "Prompts disponibles"
46
+
47
+ tooltips:
48
+ history: "Historial con mis consultas"
49
+ reload_context: "Forzar Recarga de Contexto"
50
+ feedback: "Tu feedback es muy importante"
51
+ usage_guide: "Guía de Uso"
52
+ onboarding: "Cómo preguntar mejor"
53
+ logout: "Cerrar sesión"
54
+ use_prompt_assistant: "Usar Asistente de Prompts"
55
+ attach_files: "Adjuntar archivos"
56
+ view_attached_files: "Ver archivos adjuntos"
57
+ modals:
58
+ files_title: "Archivos Cargados"
59
+ feedback_title: "Tu Opinión es Importante"
60
+ feedback_prompt: "¿Qué tan útil fue la respuesta del asistente?"
61
+ feedback_comment_label: "Tu comentario nos ayuda a mejorar:"
62
+ feedback_comment_placeholder: "Escribe aquí tu opinión, sugerencias o comentarios..."
63
+ history_title: "Historial de Consultas"
64
+ history_table_date: "Fecha"
65
+ history_table_query: "Consulta"
66
+ loading_history: "Cargando historial..."
67
+ no_history_found: "No se encontró historial de consultas."
68
+ help_title: "Guía de uso del Asistente IA"
69
+
70
+ buttons:
71
+ cancel: "Cerrar"
72
+ send: "Enviar"
73
+ stop: "Detener"
74
+
75
+ errors:
76
+ company_not_found: "La empresa {company_short_name} no existe."
77
+ timeout: "El tiempo de espera ha expirado."
78
+
79
+
80
+ auth:
81
+ invalid_password: "La contraseña proporcionada es incorrecta."
82
+ user_not_found: "No se encontró un usuario con ese correo."
83
+ invalid_or_expired_token: "Token inválido o expirado."
84
+ session_creation_failed: "No se pudo crear la sesión del usuario."
85
+ authentication_required: "Autenticación requerida. No se proporcionó cookie de sesión o clave de API."
86
+ invalid_api_key: "Clave de API inválida o inactiva."
87
+ no_user_identifier_api: "No se proporcionó user_identifier para la llamada a la API."
88
+ templates:
89
+ company_not_found: "Empresa no encontrada."
90
+ home_template_not_found: "La plantilla de la página de inicio para la empresa '{company_name}' no está configurada."
91
+ processing_error: "Error al procesar el template: {error}"
92
+ template_not_found: "No se encontro el template: '{template_name}'."
93
+
94
+ general:
95
+ unexpected_error: "Ha ocurrido un error inesperado: {error}."
96
+ unsupported_language: "El idioma seleccionado no es válido."
97
+ signup:
98
+ company_not_found: "La empresa {company_name} no existe."
99
+ incorrect_password_for_existing_user: "La contraseña para el usuario {email} es incorrecta."
100
+ user_already_registered: "El usuario con email '{email}' ya existe en esta empresa."
101
+ password_mismatch: "Las contraseñas no coinciden. Por favor, inténtalo de nuevo."
102
+ change_password:
103
+ token_expired: "El enlace de cambio de contraseña ha expirado. Por favor, solicita uno nuevo."
104
+ password_mismatch: "Las contraseñas no coinciden. Por favor, inténtalo nuevamente."
105
+ invalid_temp_code: "El código temporal no es válido. Por favor, verifica o solicita uno nuevo."
106
+ forgot_password:
107
+ user_not_registered: "El usuario con correo {email} no está registrado."
108
+ verification:
109
+ token_expired: "El enlace de verificación ha expirado. Por favor, contacta a soporte si necesitas uno nuevo."
110
+ user_not_found: "El usuario que intentas verificar no existe."
111
+ validation:
112
+ password_too_short: "La contraseña debe tener al menos 8 caracteres."
113
+ password_no_uppercase: "La contraseña debe tener al menos una letra mayúscula."
114
+ password_no_lowercase: "La contraseña debe tener al menos una letra minúscula."
115
+ password_no_digit: "La contraseña debe tener al menos un número."
116
+ password_no_special_char: "La contraseña debe tener al menos un carácter especial."
117
+
118
+ services:
119
+ no_text_file: "El archivo no es texto o la codificación no es UTF-8"
120
+ no_output_file: "falta el nombre del archivo de salida"
121
+ no_data_for_excel: "faltan los datos o no es una lista de diccionarios"
122
+ no_download_directory: "no esta configurado el directorio temporal para guardar excels"
123
+ cannot_create_excel: "no se pudo crear el archivo excel"
124
+ invalid_filename: "Nombre de archivo inválido"
125
+ file_not_exist : "Archivo no encontrado"
126
+ path_is_not_a_file : "La ruta no corresponde a un archivo"
127
+ file_validation_error : "Error validando archivo"
128
+ user_not_authorized: "Usuario no esta autorizado para esta empresa"
129
+ account_not_verified: "Tu cuenta no ha sido verificada. Por favor, revisa tu correo."
130
+ missing_response_id: "No se encontró 'previous_response_id' para '{company_short_name}/{user_identifier}'. Reinicia el contexto."
131
+
132
+ api_responses:
133
+ context_reloaded_success: "El contexto se ha recargado con éxito."
134
+
135
+ services:
136
+ mail_sent: "mail enviado exitosamente."
137
+ start_query: "Hola, cual es tu pregunta?"
138
+
139
+ flash_messages:
140
+ password_changed_success: "Tu contraseña ha sido restablecida exitosamente. Ahora puedes iniciar sesión."
141
+ signup_success: "Registro exitoso. Por favor, revisa tu correo para verificar tu cuenta."
142
+ user_associated_success: "Usuario existente asociado exitosamente a la nueva empresa."
143
+ account_verified_success: "Tu cuenta ha sido verificada exitosamente. ¡Bienvenido!"
144
+ forgot_password_success: "Si tu correo está registrado, recibirás un enlace para restablecer tu contraseña."
145
+
146
+ # Claves específicas para JavaScript
147
+ js_messages:
148
+ feedback_sent_success_title: "Feedback Enviado"
149
+ feedback_sent_success_body: "¡Gracias por tu comentario!"
150
+ feedback_sent_error: "No se pudo enviar el feedback, por favor intente nuevamente."
151
+ feedback_rating_error: "Por favor, califica al asistente con las estrellas."
152
+ feedback_comment_error: "Por favor, escribe tu comentario antes de enviar."
153
+ context_reloaded: "El contexto ha sido recargado."
154
+ error_loading_history: "Ocurrió un error al cargar el historial."
155
+ request_aborted: "La generación de la respuesta ha sido detenida."
156
+ processing_error: "Ocurrió un error al procesar la solicitud."
157
+ server_comm_error: "Error de comunicación con el servidor ({status}). Por favor, intente de nuevo más tarde."
158
+ network_error: "Ocurrió un error de red. Por favor, inténtalo de nuevo en unos momentos."
159
+ unknown_server_error: "Error desconocido del servidor."
160
+ loading: "Cargando..."
161
+ reload_init: "Iniciando recarga de contexto en segundo plano..."
162
+ no_history_found: "No existe historial de consultas."
163
+
@@ -27,8 +27,8 @@ class DatabaseManager:
27
27
  self._engine = create_engine(
28
28
  database_url,
29
29
  echo=False,
30
- pool_size=2, # per worker
31
- max_overflow=3,
30
+ pool_size=10, # per worker
31
+ max_overflow=20,
32
32
  pool_timeout=30,
33
33
  pool_recycle=1800,
34
34
  pool_pre_ping=True,
@@ -77,7 +77,7 @@ class DatabaseManager:
77
77
  inspector = inspect(self._engine)
78
78
 
79
79
  if table_name not in inspector.get_table_names():
80
- raise RuntimeError(f"La tabla '{table_name}' no existe en la BD.")
80
+ raise RuntimeError(f"Table '{table_name}' does not exist.")
81
81
 
82
82
  if exclude_columns is None:
83
83
  exclude_columns = []
@@ -22,7 +22,7 @@ class DocumentRepo:
22
22
  def get(self, company_id, filename: str ) -> Document:
23
23
  if not company_id or not filename:
24
24
  raise IAToolkitException(IAToolkitException.ErrorType.PARAM_NOT_FILLED,
25
- 'Falta empresa o filename')
25
+ 'missing company_id or filename')
26
26
 
27
27
  return self.session.query(Document).filter_by(company_id=company_id, filename=filename).first()
28
28
 
@@ -53,13 +53,11 @@ class Company(Base):
53
53
  id = Column(Integer, primary_key=True)
54
54
  short_name = Column(String(20), nullable=False, unique=True, index=True)
55
55
  name = Column(String(256), nullable=False)
56
+ default_language = Column(String(5), nullable=False, default='es')
56
57
 
57
58
  # encrypted api-key
58
59
  openai_api_key = Column(String, nullable=True)
59
60
  gemini_api_key = Column(String, nullable=True)
60
-
61
- branding = Column(JSON, nullable=True)
62
- onboarding_cards = Column(JSON, nullable=True)
63
61
  parameters = Column(JSON, nullable=True)
64
62
  created_at = Column(DateTime, default=datetime.now)
65
63
  allow_jwt = Column(Boolean, default=True, nullable=True)
@@ -107,6 +105,7 @@ class User(Base):
107
105
  created_at = Column(DateTime, default=datetime.now)
108
106
  password = Column(String, nullable=False)
109
107
  verified = Column(Boolean, nullable=False, default=False)
108
+ preferred_language = Column(String(5), nullable=True)
110
109
  verification_url = Column(String, nullable=True)
111
110
  temp_code = Column(String, nullable=True)
112
111