Skip to content

Conversation

@gomessguii
Copy link
Member

@gomessguii gomessguii commented May 15, 2025

  • Introduced Evoai and EvoaiSetting models in both MySQL and PostgreSQL schemas.
  • Implemented EvoaiController and EvoaiService for managing EvoAI bots.
  • Created EvoaiRouter for handling API requests related to EvoAI.
  • Added DTOs and validation schemas for EvoAI integration.
  • Updated server module and chatbot controller to include EvoAI functionality.
  • Configured environment settings for EvoAI integration.

Summary by Sourcery

Add full EvoAI integration by introducing models, services, controllers, routes, DTOs, and validation schemas, and integrating EvoAI into the main chatbot flow with configuration support.

New Features:

  • Add Evoai and EvoaiSetting Prisma models in both MySQL and PostgreSQL schemas
  • Implement CRUD API endpoints for EvoAI bots, settings, sessions, and ignore lists under /evoai
  • Create EvoAI service to process messages, manage sessions, and handle API interactions with EvoAI agents
  • Integrate EvoAI into the ChatbotController emit flow and register EvoAI routes in the main router

Enhancements:

  • Add EVOAI feature flag in environment configuration and update the sample .env.example
  • Register EvoAI service and controller in the server module
  • Add DTO classes and JSON schema validation for EvoAI integration

- Introduced Evoai and EvoaiSetting models in both MySQL and PostgreSQL schemas.
- Implemented EvoaiController and EvoaiService for managing EvoAI bots.
- Created EvoaiRouter for handling API requests related to EvoAI.
- Added DTOs and validation schemas for EvoAI integration.
- Updated server module and chatbot controller to include EvoAI functionality.
- Configured environment settings for EvoAI integration.
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented May 15, 2025

Reviewer's Guide

This PR implements full EvoAI integration by extending configuration, registering new services/controllers, enhancing the chatbot flow, defining Prisma models, and adding dedicated controller, service, router, DTOs, and validation schemas to manage EvoAI bots, settings, sessions, and message processing.

File-Level Changes

Change Details Files
Environment configuration for EvoAI
  • Added Evoai type to env config and Env interface
  • Configured ConfigService to load EVOAI_ENABLED flag
src/config/env.config.ts
Module registration and initialization
  • Instantiated EvoaiService and EvoaiController in server module
  • Integrated EvoAI controller into startup logger
src/api/server.module.ts
Chatbot integration hooks
  • Triggered evoaiController.emit in chatbot controller
  • Mounted EvoaiRouter in chatbot router
  • Exported EvoAI schema in chatbot validation schema
src/api/integrations/chatbot/chatbot.controller.ts
src/api/integrations/chatbot/chatbot.router.ts
src/api/integrations/chatbot/chatbot.schema.ts
Prisma schema updates
  • Defined Evoai and EvoaiSetting models in MySQL schema
  • Defined Evoai and EvoaiSetting models in PostgreSQL schema
prisma/mysql-schema.prisma
prisma/postgresql-schema.prisma
EvoAI controller implementation
  • Implemented CRUD methods for bots
  • Added settings and session management
  • Enhanced emit logic with debounce and fallback handling
src/api/integrations/chatbot/evoai/controllers/evoai.controller.ts
EvoAI service implementation
  • Managed session lifecycle and telemetry
  • Constructed JSON-RPC payloads and handled file parts
  • Processed messages and media through WhatsApp client
src/api/integrations/chatbot/evoai/services/evoai.service.ts
EvoAI routing layer
  • Defined endpoints for bot operations, settings, sessions, and ignoreJid
  • Applied request validation and standardized HTTP status codes
src/api/integrations/chatbot/evoai/routes/evoai.router.ts
DTOs and validation schemas
  • Created EvoaiDto and EvoaiSettingDto classes
  • Added JSON schemas for bot, status, settings, and ignoreJid
src/api/integrations/chatbot/evoai/dto/evoai.dto.ts
src/api/integrations/chatbot/evoai/validate/evoai.schema.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

…ities

- Added support for audio message detection and transcription using OpenAI's Whisper API.
- Integrated media downloading for both audio and image messages, with appropriate error handling.
- Updated logging to redact sensitive information from payloads.
- Modified existing methods to accommodate the new message structure, ensuring seamless integration with EvoAI services.
- Modified the EvoaiService instantiation in the server module to include configService for enhanced configuration management.
@DavidsonGomes DavidsonGomes merged commit 40ea8bf into EvolutionAPI:develop May 15, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants