Commit Graph

124 Commits

Author SHA1 Message Date
google-labs-jules[bot]
fc9fedddfe I've updated the Tasks.md file to reflect the completed sprint. The following tasks are now finished:
- [SEC-001] File upload security validation
- [DEP-002] Package security updates
- [IMP-001] Whisper transcription agent
2025-12-22 20:40:24 +00:00
google-labs-jules[bot]
1ddd5af8d5 feat: Complete sprint tasks
- Add file upload security validation to prevent processing of potentially harmful files.
- Update python-telegram-bot to a pinned version and upgrade other dependencies.
- Implement Whisper transcription agent for voice message processing.
- Restore Google Calendar functionality with provided credentials.
2025-12-22 20:35:11 +00:00
Marco Gallegos
21995fece2 docs: Add Tasks.md to track pending tasks, improvements, and issues for the Talia Bot codebase. 2025-12-22 14:21:31 -06:00
Marco Gallegos
13141d6ed3 refactor: Migrate bot core and modules from talia_bot to bot directory, update start_bot.sh and Dockerfile, and modify README.md. 2025-12-21 18:00:31 -06:00
Marco Gallegos
6e1a2f0102 Merge pull request #53 from marcogll/feature/system-stabilization-audit-12843995660965804010
Feature/system stabilization audit 12843995660965804010
2025-12-21 15:24:18 -06:00
Marco Gallegos
21d34d7e3b Merge pull request #52 from marcogll/main
pf
2025-12-21 15:23:53 -06:00
google-labs-jules[bot]
238baa7211 hotfix: Resolve startup error due to missing config variables
This commit fixes a critical `ImportError` that prevented the bot from starting. The error was caused by the `agenda.py` module attempting to import calendar ID variables that were not being loaded into the application's configuration.

The fix involves:
- Updating `talia_bot/config.py` to correctly load the `WORK_GOOGLE_CALENDAR_ID` and `PERSONAL_GOOGLE_CALENDAR_ID` from the environment.
- Removing the obsolete `CALENDAR_ID` variable from the configuration.
- Updating `talia_bot/modules/calendar.py` to import and use the new, more specific `WORK_GOOGLE_CALENDAR_ID` as its default, ensuring consistency with the rest of the application.
2025-12-21 21:23:22 +00:00
Marco Gallegos
19ac02b259 movi, el script 2025-12-21 15:20:34 -06:00
Marco Gallegos
131ebcc0d3 Merge pull request #51 from marcogll/fix/bot-unresponsive-13175179767099529004
This commit fixes a critical bug in the FlowEngine that caused all co…
2025-12-21 15:12:59 -06:00
google-labs-jules[bot]
de9dc8aeda This commit fixes a critical bug in the FlowEngine that caused all conversational flows to fail.
The previous logic for advancing to the next step incorrectly assumed that `step_id`s were always sequential integers (e.g., 0, 1, 2). This caused an immediate failure in any flow that used non-sequential or string-based IDs.

The `handle_response` method in `flow_engine.py` has been refactored to determine the next step by its ordinal position in the flow's `steps` array. This makes the engine robust and compatible with any `step_id` format, ensuring all current and future conversational flows will execute correctly.
2025-12-21 21:00:24 +00:00
Marco Gallegos
b72e17cb5b Merge pull request #50 from marcogll/feature/system-stabilization-audit-12843995660965804010
System Audit, Repair, and Stabilization Plan
2025-12-21 14:55:06 -06:00
google-labs-jules[bot]
81efa4babd feat: Audit, repair, and stabilize bot architecture
This commit addresses critical issues in the Talia Bot system, including fixing missing admin flows, correcting agenda privacy logic, implementing voice message transcription, and enforcing RAG guardrails.

Key changes include:
- Modified the onboarding module to dynamically generate admin menus from available JSON flows, making all admin functions accessible.
- Updated the agenda module to correctly use separate work and personal Google Calendar IDs, ensuring privacy and accurate availability.
- Implemented audio transcription using the OpenAI Whisper API, replacing placeholder logic and enabling multimodal interaction.
- Reworked the sales RAG module to prevent it from generating generic responses when it lacks sufficient context.

Additionally, this commit introduces comprehensive documentation as requested:
- `AGENTS.md`: Defines the roles and responsibilities of each system agent.
- `Agent_skills.md`: Details the technical capabilities and business rules for each agent.
- `plan_de_pruebas.md`: Provides a step-by-step test plan to verify the fixes.
- `reparacion_vs_refactor.md`: Outlines the immediate repairs performed and proposes a strategic, incremental plan for long-term architectural improvements.
2025-12-21 20:29:55 +00:00
Marco Gallegos
9dc13dacb1 feat: Split Google Calendar ID into work and personal IDs and ignore local database files. 2025-12-21 13:53:31 -06:00
Marco Gallegos
3973f9ae43 chore: ignore local database files 2025-12-21 13:48:06 -06:00
Marco Gallegos
b7f68e14f6 feat: update branch options in admin NFC tag creation flow 2025-12-21 13:39:11 -06:00
Marco Gallegos
9ef07d45f9 Merge pull request #49 from marcogll/fix/bot-unresponsive-13175179767099529004
Merge pull request #47 from marcogll/main
2025-12-21 13:32:33 -06:00
Marco Gallegos
d9c61e505b Merge pull request #47 from marcogll/main
Merge pull request #46 from marcogll/fix/bot-unresponsive-13175179767…
2025-12-21 12:41:31 -06:00
Marco Gallegos
07f1326bb2 Merge pull request #48 from marcogll/fix/bot-unresponsive-13175179767099529004
This commit fixes a bug where the client sales funnel would not trigg…
2025-12-21 12:41:15 -06:00
google-labs-jules[bot]
4716c66834 This commit fixes a bug where the client sales funnel would not trigger, causing the conversation to stall.
The 'get_service_info' button was incorrectly being intercepted by a legacy, hardcoded handler in `main.py`. This prevented the data-driven conversational flow defined in `client_sales_funnel.json` from ever starting.

The fix removes the obsolete handler and its corresponding file (`modules/servicios.py`), ensuring that the button click is now correctly routed to the `FlowEngine` to initiate the proper interactive conversation.
2025-12-21 18:33:27 +00:00
Marco Gallegos
05e37f5ff4 Merge pull request #46 from marcogll/fix/bot-unresponsive-13175179767099529004
Fix/bot unresponsive 13175179767099529004
2025-12-21 12:25:10 -06:00
Marco Gallegos
d5216acd85 Merge pull request #45 from marcogll/main
pr
2025-12-21 12:24:48 -06:00
google-labs-jules[bot]
3cdc7a73ef This commit fixes a critical bug where the bot would get stuck in previous conversational flows and provide incorrect responses.
The /start command handler in main.py now explicitly calls flow_engine.end_flow() to clear any existing conversation state for the user.

This ensures that every /start command provides a clean slate, resolving the state management issue and making the bot's interactions predictable and correct.
2025-12-21 18:23:53 +00:00
Marco Gallegos
9d8c48bfe7 feat: update branch selection options in admin create NFC tag flow 2025-12-21 12:22:48 -06:00
Marco Gallegos
8577bff57d Merge pull request #44 from marcogll/feat/cleanup-and-refactor-15004564199648452045
security: Remove file containing leaked Telegram bot token
2025-12-21 12:17:35 -06:00
Marco Gallegos
4976a1d1da Merge pull request #43 from marcogll/fix/bot-unresponsive-13175179767099529004
Fix: Bot Unresponsive and Conversational Flows Failing
2025-12-21 12:09:57 -06:00
google-labs-jules[bot]
384e23cf58 fix: resolve unresponsive bot by migrating to FlowEngine
The Telegram bot was becoming unresponsive due to a conflict between a legacy `ConversationHandler` for the `propose_activity` flow and the main `FlowEngine`. This was likely caused by breaking changes in the `python-telegram-bot` library.

This commit resolves the issue by:
1.  Removing the problematic `ConversationHandler` from `main.py` and its related functions from `modules/equipo.py`.
2.  Migrating the "propose activity" feature to a data-driven JSON flow (`crew_propose_activity.json`), making it compatible with the existing `FlowEngine`.
3.  Pinning the `python-telegram-bot` dependency to `<22` in `requirements.txt` to prevent future breakage from upstream updates.

This change ensures all conversational flows are handled consistently by the `FlowEngine`, restoring bot responsiveness and improving maintainability.
2025-12-21 18:07:45 +00:00
google-labs-jules[bot]
0ccdd26603 security: Remove file containing leaked Telegram bot token
Delete the file `talia_bot/debug.md` which was found to contain a hardcoded Telegram bot token. This is an emergency fix to remove the exposed secret from the current state of the repository.

**Note:** The token is still present in the Git history and must be revoked immediately.
2025-12-21 18:03:39 +00:00
Marco Gallegos
0c2c9fc524 feat: Implement multi-step conversation flows with dynamic UI, persistent state, and improved path handling. 2025-12-21 11:42:08 -06:00
Marco Gallegos
c3f4da3687 Merge pull request #42 from marcogll/feat/cleanup-and-refactor-15004564199648452045
refactor: Align codebase configuration with user's .env file
2025-12-21 09:28:01 -06:00
google-labs-jules[bot]
85d16538f2 refactor: Align codebase configuration with user's .env file
This commit refactors the application's configuration handling to perfectly match the structure and variable names provided by the user in their `.env` file. This resolves multiple critical discrepancies that would have prevented the bot from functioning correctly.

-   **Update `config.py`:** The file `talia_bot/config.py` has been completely rewritten to load environment variables using the names specified by the user (e.g., `TELEGRAM_OWNER_CHAT_ID`, `GOOGLE_CALENDAR_ID`, `VIKUNJA_BASE_URL`).

-   **Update Printer Logic:** The `talia_bot/modules/printer.py` module has been updated to use the new `PRINTER_EMAIL` variable and the specific IMAP credentials (`IMAP_USER`, `IMAP_PASSWORD`), rather than reusing SMTP credentials.

-   **Update `.env.example`:** The `.env.example` template file has been rewritten to serve as an accurate and well-documented guide that matches the user's `.env` structure.

This change ensures that the bot is now fully synchronized with the user's deployment environment, resolving previous inconsistencies and improving the overall robustness of the configuration.
2025-12-21 15:18:55 +00:00
Marco Gallegos
4c59837b09 Merge pull request #41 from marcogll/feat/cleanup-and-refactor-15004564199648452045
Feat/cleanup and refactor 15004564199648452045
2025-12-21 04:15:33 -06:00
Marco Gallegos
2729ee41b8 Merge pull request #40 from marcogll/main
Pr
2025-12-21 04:15:03 -06:00
google-labs-jules[bot]
7b633ef2e8 feat: Implement NFC tag creation wizard via FlowEngine
This commit implements the NFC tag creation wizard as a data-driven JSON flow, completing a key item from the roadmap.

-   **Refactor to FlowEngine:** The previous implementation, which used a `ConversationHandler`, has been completely replaced. The wizard is now defined in `talia_bot/data/flows/admin_create_nfc_tag.json` and is managed by the central `FlowEngine`.
-   **New Module:** The logic for generating the Base64 tag is encapsulated in a new, dedicated module: `talia_bot/modules/nfc_tag.py`.
-   **Improved UX:** The "Sucursal" (branch) selection step now uses buttons, as originally specified in the documentation, improving the user experience.
-   **Code Cleanup:** The obsolete `talia_bot/modules/create_tag.py` module and its corresponding `ConversationHandler` have been removed from `main.py`, making the codebase more consistent and maintainable.
-   **Documentation:** The `README.md` has been updated to mark the feature as complete and to include a description of the new wizard.
2025-12-21 10:13:28 +00:00
Marco Gallegos
bc70b70b71 Merge pull request #39 from marcogll/feat/cleanup-and-refactor-15004564199648452045l
chore: Remove obsolete test scripts and documentation
2025-12-21 04:08:08 -06:00
google-labs-jules[bot]
5274ac3b0c chore: Remove obsolete test scripts and documentation
Remove outdated files from the root directory to clean up the project.

-   Delete `test_calendar_debug.py` and `test_vikunja.py`, which were standalone test scripts from an early development phase.
-   Delete `vikunja.md`, an old specification document that has been superseded by the main `README.md`.
2025-12-21 10:04:12 +00:00
Marco Gallegos
0c2893e440 Merge pull request #38 from marcogll/feat/cleanup-and-refactor-15004564199648452045
docs: Update README with latest features and architecture
2025-12-21 03:48:51 -06:00
google-labs-jules[bot]
8cbaa6dc99 docs: Update README with latest features and architecture
This commit completely revamps the README.md to reflect the current state of the project.

-   **Update Roadmap:** Mark the Remote Printing and Sales RAG Flow features as complete and reorganize the list for clarity.
-   **Rewrite Features Section:** Add detailed descriptions of the new Sales RAG Flow and the Remote Printing Service, explaining how they work.
-   **Refine Architecture Description:** Rewrite the "Concepto Central" section to more accurately describe the bot's architecture as an autonomous agent cycle (Reception -> Identification -> Routing -> Execution).
-   **Update Role Descriptions:** Adjust the permission descriptions for each user role to match the newly implemented features.
2025-12-21 09:47:36 +00:00
Marco Gallegos
1346d8c45f Merge pull request #37 from marcogll/feat-cleanup-and-refactor-15004564199648452045
feat: Enhance sales flow with updated services and RAG
2025-12-21 03:37:08 -06:00
Marco Gallegos
3933204ff3 Merge branch 'main' into feat-cleanup-and-refactor-15004564199648452045 2025-12-21 03:36:58 -06:00
google-labs-jules[bot]
269be771f7 feat: Enhance sales flow with updated services and RAG
This commit improves the conversational sales flow by:

