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.
- iatoolkit/__init__.py +27 -35
- iatoolkit/base_company.py +3 -35
- iatoolkit/cli_commands.py +18 -47
- iatoolkit/common/__init__.py +0 -0
- iatoolkit/common/exceptions.py +48 -0
- iatoolkit/common/interfaces/__init__.py +0 -0
- iatoolkit/common/interfaces/asset_storage.py +34 -0
- iatoolkit/common/interfaces/database_provider.py +39 -0
- iatoolkit/common/model_registry.py +159 -0
- iatoolkit/common/routes.py +138 -0
- iatoolkit/common/session_manager.py +26 -0
- iatoolkit/common/util.py +353 -0
- iatoolkit/company_registry.py +66 -29
- iatoolkit/core.py +514 -0
- iatoolkit/infra/__init__.py +5 -0
- iatoolkit/infra/brevo_mail_app.py +123 -0
- iatoolkit/infra/call_service.py +140 -0
- iatoolkit/infra/connectors/__init__.py +5 -0
- iatoolkit/infra/connectors/file_connector.py +17 -0
- iatoolkit/infra/connectors/file_connector_factory.py +57 -0
- iatoolkit/infra/connectors/google_cloud_storage_connector.py +53 -0
- iatoolkit/infra/connectors/google_drive_connector.py +68 -0
- iatoolkit/infra/connectors/local_file_connector.py +46 -0
- iatoolkit/infra/connectors/s3_connector.py +33 -0
- iatoolkit/infra/google_chat_app.py +57 -0
- iatoolkit/infra/llm_providers/__init__.py +0 -0
- iatoolkit/infra/llm_providers/deepseek_adapter.py +278 -0
- iatoolkit/infra/llm_providers/gemini_adapter.py +350 -0
- iatoolkit/infra/llm_providers/openai_adapter.py +124 -0
- iatoolkit/infra/llm_proxy.py +268 -0
- iatoolkit/infra/llm_response.py +45 -0
- iatoolkit/infra/redis_session_manager.py +122 -0
- iatoolkit/locales/en.yaml +222 -0
- iatoolkit/locales/es.yaml +225 -0
- iatoolkit/repositories/__init__.py +5 -0
- iatoolkit/repositories/database_manager.py +187 -0
- iatoolkit/repositories/document_repo.py +33 -0
- iatoolkit/repositories/filesystem_asset_repository.py +36 -0
- iatoolkit/repositories/llm_query_repo.py +105 -0
- iatoolkit/repositories/models.py +279 -0
- iatoolkit/repositories/profile_repo.py +171 -0
- iatoolkit/repositories/vs_repo.py +150 -0
- iatoolkit/services/__init__.py +5 -0
- iatoolkit/services/auth_service.py +193 -0
- {services → iatoolkit/services}/benchmark_service.py +7 -7
- iatoolkit/services/branding_service.py +153 -0
- iatoolkit/services/company_context_service.py +214 -0
- iatoolkit/services/configuration_service.py +375 -0
- iatoolkit/services/dispatcher_service.py +134 -0
- {services → iatoolkit/services}/document_service.py +20 -8
- iatoolkit/services/embedding_service.py +148 -0
- iatoolkit/services/excel_service.py +156 -0
- {services → iatoolkit/services}/file_processor_service.py +36 -21
- iatoolkit/services/history_manager_service.py +208 -0
- iatoolkit/services/i18n_service.py +104 -0
- iatoolkit/services/jwt_service.py +80 -0
- iatoolkit/services/language_service.py +89 -0
- iatoolkit/services/license_service.py +82 -0
- iatoolkit/services/llm_client_service.py +438 -0
- iatoolkit/services/load_documents_service.py +174 -0
- iatoolkit/services/mail_service.py +213 -0
- {services → iatoolkit/services}/profile_service.py +200 -101
- iatoolkit/services/prompt_service.py +303 -0
- iatoolkit/services/query_service.py +467 -0
- iatoolkit/services/search_service.py +55 -0
- iatoolkit/services/sql_service.py +169 -0
- iatoolkit/services/tool_service.py +246 -0
- iatoolkit/services/user_feedback_service.py +117 -0
- iatoolkit/services/user_session_context_service.py +213 -0
- iatoolkit/static/images/fernando.jpeg +0 -0
- iatoolkit/static/images/iatoolkit_core.png +0 -0
- iatoolkit/static/images/iatoolkit_logo.png +0 -0
- iatoolkit/static/js/chat_feedback_button.js +80 -0
- iatoolkit/static/js/chat_filepond.js +85 -0
- iatoolkit/static/js/chat_help_content.js +124 -0
- iatoolkit/static/js/chat_history_button.js +110 -0
- iatoolkit/static/js/chat_logout_button.js +36 -0
- iatoolkit/static/js/chat_main.js +401 -0
- iatoolkit/static/js/chat_model_selector.js +227 -0
- iatoolkit/static/js/chat_onboarding_button.js +103 -0
- iatoolkit/static/js/chat_prompt_manager.js +94 -0
- iatoolkit/static/js/chat_reload_button.js +38 -0
- iatoolkit/static/styles/chat_iatoolkit.css +559 -0
- iatoolkit/static/styles/chat_modal.css +133 -0
- iatoolkit/static/styles/chat_public.css +135 -0
- iatoolkit/static/styles/documents.css +598 -0
- iatoolkit/static/styles/landing_page.css +398 -0
- iatoolkit/static/styles/llm_output.css +148 -0
- iatoolkit/static/styles/onboarding.css +176 -0
- iatoolkit/system_prompts/__init__.py +0 -0
- iatoolkit/system_prompts/query_main.prompt +30 -23
- iatoolkit/system_prompts/sql_rules.prompt +47 -12
- iatoolkit/templates/_company_header.html +45 -0
- iatoolkit/templates/_login_widget.html +42 -0
- iatoolkit/templates/base.html +78 -0
- iatoolkit/templates/change_password.html +66 -0
- iatoolkit/templates/chat.html +337 -0
- iatoolkit/templates/chat_modals.html +185 -0
- iatoolkit/templates/error.html +51 -0
- iatoolkit/templates/forgot_password.html +51 -0
- iatoolkit/templates/onboarding_shell.html +106 -0
- iatoolkit/templates/signup.html +79 -0
- iatoolkit/views/__init__.py +5 -0
- iatoolkit/views/base_login_view.py +96 -0
- iatoolkit/views/change_password_view.py +116 -0
- iatoolkit/views/chat_view.py +76 -0
- iatoolkit/views/embedding_api_view.py +65 -0
- iatoolkit/views/forgot_password_view.py +75 -0
- iatoolkit/views/help_content_api_view.py +54 -0
- iatoolkit/views/history_api_view.py +56 -0
- iatoolkit/views/home_view.py +63 -0
- iatoolkit/views/init_context_api_view.py +74 -0
- iatoolkit/views/llmquery_api_view.py +59 -0
- iatoolkit/views/load_company_configuration_api_view.py +49 -0
- iatoolkit/views/load_document_api_view.py +65 -0
- iatoolkit/views/login_view.py +170 -0
- iatoolkit/views/logout_api_view.py +57 -0
- iatoolkit/views/profile_api_view.py +46 -0
- iatoolkit/views/prompt_api_view.py +37 -0
- iatoolkit/views/root_redirect_view.py +22 -0
- iatoolkit/views/signup_view.py +100 -0
- iatoolkit/views/static_page_view.py +27 -0
- iatoolkit/views/user_feedback_api_view.py +60 -0
- iatoolkit/views/users_api_view.py +33 -0
- iatoolkit/views/verify_user_view.py +60 -0
- iatoolkit-0.107.4.dist-info/METADATA +268 -0
- iatoolkit-0.107.4.dist-info/RECORD +132 -0
- iatoolkit-0.107.4.dist-info/licenses/LICENSE +21 -0
- iatoolkit-0.107.4.dist-info/licenses/LICENSE_COMMUNITY.md +15 -0
- {iatoolkit-0.3.9.dist-info → iatoolkit-0.107.4.dist-info}/top_level.txt +0 -1
- iatoolkit/iatoolkit.py +0 -413
- iatoolkit/system_prompts/arquitectura.prompt +0 -32
- iatoolkit-0.3.9.dist-info/METADATA +0 -252
- iatoolkit-0.3.9.dist-info/RECORD +0 -32
- services/__init__.py +0 -5
- services/api_service.py +0 -75
- services/dispatcher_service.py +0 -351
- services/excel_service.py +0 -98
- services/history_service.py +0 -45
- services/jwt_service.py +0 -91
- services/load_documents_service.py +0 -212
- services/mail_service.py +0 -62
- services/prompt_manager_service.py +0 -172
- services/query_service.py +0 -334
- services/search_service.py +0 -32
- services/sql_service.py +0 -42
- services/tasks_service.py +0 -188
- services/user_feedback_service.py +0 -67
- services/user_session_context_service.py +0 -85
- {iatoolkit-0.3.9.dist-info → iatoolkit-0.107.4.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
iatoolkit/__init__.py,sha256=UO35ruCix0u5uW9wSZkkosePXNUTKHV27ldYWHCWwH0,1405
|
|
2
|
+
iatoolkit/base_company.py,sha256=TzGvdseDpJMi9fl5nbR2pMARgU6pN6ISatFoMJKtNxw,648
|
|
3
|
+
iatoolkit/cli_commands.py,sha256=njGFonAHvQ3xatyUPKEdrUMfXQHp3UcBDN6zJUu0eJA,1757
|
|
4
|
+
iatoolkit/company_registry.py,sha256=XopFzqIpUxBtQJzdZwu2-c0v98MLT7SP_xLPxn_iENM,4176
|
|
5
|
+
iatoolkit/core.py,sha256=bi7hy8SDFHACJgyKtPsDFS6a69TalcJZW1oubN8L_8w,20735
|
|
6
|
+
iatoolkit/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
iatoolkit/common/exceptions.py,sha256=xmNi5Et13pCvCM1so79z36I-7Kdie8nVUAqW9acGs9k,1202
|
|
8
|
+
iatoolkit/common/model_registry.py,sha256=HiFr1FtRKGjpp3YurkiF4l6sGuirigDVL-b_3_R-vlM,5561
|
|
9
|
+
iatoolkit/common/routes.py,sha256=0vUXGfoRY86h7kM3ioNyHr2gcCubOjZ57GPAkr6Sk9c,6202
|
|
10
|
+
iatoolkit/common/session_manager.py,sha256=OUYMzT8hN1U-NCUidR5tUAXB1drd8nYTOpo60rUNYeY,532
|
|
11
|
+
iatoolkit/common/util.py,sha256=e000sUjUXeY4BJrJ3HtnsVMMhn8guclRZkl0f2Dmfy0,15270
|
|
12
|
+
iatoolkit/common/interfaces/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
+
iatoolkit/common/interfaces/asset_storage.py,sha256=IYXyc73gmwFT7T8RQhC4MymQDW0vGDSEzuKk43w7Ct4,989
|
|
14
|
+
iatoolkit/common/interfaces/database_provider.py,sha256=RE8oxSCEEQR5J5grZTq47by0-fCiXCJDHD1v9kqpTKo,1118
|
|
15
|
+
iatoolkit/infra/__init__.py,sha256=5JqK9sZ6jBuK83zDQokUhxQ0wuJJJ9DXB8pYCLkX7X4,102
|
|
16
|
+
iatoolkit/infra/brevo_mail_app.py,sha256=xvy3KxEEgjFpHlIAogP6SU5KXmg3w7lC16nnNmOYU8Y,5323
|
|
17
|
+
iatoolkit/infra/call_service.py,sha256=iRk9VxbXaAwlLIl8fUzGDWIAdzwfsbs1MtP84YeENxg,4929
|
|
18
|
+
iatoolkit/infra/google_chat_app.py,sha256=_uKWxeacHH6C5a4FVx0YZjBn1tL-x_MIQV9gqgWGAjo,1937
|
|
19
|
+
iatoolkit/infra/llm_proxy.py,sha256=6PngfQ4Q-5tLiqdroNCn58kBJh5uZZb_6S98HKH4pQY,10639
|
|
20
|
+
iatoolkit/infra/llm_response.py,sha256=6hSmI909m0Pdgs7UnJHrv_nokbCZLzHpdwBUED6VNck,1062
|
|
21
|
+
iatoolkit/infra/redis_session_manager.py,sha256=EPr3E_g7LHxn6U4SV5lT_L8WQsAwg8VzA_WIEZ3TwOw,3667
|
|
22
|
+
iatoolkit/infra/connectors/__init__.py,sha256=5JqK9sZ6jBuK83zDQokUhxQ0wuJJJ9DXB8pYCLkX7X4,102
|
|
23
|
+
iatoolkit/infra/connectors/file_connector.py,sha256=HOjRTFd-WfDOcFyvHncAhnGNZuFgChIwC-P6osPo9ZM,352
|
|
24
|
+
iatoolkit/infra/connectors/file_connector_factory.py,sha256=3qvyfH4ZHKuiMxJFkawOxhW2-TGKKtsBYHgoPpZMuKU,2118
|
|
25
|
+
iatoolkit/infra/connectors/google_cloud_storage_connector.py,sha256=IXpL3HTo7Ft4EQsYiQq5wXRRQK854jzOEB7ZdWjLa4U,2050
|
|
26
|
+
iatoolkit/infra/connectors/google_drive_connector.py,sha256=WR1AlO5-Bl3W89opdja0kKgHTJzVOjTsy3H4SlIvwVg,2537
|
|
27
|
+
iatoolkit/infra/connectors/local_file_connector.py,sha256=hrzIgpMJOTuwTqzlQeTIU_50ZbZ6yl8lcWPv6hMnoqI,1739
|
|
28
|
+
iatoolkit/infra/connectors/s3_connector.py,sha256=Nj4_YaLobjfcnbZewJf21_K2EXohgcc3mJll1Pzn4zg,1123
|
|
29
|
+
iatoolkit/infra/llm_providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
+
iatoolkit/infra/llm_providers/deepseek_adapter.py,sha256=ui4V05xplUvLWHu7y_dUMKpP4Af-BkZi5tvdgZY16dU,10719
|
|
31
|
+
iatoolkit/infra/llm_providers/gemini_adapter.py,sha256=xjYAMgS4bh7qfpCEv6n92tzpKdjnNBVFfr8GkSrcatM,14555
|
|
32
|
+
iatoolkit/infra/llm_providers/openai_adapter.py,sha256=9SuHYtPJcadWSV_GHfx8DDj9BqkUS3RvLSyDd_ZVB2M,4848
|
|
33
|
+
iatoolkit/locales/en.yaml,sha256=worFpCj55B1AFX5gc_PxY6Fl09prWx2JtX-Sfk-dVec,9564
|
|
34
|
+
iatoolkit/locales/es.yaml,sha256=BDXo4Sp-Pe43cF9bJxx0Dd3VZUmCUtPe2zn4QsZVDnY,10174
|
|
35
|
+
iatoolkit/repositories/__init__.py,sha256=5JqK9sZ6jBuK83zDQokUhxQ0wuJJJ9DXB8pYCLkX7X4,102
|
|
36
|
+
iatoolkit/repositories/database_manager.py,sha256=zlpkbK9-Ydy8pZTPY4la1s4nCbCeGZ6gthghSOTvGLY,6620
|
|
37
|
+
iatoolkit/repositories/document_repo.py,sha256=vhFc0hu9GK6yoKJHs2dLaAoQ9ZJaf9GEOsD2yWuVuNw,1130
|
|
38
|
+
iatoolkit/repositories/filesystem_asset_repository.py,sha256=ZFr_FpHQD5nszZnJSki6nc-W3PKvmhTxKmVZMd2DUbM,1825
|
|
39
|
+
iatoolkit/repositories/llm_query_repo.py,sha256=8rGSVx7WZlGbUfeVw_uGygTUuJXRK5vGfFHj1znc1ss,3981
|
|
40
|
+
iatoolkit/repositories/models.py,sha256=Bu9eW3ev434smfGTus9bXTfrPn3-KPTUptk8stt7rD4,11639
|
|
41
|
+
iatoolkit/repositories/profile_repo.py,sha256=fl-1Ovu_M2D6-_CAHsaqDwyvVBVo-U3v3gZbkUx2f4U,5911
|
|
42
|
+
iatoolkit/repositories/vs_repo.py,sha256=jVyzcK4l7T4n7O0KVLDIfOiZkPEA-rV1OtgYCD2M_G4,6110
|
|
43
|
+
iatoolkit/services/__init__.py,sha256=5JqK9sZ6jBuK83zDQokUhxQ0wuJJJ9DXB8pYCLkX7X4,102
|
|
44
|
+
iatoolkit/services/auth_service.py,sha256=B0gTUHDf56WiTnA5viBEvbmf2A6y_6bkAoFlMvu0IWY,7756
|
|
45
|
+
iatoolkit/services/benchmark_service.py,sha256=CdbFYyS3FHFhNzWQEa9ZNjUlmON10DT1nKNbZQ1EUi8,5880
|
|
46
|
+
iatoolkit/services/branding_service.py,sha256=Fsjcos7hGLx2qhoZ9hTaFCgb7x5eYHMDGvXg4mXx8D0,8120
|
|
47
|
+
iatoolkit/services/company_context_service.py,sha256=aIUvi-h8etUaEJ1hDYWuGQ2rdbq7cGVkPOLfj4yYi3U,9389
|
|
48
|
+
iatoolkit/services/configuration_service.py,sha256=8YpItddV4u-sSQr2zwUay4gBukNqZDe2OVOjAphwq4Q,17048
|
|
49
|
+
iatoolkit/services/dispatcher_service.py,sha256=f3aPbKU9UkNS61dNVZjT-J9hg3x-H2Nb_n-cZRnZ9aI,5247
|
|
50
|
+
iatoolkit/services/document_service.py,sha256=XrAwbNPyhmP94bGdDwHy76Mg_PCg6O2QyZwii1T6kZ8,6469
|
|
51
|
+
iatoolkit/services/embedding_service.py,sha256=ngRnFXEpko-rqpicqbJbVdr91IjSe1jXSYVWprOVlE0,6296
|
|
52
|
+
iatoolkit/services/excel_service.py,sha256=de4fj3klWFWSTdgej8yk0FBuNr1lunyy9cuOyZwl0rI,6221
|
|
53
|
+
iatoolkit/services/file_processor_service.py,sha256=h8Tg2Xwvjv_HOIUo51Rnu5H4tUmkJ8W9tKvmFfgKPms,3792
|
|
54
|
+
iatoolkit/services/history_manager_service.py,sha256=nq1hk39WDbyHG6s8irpIdCS98EBDagF0djH6JHq9WuY,8734
|
|
55
|
+
iatoolkit/services/i18n_service.py,sha256=mR4pS0z56NgZLeSnEvDXiMvVBeOCl5CkUWdYBTVEhyM,3941
|
|
56
|
+
iatoolkit/services/jwt_service.py,sha256=pVoH1rzRwWixpvT3AhFdiE1BDmdbo4KQMyOF0P7tz-Y,2939
|
|
57
|
+
iatoolkit/services/language_service.py,sha256=ktNzj0hrCPm_VMIpWTxFEpEHKQ1lOHOfuhzCbZud2Dc,3428
|
|
58
|
+
iatoolkit/services/license_service.py,sha256=pdl9szSEPbIu2ISl6g-WIR1p4HQu2gSGdAjViKxY6Hg,2751
|
|
59
|
+
iatoolkit/services/llm_client_service.py,sha256=YSvoNKeBQRGL3znMDIyLH2PGZt4ImmYKD_aBlBeS91k,19024
|
|
60
|
+
iatoolkit/services/load_documents_service.py,sha256=04XZmn6AWOK0wiRU7QDu2VYRekOK7fD19H-mC4FiMjA,7908
|
|
61
|
+
iatoolkit/services/mail_service.py,sha256=6Kx1CIbXzAr_ucoqwqTlhhwE6y2Jw64eNDjXysaZP-c,8297
|
|
62
|
+
iatoolkit/services/profile_service.py,sha256=eVNqMjHS7BHIbzyLmx73GitWqaU-y6ntdhN_8iNbIN0,23533
|
|
63
|
+
iatoolkit/services/prompt_service.py,sha256=mr3szmOThNi6MtqCbh4rwJJOlk-Be35bkIJXqh7_hvM,12898
|
|
64
|
+
iatoolkit/services/query_service.py,sha256=aS2-NtEMdu-QViw58d-g9iZI1j3KZIJb0xrN8N_c__U,20406
|
|
65
|
+
iatoolkit/services/search_service.py,sha256=Omx7tXit5V9o_HdIEFs24Hmaz382CxuphfFzvige4Uo,2188
|
|
66
|
+
iatoolkit/services/sql_service.py,sha256=1ippvYqq9ERWS65cDricBjgviu1TOSAVX1CVKg_Tjgs,6820
|
|
67
|
+
iatoolkit/services/tool_service.py,sha256=FQuplPsgs1AdyOk2pxUBkPIvAvUqJU1ElOpOWz5wkr8,10002
|
|
68
|
+
iatoolkit/services/user_feedback_service.py,sha256=KbjMjl0CDF7WpPHioJ3sqQVwocjfq_cisrpeqYUqtas,5361
|
|
69
|
+
iatoolkit/services/user_session_context_service.py,sha256=RSv_NxOSTVPA6nFLiZKSIuUWa59cmZWBwiN_TWSljBo,9074
|
|
70
|
+
iatoolkit/static/images/fernando.jpeg,sha256=W68TYMuo5hZVpbP-evwH6Nu4xWFv2bc8pJzSKDoLTeQ,100612
|
|
71
|
+
iatoolkit/static/images/iatoolkit_core.png,sha256=EsmhI8ucevGtzWUPtRDUBfoU-1jqXK7ZmQtrZ-cbJO8,42358
|
|
72
|
+
iatoolkit/static/images/iatoolkit_logo.png,sha256=cGSO-06Y8hCwxsnEGbUBjqFmlSA4pm-OOnNypOEAZVs,7563
|
|
73
|
+
iatoolkit/static/js/chat_feedback_button.js,sha256=P0ANiY5tbaEegi7fYg5Y4xFFWd3Ldf86rDu3zwwZd3A,2425
|
|
74
|
+
iatoolkit/static/js/chat_filepond.js,sha256=mzXafm7a506EpM37KATTK3zvAswO1E0KSUY1vKbwuRc,3163
|
|
75
|
+
iatoolkit/static/js/chat_help_content.js,sha256=VwJ4esnrQ2xCP09IhObJyg-sRIJYMGGiAIRF8fX_lE0,5201
|
|
76
|
+
iatoolkit/static/js/chat_history_button.js,sha256=i9EBAWWW2XyQnAuj1b-c8102EG_gDkQ2ElbA8_Nu0yo,3491
|
|
77
|
+
iatoolkit/static/js/chat_logout_button.js,sha256=Of9H6IbAboSBmeqRaurEVW6_dL752L0UeDcDLNBD5Z0,1335
|
|
78
|
+
iatoolkit/static/js/chat_main.js,sha256=9qlBiiR1Xf1iW0kn6W4gkKtk_9mr4ZT5Ib8-Y0GkXr4,14964
|
|
79
|
+
iatoolkit/static/js/chat_model_selector.js,sha256=EJC3GAZK0AXZaYdyYL4oA0NbxAVwK-bV2EyFbtU01RA,7175
|
|
80
|
+
iatoolkit/static/js/chat_onboarding_button.js,sha256=o1lovwq38bENAzSnCi8c0bUgEszq_C49NdzeaAwXthU,3359
|
|
81
|
+
iatoolkit/static/js/chat_prompt_manager.js,sha256=QYki28CpyM2Chn82dnOP2eH6FObxH8eChGFyUxukv1M,3319
|
|
82
|
+
iatoolkit/static/js/chat_reload_button.js,sha256=MFZgtBCZdNpWnx-L1V1M_dUFx0p8lWs_G0LdXFol3gY,1361
|
|
83
|
+
iatoolkit/static/styles/chat_iatoolkit.css,sha256=cGD9riX-4s978XJJKPcyO6qHq1ngKMzNEhsRpimySVs,15926
|
|
84
|
+
iatoolkit/static/styles/chat_modal.css,sha256=9rwWrzL4Vq7AsdiGb3qczyOUf2PJEgLjSLCkSns8dQA,3031
|
|
85
|
+
iatoolkit/static/styles/chat_public.css,sha256=2SDz0gGyTnTn3BUwD--QX-0qEc3eYKXeTTC6h730UCU,4486
|
|
86
|
+
iatoolkit/static/styles/documents.css,sha256=6Yoprc9JHlKdtqUBEGr4r-JCQsK3Bg1ivoxfJyGuKvg,11893
|
|
87
|
+
iatoolkit/static/styles/landing_page.css,sha256=HVYbo9ZqbqsImvMhGBq2dDFkRiRWOtVaZ0IP9QqDquA,8914
|
|
88
|
+
iatoolkit/static/styles/llm_output.css,sha256=EQjfETdViLjIsyUYp3NvlR1fGICUCK531OsRx43dYvk,3131
|
|
89
|
+
iatoolkit/static/styles/onboarding.css,sha256=fNiqT_MMJ6gGhNzfbSZhJwvcCZ_8gibL-MWZwxyAgAs,3749
|
|
90
|
+
iatoolkit/system_prompts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
91
|
+
iatoolkit/system_prompts/format_styles.prompt,sha256=MSMe1qvR3cF_0IbFshn8R0z6Wx6VCHQq1p37rpu5wwk,3576
|
|
92
|
+
iatoolkit/system_prompts/query_main.prompt,sha256=ZiuiRQRkfZn7Su8SilV57LwCdsIyRASrKxdAWi5h27w,2991
|
|
93
|
+
iatoolkit/system_prompts/sql_rules.prompt,sha256=U1Z5BObI-fgkMatcYfx89q2-YmuRNK6OV6q69p-wAFI,60585
|
|
94
|
+
iatoolkit/templates/_company_header.html,sha256=L1QtrMpqYXALqtinCa3WhG4CrgHKLObl_d-jfQYNjhg,1903
|
|
95
|
+
iatoolkit/templates/_login_widget.html,sha256=qziV70-n7SwC11rL4cU1LenJM83jYvuyw2xSz6OORJA,2063
|
|
96
|
+
iatoolkit/templates/base.html,sha256=sRHUnHaKIycLRKZ_PQOTb88kSBC6kigzxlm60vpXj1I,3434
|
|
97
|
+
iatoolkit/templates/change_password.html,sha256=p0GWZ9gldluYQM8OPSz2Q4CYhU8UJmb-72iz_Sl_6Ho,3485
|
|
98
|
+
iatoolkit/templates/chat.html,sha256=KQBc3CDb7aNKrZX-J3yBaefkik3xZ4PVRfhZLHdj2nM,15632
|
|
99
|
+
iatoolkit/templates/chat_modals.html,sha256=x0Do7I7X9cfgZFHSAwWreIN55nYPCpZK7PTBxGXjrYY,8501
|
|
100
|
+
iatoolkit/templates/error.html,sha256=4aT6cIYQUILciekAceHEiUuZxcAqkmNPUMnB9CD4BNA,1778
|
|
101
|
+
iatoolkit/templates/forgot_password.html,sha256=XLVMmLJK5SAXmPqIH_OyTlSbu5QTAdekO6ggzfcNup0,2376
|
|
102
|
+
iatoolkit/templates/onboarding_shell.html,sha256=GODHz4JrNyZyf9sPq7GNKMoRrLmKn6kZZQBU4HLgyiU,4604
|
|
103
|
+
iatoolkit/templates/signup.html,sha256=kvV9B8M99zMDj4y9up-K5ChzOznSxzZTX4jPShGRBvI,4316
|
|
104
|
+
iatoolkit/views/__init__.py,sha256=5JqK9sZ6jBuK83zDQokUhxQ0wuJJJ9DXB8pYCLkX7X4,102
|
|
105
|
+
iatoolkit/views/base_login_view.py,sha256=l45msQUrLGxxxZrSb5l7tnTLLQyIoPTu4TgbkHBvVlc,3981
|
|
106
|
+
iatoolkit/views/change_password_view.py,sha256=TXFvvtNrR37yrNAHYzcMSSIkV4-MIzmIpwbPffaJJyE,4957
|
|
107
|
+
iatoolkit/views/chat_view.py,sha256=QNlC0n1hxjWbI3wyLhV6D-U2kJZkIqClNg94iQP4PrA,3534
|
|
108
|
+
iatoolkit/views/embedding_api_view.py,sha256=9n5utihq8zHiG0V2sVCOYQ72wOKa4denqE951gqaJWo,2371
|
|
109
|
+
iatoolkit/views/forgot_password_view.py,sha256=C4eJe9GmGrl6M3bTt_anwuPQib9ouXZtKYp6kB2xBeU,3380
|
|
110
|
+
iatoolkit/views/help_content_api_view.py,sha256=8EUw2iSE6X-Lm2dGlYZxSp-29HzaAGwD3CpL4Otqp5k,2011
|
|
111
|
+
iatoolkit/views/history_api_view.py,sha256=oNYfo-fZbz4sY6VpE_goaCFQyH2k9IX85VhPotqQtGc,2015
|
|
112
|
+
iatoolkit/views/home_view.py,sha256=GaU2-qyTnE8jE1ejdNjHW3azo72X_Awhp1y1Zx9BXRg,2662
|
|
113
|
+
iatoolkit/views/init_context_api_view.py,sha256=axfNno8E1v4dCNuXNkdV1XpDZtypICj48hW3cRyl_eA,2961
|
|
114
|
+
iatoolkit/views/llmquery_api_view.py,sha256=ohlYmFcvhvZL2BTMeCzd7ZPeTBzIPcIZbC9CRWqQM70,2290
|
|
115
|
+
iatoolkit/views/load_company_configuration_api_view.py,sha256=ufX_jrSO7NTUsgNJNrAXxFKmyp2JyNYoplMUm4biULs,1902
|
|
116
|
+
iatoolkit/views/load_document_api_view.py,sha256=RFkVrzOy6eG_aoQYdxb3EpInTnomZpyDaHRW3_n4dro,2310
|
|
117
|
+
iatoolkit/views/login_view.py,sha256=NKPjR9cCOsw7FhOfXCM32m6veKxRdLhsc0H7DLc5_ug,7517
|
|
118
|
+
iatoolkit/views/logout_api_view.py,sha256=7c0rL5sLTuoRPqQs73wlH_7eb3--S6GLcr7Yu4hNOYU,2035
|
|
119
|
+
iatoolkit/views/profile_api_view.py,sha256=qhlmhyygIs5h-OyNDwq1uGUS8S-GxB2zOYY51Hs5prY,1645
|
|
120
|
+
iatoolkit/views/prompt_api_view.py,sha256=WAv4I6WmGfT1TTZ-lml9LaR2wDsSx9mshYcxFAV_wtk,1255
|
|
121
|
+
iatoolkit/views/root_redirect_view.py,sha256=t7tqiyJAPffzIuQVwnfgIw3Bo51qkegyMmBTfChsrJk,833
|
|
122
|
+
iatoolkit/views/signup_view.py,sha256=83jgbAuOAETID88TC8h-wCszkkEaFygCH6tTj7XyZYI,4261
|
|
123
|
+
iatoolkit/views/static_page_view.py,sha256=V0oTybQ5lFo3hp5xOKau-yMO8vK8NCM6zWiwVI8lpBQ,881
|
|
124
|
+
iatoolkit/views/user_feedback_api_view.py,sha256=QOTBtpNqYAmewXDgVAoaIprnVjvf1xM0ExWxSFp3ICI,2098
|
|
125
|
+
iatoolkit/views/users_api_view.py,sha256=hVR6rxLNyhGiXhCIHvttUeSinH071Pyk-2_Fcm-v2TM,1139
|
|
126
|
+
iatoolkit/views/verify_user_view.py,sha256=Uc9P2wiRjZ7pMRTjWUn8Y-p0DFqw_AwNYQsdbAwhbg8,2659
|
|
127
|
+
iatoolkit-0.107.4.dist-info/licenses/LICENSE,sha256=5tOLQdjoCvSXEx_7Lr4bSab3ha4NSwzamvua0fwCXi8,1075
|
|
128
|
+
iatoolkit-0.107.4.dist-info/licenses/LICENSE_COMMUNITY.md,sha256=9lVNcggPNUnleMF3_h3zu9PbNTeaRqB1tHAbiBLQJZU,566
|
|
129
|
+
iatoolkit-0.107.4.dist-info/METADATA,sha256=u4IiTx7cWD7L5ob8PLqJz-Gqd-IrjfvnqbBDCvSj5oc,8397
|
|
130
|
+
iatoolkit-0.107.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
131
|
+
iatoolkit-0.107.4.dist-info/top_level.txt,sha256=V_w4QvDx0b1RXiy8zTCrD1Bp7AZkFe3_O0-9fMiwogg,10
|
|
132
|
+
iatoolkit-0.107.4.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Fernando Libedinsky
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# IAToolkit Community Edition License
|
|
2
|
+
|
|
3
|
+
The IAToolkit Community Edition is licensed under the MIT License.
|
|
4
|
+
|
|
5
|
+
This edition includes the full open-source IAToolkit Core, with the following usage scope:
|
|
6
|
+
|
|
7
|
+
- Support for **one (1) Company**
|
|
8
|
+
- Unlimited Tools within that Company
|
|
9
|
+
- SQL integration
|
|
10
|
+
- Basic RAG (standard retrieval & embeddings)
|
|
11
|
+
- All Components of the open-source Intelligence Layer and Interfaces
|
|
12
|
+
|
|
13
|
+
No additional technical limits apply beyond the single-Company constraint.
|
|
14
|
+
|
|
15
|
+
This edition is designed for learning, prototyping, and single-business deployments.
|
iatoolkit/iatoolkit.py
DELETED
|
@@ -1,413 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2024 Fernando Libedinsky
|
|
2
|
-
# Producto: IAToolkit Core
|
|
3
|
-
# Framework opensource para chatbots empresariales con IA
|
|
4
|
-
|
|
5
|
-
from flask import Flask, url_for, current_app
|
|
6
|
-
from flask_session import Session
|
|
7
|
-
from flask_injector import FlaskInjector
|
|
8
|
-
from flask_bcrypt import Bcrypt
|
|
9
|
-
from flask_cors import CORS
|
|
10
|
-
from common.auth import IAuthentication
|
|
11
|
-
from common.util import Utility
|
|
12
|
-
from common.exceptions import IAToolkitException
|
|
13
|
-
from common.session_manager import SessionManager
|
|
14
|
-
from urllib.parse import urlparse
|
|
15
|
-
import redis
|
|
16
|
-
import logging
|
|
17
|
-
import os
|
|
18
|
-
from typing import Optional, Dict, Any
|
|
19
|
-
from repositories.database_manager import DatabaseManager
|
|
20
|
-
from injector import Binder, singleton, Injector
|
|
21
|
-
from importlib.metadata import version as _pkg_version, PackageNotFoundError
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
# global variable for the unique instance of IAToolkit
|
|
25
|
-
_iatoolkit_instance: Optional['IAToolkit'] = None
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class IAToolkit:
|
|
29
|
-
"""
|
|
30
|
-
IAToolkit main class
|
|
31
|
-
"""
|
|
32
|
-
def __new__(cls, config: Optional[Dict[str, Any]] = None):
|
|
33
|
-
"""
|
|
34
|
-
Implementa el patrón Singleton
|
|
35
|
-
"""
|
|
36
|
-
global _iatoolkit_instance
|
|
37
|
-
if _iatoolkit_instance is None:
|
|
38
|
-
_iatoolkit_instance = super().__new__(cls)
|
|
39
|
-
_iatoolkit_instance._initialized = False
|
|
40
|
-
return _iatoolkit_instance
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def __init__(self, config: Optional[Dict[str, Any]] = None):
|
|
44
|
-
"""
|
|
45
|
-
Args:
|
|
46
|
-
config: Diccionario opcional de configuración que sobrescribe variables de entorno
|
|
47
|
-
"""
|
|
48
|
-
if self._initialized:
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
self.config = config or {}
|
|
52
|
-
self.app = None
|
|
53
|
-
self.db_manager = None
|
|
54
|
-
self._injector = None
|
|
55
|
-
self.version = "0.0.0+dev"
|
|
56
|
-
|
|
57
|
-
@classmethod
|
|
58
|
-
def get_instance(cls) -> 'IAToolkit':
|
|
59
|
-
"""
|
|
60
|
-
Obtiene la instancia única de IAToolkit
|
|
61
|
-
"""
|
|
62
|
-
global _iatoolkit_instance
|
|
63
|
-
if _iatoolkit_instance is None:
|
|
64
|
-
_iatoolkit_instance = cls()
|
|
65
|
-
return _iatoolkit_instance
|
|
66
|
-
|
|
67
|
-
def create_iatoolkit(self):
|
|
68
|
-
"""
|
|
69
|
-
Creates, configures, and returns the Flask application instance.
|
|
70
|
-
this is the main entry point for the application factory.
|
|
71
|
-
"""
|
|
72
|
-
if self._initialized and self.app:
|
|
73
|
-
return self.app
|
|
74
|
-
|
|
75
|
-
self._setup_logging()
|
|
76
|
-
|
|
77
|
-
# Step 1: Create the Flask app instance
|
|
78
|
-
self._create_flask_instance()
|
|
79
|
-
|
|
80
|
-
# Step 2: Set up the core components that DI depends on
|
|
81
|
-
self._setup_database()
|
|
82
|
-
|
|
83
|
-
# Step 3: Create the Injector and configure all dependencies in one place
|
|
84
|
-
self._injector = Injector(self._configure_core_dependencies)
|
|
85
|
-
|
|
86
|
-
# Step 4: Register routes using the fully configured injector
|
|
87
|
-
self._register_routes()
|
|
88
|
-
|
|
89
|
-
# Step 5: Initialize FlaskInjector. This is now primarily for request-scoped injections
|
|
90
|
-
# and other integrations, as views are handled manually.
|
|
91
|
-
FlaskInjector(app=self.app, injector=self._injector)
|
|
92
|
-
|
|
93
|
-
# Step 6: Finalize setup within the application context
|
|
94
|
-
self._setup_redis_sessions()
|
|
95
|
-
self._setup_cors()
|
|
96
|
-
self._setup_additional_services()
|
|
97
|
-
self._setup_cli_commands()
|
|
98
|
-
self._setup_context_processors()
|
|
99
|
-
|
|
100
|
-
try:
|
|
101
|
-
self.version = _pkg_version("iatoolkit")
|
|
102
|
-
except PackageNotFoundError:
|
|
103
|
-
pass
|
|
104
|
-
|
|
105
|
-
logging.info(f"🎉 IAToolkit v{self.version} inicializado correctamente")
|
|
106
|
-
self._initialized = True
|
|
107
|
-
return self.app
|
|
108
|
-
|
|
109
|
-
def _get_config_value(self, key: str, default=None):
|
|
110
|
-
"""Obtiene un valor de configuración, primero del dict config, luego de env vars"""
|
|
111
|
-
return self.config.get(key, os.getenv(key, default))
|
|
112
|
-
|
|
113
|
-
def _setup_logging(self):
|
|
114
|
-
log_level_str = self._get_config_value('FLASK_ENV', 'production')
|
|
115
|
-
log_level = logging.INFO if log_level_str in ('dev', 'development') else logging.WARNING
|
|
116
|
-
|
|
117
|
-
logging.basicConfig(
|
|
118
|
-
level=log_level,
|
|
119
|
-
format="%(asctime)s - IATOOLKIT - %(name)s - %(levelname)s - %(message)s",
|
|
120
|
-
handlers=[logging.StreamHandler()],
|
|
121
|
-
force=True
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
def _register_routes(self):
|
|
125
|
-
"""Registers routes by passing the configured injector."""
|
|
126
|
-
from common.routes import register_views
|
|
127
|
-
|
|
128
|
-
# Pass the injector to the view registration function
|
|
129
|
-
register_views(self._injector, self.app)
|
|
130
|
-
|
|
131
|
-
logging.info("✅ Routes registered.")
|
|
132
|
-
|
|
133
|
-
def _create_flask_instance(self):
|
|
134
|
-
static_folder = self._get_config_value('STATIC_FOLDER') or self._get_default_static_folder()
|
|
135
|
-
template_folder = self._get_config_value('TEMPLATE_FOLDER') or self._get_default_template_folder()
|
|
136
|
-
|
|
137
|
-
self.app = Flask(__name__,
|
|
138
|
-
static_folder=static_folder,
|
|
139
|
-
template_folder=template_folder)
|
|
140
|
-
|
|
141
|
-
is_https = self._get_config_value('USE_HTTPS', 'false').lower() == 'true'
|
|
142
|
-
is_dev = self._get_config_value('FLASK_ENV') == 'development'
|
|
143
|
-
|
|
144
|
-
self.app.config.update({
|
|
145
|
-
'VERSION': self.version,
|
|
146
|
-
'SECRET_KEY': self._get_config_value('FLASK_SECRET_KEY', 'iatoolkit-default-secret'),
|
|
147
|
-
'SESSION_COOKIE_SAMESITE': "None" if is_https else "Lax",
|
|
148
|
-
'SESSION_COOKIE_SECURE': is_https,
|
|
149
|
-
'SESSION_PERMANENT': False,
|
|
150
|
-
'SESSION_USE_SIGNER': True,
|
|
151
|
-
'JWT_SECRET_KEY': self._get_config_value('JWT_SECRET_KEY', 'iatoolkit-jwt-secret'),
|
|
152
|
-
'JWT_ALGORITHM': 'HS256',
|
|
153
|
-
'JWT_EXPIRATION_SECONDS_CHAT': int(self._get_config_value('JWT_EXPIRATION_SECONDS_CHAT', 3600))
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
# Configuración para tokenizers en desarrollo
|
|
157
|
-
if is_dev:
|
|
158
|
-
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
|
159
|
-
|
|
160
|
-
def _setup_database(self):
|
|
161
|
-
database_uri = self._get_config_value('DATABASE_URI')
|
|
162
|
-
if not database_uri:
|
|
163
|
-
raise IAToolkitException(
|
|
164
|
-
IAToolkitException.ErrorType.CONFIG_ERROR,
|
|
165
|
-
"DATABASE_URI es requerida (config dict o variable de entorno)"
|
|
166
|
-
)
|
|
167
|
-
|
|
168
|
-
self.db_manager = DatabaseManager(database_uri)
|
|
169
|
-
self.db_manager.create_all()
|
|
170
|
-
logging.info("✅ Base de datos configurada correctamente")
|
|
171
|
-
|
|
172
|
-
def _setup_redis_sessions(self):
|
|
173
|
-
redis_url = self._get_config_value('REDIS_URL')
|
|
174
|
-
if not redis_url:
|
|
175
|
-
logging.warning("⚠️ REDIS_URL no configurada, usando sesiones en memoria")
|
|
176
|
-
return
|
|
177
|
-
|
|
178
|
-
try:
|
|
179
|
-
url = urlparse(redis_url)
|
|
180
|
-
redis_instance = redis.Redis(
|
|
181
|
-
host=url.hostname,
|
|
182
|
-
port=url.port,
|
|
183
|
-
password=url.password,
|
|
184
|
-
ssl=(url.scheme == "rediss"),
|
|
185
|
-
ssl_cert_reqs=None
|
|
186
|
-
)
|
|
187
|
-
|
|
188
|
-
self.app.config.update({
|
|
189
|
-
'SESSION_TYPE': 'redis',
|
|
190
|
-
'SESSION_REDIS': redis_instance
|
|
191
|
-
})
|
|
192
|
-
|
|
193
|
-
Session(self.app)
|
|
194
|
-
logging.info("✅ Redis y sesiones configurados correctamente")
|
|
195
|
-
|
|
196
|
-
except Exception as e:
|
|
197
|
-
logging.error(f"❌ Error configurando Redis: {e}")
|
|
198
|
-
logging.warning("⚠️ Continuando sin Redis")
|
|
199
|
-
|
|
200
|
-
def _setup_cors(self):
|
|
201
|
-
"""🌐 Configura CORS"""
|
|
202
|
-
# Origins por defecto para desarrollo
|
|
203
|
-
default_origins = [
|
|
204
|
-
"http://localhost:5001",
|
|
205
|
-
"http://127.0.0.1:5001",
|
|
206
|
-
os.getenv('IATOOLKIT_BASE_URL')
|
|
207
|
-
]
|
|
208
|
-
|
|
209
|
-
# Obtener origins adicionales desde configuración/env
|
|
210
|
-
extra_origins = []
|
|
211
|
-
for i in range(1, 11): # Soporte para CORS_ORIGIN_1 a CORS_ORIGIN_10
|
|
212
|
-
origin = self._get_config_value(f'CORS_ORIGIN_{i}')
|
|
213
|
-
if origin:
|
|
214
|
-
extra_origins.append(origin)
|
|
215
|
-
|
|
216
|
-
all_origins = default_origins + extra_origins
|
|
217
|
-
|
|
218
|
-
CORS(self.app,
|
|
219
|
-
supports_credentials=True,
|
|
220
|
-
origins=all_origins,
|
|
221
|
-
allow_headers=[
|
|
222
|
-
"Content-Type", "Authorization", "X-Requested-With",
|
|
223
|
-
"X-Chat-Token", "x-chat-token"
|
|
224
|
-
],
|
|
225
|
-
methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"])
|
|
226
|
-
|
|
227
|
-
logging.info(f"✅ CORS configurado para: {all_origins}")
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
def _configure_core_dependencies(self, binder: Binder):
|
|
231
|
-
"""⚙️ Configures all system dependencies."""
|
|
232
|
-
try:
|
|
233
|
-
# Core dependencies
|
|
234
|
-
binder.bind(Flask, to=self.app, scope=singleton)
|
|
235
|
-
binder.bind(DatabaseManager, to=self.db_manager, scope=singleton)
|
|
236
|
-
|
|
237
|
-
# Bind all application components by calling the specific methods
|
|
238
|
-
self._bind_repositories(binder)
|
|
239
|
-
self._bind_services(binder)
|
|
240
|
-
self._bind_infrastructure(binder)
|
|
241
|
-
self._bind_views(binder)
|
|
242
|
-
|
|
243
|
-
logging.info("✅ Dependencias configuradas correctamente")
|
|
244
|
-
|
|
245
|
-
except Exception as e:
|
|
246
|
-
logging.error(f"❌ Error configurando dependencias: {e}")
|
|
247
|
-
raise IAToolkitException(
|
|
248
|
-
IAToolkitException.ErrorType.CONFIG_ERROR,
|
|
249
|
-
f"❌ Error configurando dependencias: {e}"
|
|
250
|
-
)
|
|
251
|
-
|
|
252
|
-
def _bind_repositories(self, binder: Binder):
|
|
253
|
-
from repositories.document_repo import DocumentRepo
|
|
254
|
-
from repositories.profile_repo import ProfileRepo
|
|
255
|
-
from repositories.llm_query_repo import LLMQueryRepo
|
|
256
|
-
from repositories.vs_repo import VSRepo
|
|
257
|
-
from repositories.tasks_repo import TaskRepo
|
|
258
|
-
|
|
259
|
-
binder.bind(DocumentRepo, to=DocumentRepo)
|
|
260
|
-
binder.bind(ProfileRepo, to=ProfileRepo)
|
|
261
|
-
binder.bind(LLMQueryRepo, to=LLMQueryRepo)
|
|
262
|
-
binder.bind(VSRepo, to=VSRepo)
|
|
263
|
-
binder.bind(TaskRepo, to=TaskRepo)
|
|
264
|
-
|
|
265
|
-
def _bind_services(self, binder: Binder):
|
|
266
|
-
from services.query_service import QueryService
|
|
267
|
-
from services.tasks_service import TaskService
|
|
268
|
-
from services.benchmark_service import BenchmarkService
|
|
269
|
-
from services.document_service import DocumentService
|
|
270
|
-
from services.prompt_manager_service import PromptService
|
|
271
|
-
from services.excel_service import ExcelService
|
|
272
|
-
from services.mail_service import MailService
|
|
273
|
-
from services.load_documents_service import LoadDocumentsService
|
|
274
|
-
from services.profile_service import ProfileService
|
|
275
|
-
from services.jwt_service import JWTService
|
|
276
|
-
from services.dispatcher_service import Dispatcher
|
|
277
|
-
|
|
278
|
-
binder.bind(QueryService, to=QueryService)
|
|
279
|
-
binder.bind(TaskService, to=TaskService)
|
|
280
|
-
binder.bind(BenchmarkService, to=BenchmarkService)
|
|
281
|
-
binder.bind(DocumentService, to=DocumentService)
|
|
282
|
-
binder.bind(PromptService, to=PromptService)
|
|
283
|
-
binder.bind(ExcelService, to=ExcelService)
|
|
284
|
-
binder.bind(MailService, to=MailService)
|
|
285
|
-
binder.bind(LoadDocumentsService, to=LoadDocumentsService)
|
|
286
|
-
binder.bind(ProfileService, to=ProfileService)
|
|
287
|
-
binder.bind(JWTService, to=JWTService)
|
|
288
|
-
binder.bind(Dispatcher, to=Dispatcher, scope=singleton)
|
|
289
|
-
|
|
290
|
-
def _bind_infrastructure(self, binder: Binder):
|
|
291
|
-
from infra.llm_client import llmClient
|
|
292
|
-
from infra.llm_proxy import LLMProxy
|
|
293
|
-
from infra.google_chat_app import GoogleChatApp
|
|
294
|
-
from infra.mail_app import MailApp
|
|
295
|
-
|
|
296
|
-
binder.bind(LLMProxy, to=LLMProxy, scope=singleton)
|
|
297
|
-
binder.bind(llmClient, to=llmClient, scope=singleton)
|
|
298
|
-
binder.bind(GoogleChatApp, to=GoogleChatApp)
|
|
299
|
-
binder.bind(MailApp, to=MailApp)
|
|
300
|
-
binder.bind(IAuthentication, to=IAuthentication)
|
|
301
|
-
binder.bind(Utility, to=Utility)
|
|
302
|
-
|
|
303
|
-
def _bind_views(self, binder: Binder):
|
|
304
|
-
"""Vincula las vistas después de que el injector ha sido creado"""
|
|
305
|
-
from views.llmquery_view import LLMQueryView
|
|
306
|
-
from views.home_view import HomeView
|
|
307
|
-
from views.chat_view import ChatView
|
|
308
|
-
from views.change_password_view import ChangePasswordView
|
|
309
|
-
|
|
310
|
-
binder.bind(HomeView, to=HomeView)
|
|
311
|
-
binder.bind(ChatView, to=ChatView)
|
|
312
|
-
binder.bind(ChangePasswordView, to=ChangePasswordView)
|
|
313
|
-
binder.bind(LLMQueryView, to=LLMQueryView)
|
|
314
|
-
|
|
315
|
-
logging.info("✅ Views configuradas correctamente")
|
|
316
|
-
|
|
317
|
-
def _setup_additional_services(self):
|
|
318
|
-
Bcrypt(self.app)
|
|
319
|
-
|
|
320
|
-
def _setup_cli_commands(self):
|
|
321
|
-
from iatoolkit.cli_commands import register_core_commands
|
|
322
|
-
from services.dispatcher_service import Dispatcher
|
|
323
|
-
from iatoolkit.company_registry import get_company_registry
|
|
324
|
-
|
|
325
|
-
# 1. Register core commands
|
|
326
|
-
register_core_commands(self.app)
|
|
327
|
-
logging.info("✅ Comandos CLI del núcleo registrados.")
|
|
328
|
-
|
|
329
|
-
# 2. Register company-specific commands
|
|
330
|
-
try:
|
|
331
|
-
# Get the dispatcher, which holds the company instances
|
|
332
|
-
dispatcher = self.get_injector().get(Dispatcher)
|
|
333
|
-
registry = get_company_registry()
|
|
334
|
-
|
|
335
|
-
# Iterate through the registered company names
|
|
336
|
-
for company_name in registry.get_registered_companies():
|
|
337
|
-
company_instance = dispatcher.get_company_instance(company_name)
|
|
338
|
-
if company_instance:
|
|
339
|
-
company_instance.register_cli_commands(self.app)
|
|
340
|
-
logging.info(f"✅ Comandos CLI para la compañía '{company_name}' registrados.")
|
|
341
|
-
|
|
342
|
-
except Exception as e:
|
|
343
|
-
logging.error(f"❌ Error durante el registro de comandos de compañías: {e}")
|
|
344
|
-
|
|
345
|
-
def _setup_context_processors(self):
|
|
346
|
-
# Configura context processors para templates
|
|
347
|
-
@self.app.context_processor
|
|
348
|
-
def inject_globals():
|
|
349
|
-
return {
|
|
350
|
-
'url_for': url_for,
|
|
351
|
-
'iatoolkit_version': self.version,
|
|
352
|
-
'app_name': 'IAToolkit',
|
|
353
|
-
'user': SessionManager.get('user'),
|
|
354
|
-
'user_company': SessionManager.get('company_short_name'),
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
def _get_default_static_folder(self) -> str:
|
|
358
|
-
try:
|
|
359
|
-
current_dir = os.path.dirname(os.path.abspath(__file__)) # .../src/iatoolkit
|
|
360
|
-
src_dir = os.path.dirname(current_dir) # .../src
|
|
361
|
-
return os.path.join(src_dir, "static")
|
|
362
|
-
except:
|
|
363
|
-
return 'static'
|
|
364
|
-
|
|
365
|
-
def _get_default_template_folder(self) -> str:
|
|
366
|
-
try:
|
|
367
|
-
current_dir = os.path.dirname(os.path.abspath(__file__)) # .../src/iatoolkit
|
|
368
|
-
src_dir = os.path.dirname(current_dir) # .../src
|
|
369
|
-
return os.path.join(src_dir, "templates")
|
|
370
|
-
except:
|
|
371
|
-
return 'templates'
|
|
372
|
-
|
|
373
|
-
def get_injector(self) -> Injector:
|
|
374
|
-
"""Obtiene el injector actual"""
|
|
375
|
-
if not self._injector:
|
|
376
|
-
raise IAToolkitException(
|
|
377
|
-
IAToolkitException.ErrorType.CONFIG_ERROR,
|
|
378
|
-
f"❌ injector not initialized"
|
|
379
|
-
)
|
|
380
|
-
return self._injector
|
|
381
|
-
|
|
382
|
-
def get_dispatcher(self):
|
|
383
|
-
from services.dispatcher_service import Dispatcher
|
|
384
|
-
if not self._injector:
|
|
385
|
-
raise IAToolkitException(
|
|
386
|
-
IAToolkitException.ErrorType.CONFIG_ERROR,
|
|
387
|
-
"App no inicializada. Llame a create_app() primero"
|
|
388
|
-
)
|
|
389
|
-
return self._injector.get(Dispatcher)
|
|
390
|
-
|
|
391
|
-
def get_database_manager(self) -> DatabaseManager:
|
|
392
|
-
if not self.db_manager:
|
|
393
|
-
raise IAToolkitException(
|
|
394
|
-
IAToolkitException.ErrorType.CONFIG_ERROR,
|
|
395
|
-
"Database manager no inicializado"
|
|
396
|
-
)
|
|
397
|
-
return self.db_manager
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
def current_iatoolkit() -> IAToolkit:
|
|
401
|
-
return IAToolkit.get_instance()
|
|
402
|
-
|
|
403
|
-
# 🚀 Función de conveniencia para inicialización rápida
|
|
404
|
-
def create_app(config: Optional[Dict[str, Any]] = None) -> Flask:
|
|
405
|
-
toolkit = IAToolkit(config)
|
|
406
|
-
toolkit.create_iatoolkit()
|
|
407
|
-
|
|
408
|
-
return toolkit.app
|
|
409
|
-
|
|
410
|
-
if __name__ == "__main__":
|
|
411
|
-
app = create_app()
|
|
412
|
-
if app:
|
|
413
|
-
app.run(debug=True)
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
Mi app es un chatbot multiempresa, que se conecta
|
|
2
|
-
con datos empresariales por sql y llamadas a endpoints.
|
|
3
|
-
|
|
4
|
-
Es principalmente un backend, pero tambien puede actuar como frontend.
|
|
5
|
-
Cuando actua como backend, los usuarios se identifican como external_user_id
|
|
6
|
-
y el front lo informa en la vista external_login_view.
|
|
7
|
-
|
|
8
|
-
Cuando actua como front y back,
|
|
9
|
-
existe un acceso que simula un usuario externo a través de
|
|
10
|
-
public_chat_view.
|
|
11
|
-
|
|
12
|
-
El otro mecanismo de acceso es con el sistema de usuarios
|
|
13
|
-
integrado a mi app, con tablas propias: user, company, user_company
|
|
14
|
-
y el acceso se hace a través de profile_service.
|
|
15
|
-
|
|
16
|
-
Estos accesos sirven para autentificar las consultas.
|
|
17
|
-
Cada vez que hay un acceso en estos puntos, se llama a query_service
|
|
18
|
-
para que construya el contexto de la empresa y se lo envie al
|
|
19
|
-
llm.
|
|
20
|
-
|
|
21
|
-
Se guarda en session de redis, el response.id generado
|
|
22
|
-
para linkearlo con las consultas futuras (responses api de openai).
|
|
23
|
-
|
|
24
|
-
Por otra parte, las queries ingresan a través de llm_query_view,
|
|
25
|
-
el que autentifica al solicitante y la dirige a query_service.
|
|
26
|
-
|
|
27
|
-
Query_service gestiona los prompts que pueden ser solicitados
|
|
28
|
-
y llama a invoke en openai_client, quien se encarga
|
|
29
|
-
de interactuar con el llm.
|
|
30
|
-
|
|
31
|
-
Una vez terminada la interacción, se graba un registro en la
|
|
32
|
-
tabla llm_queries.
|