1.  **Updating the Knowledge Base:**
    *   Replaces the content of `talia_bot/data/services.json` with the new, more detailed list of services provided by the user.

2.  **Improving RAG Intelligence:**
    *   Enhances the `generate_sales_pitch` function in `sales_rag.py` to include `work_examples` in the prompt sent to the LLM. This provides more context and enables the generation of more specific and persuasive sales pitches.

3.  **Refining Conversational Tone:**
    *   Adjusts the text in the `client_sales_funnel.json` flow to be more professional and direct.
    *   Updates the industry options in the flow to align with the new service categories.
2025-12-21 09:33:42 +00:00
Marco Gallegos
1b0b0743c2 Update services.json 2025-12-21 03:16:12 -06:00
Marco Gallegos
6c68ff92ba Merge pull request #36 from marcogll/feat/cleanup-and-refactor-15004564199648452045
feat: Implement remote printing and sales RAG flow
2025-12-21 02:56:43 -06:00
google-labs-jules[bot]
ab2831b542 feat: Implement remote printing and sales RAG flow
Implement the first two items from the product roadmap:

1.  **Remote Printing Service:**
    *   Create a new `printer.py` module to handle sending files via SMTP and checking status via IMAP.
    *   Add a document handler in `main.py` to allow admin users to send files to the bot for printing.
    *   Add a `/check_print_status` command for admins to monitor the print job status.
    *   Add SMTP/IMAP configuration variables to `config.py` and `.env.example`.

2.  **Sales RAG Flow:**
    *   Implement a `sales_rag.py` module to generate personalized sales pitches.
    *   The sales flow uses a Retrieval-Augmented Generation (RAG) approach, retrieving relevant services from `services.json` to create a detailed prompt for the LLM.
    *   The existing `flow_engine.py` is modified to trigger the sales pitch generation upon completion of the `client_sales_funnel` flow.
    *   Update `main.py` to handle the flow engine's responses and send the generated pitch to the user.
    *   Update `client_sales_funnel.json` to be triggered by a button in the client menu.
2025-12-21 08:53:50 +00:00
Marco Gallegos
6f73053c8b Merge pull request #35 from marcogll/feat/cleanup-and-refactor-15004564199648452045
Limpiar módulos vacíos y refactorizar importaciones
2025-12-21 02:35:57 -06:00
google-labs-jules[bot]
402fd1d8bc refactor: Clean up empty modules and fix imports
Remove empty placeholder modules talia_bot/modules/printer.py and talia_bot/modules/sales_rag.py.

Update import paths across multiple modules to be absolute from the project root (talia_bot), improving consistency.

Corrected import paths for config variables and utility functions. Standardized the use of the ADMIN_ID configuration variable, resolving a discrepancy where OWNER_CHAT_ID was used.

Removed a duplicated docstring in scheduler.py.
2025-12-21 08:35:05 +00:00
Marco Gallegos
ba64c9f2ac Delete tasks.md 2025-12-21 02:14:52 -06:00
Marco Gallegos
0210f27943 Merge pull request #34 from marcogll/feature/flow-engine-implementation-15654864159042246464
docs: Update README.md to reflect current architecture
2025-12-21 02:10:21 -06:00
Marco Gallegos
adc36071a4 Merge branch 'main' into feature/flow-engine-implementation-15654864159042246464 2025-12-21 02:10:12 -06:00
google-labs-jules[bot]
f4ba24aa96 docs: Update README.md to reflect current architecture
This commit provides a comprehensive update to the README.md file.

The previous version was outdated and did not accurately represent the project's structure or architecture after the implementation of the JSON-based flow engine.

Key changes:
- Rewrites the "Arquitectura Técnica" section to be simpler and more accurate.
- Updates the "Estructura del Proyecto" diagram to be a perfect representation of the current file and module structure.
- Corrects the `git clone` URL in the installation instructions.
- Harmonizes file names (e.g., `google_key.json`) across the documentation and configuration to avoid confusion.
- Simplifies and clarifies the setup and execution instructions.
2025-12-21 08:07:19 +00:00
Marco Gallegos
06002160a5 Merge pull request #33 from marcogll/feature/flow-engine-implementation-15654864159042246464
Feature/flow engine implementation 15654864159042246464
2025-12-21 01:48:44 -06:00