Changes made:
- Added `instanceId` to sessions in DifyService, OpenaiService, and TypebotService to ensure that sessions are individual per instance and remoteJid.
- Decreased delay time in BaileysStartupService from 2000ms to 1000ms.
The bug fix ensures that sessions are unique per instance and remoteJid, which improves the overall functionality of the application. The delay time reduction in BaileysStartupService speeds up the pairing code request process.
The modified files are DifyService, OpenaiService, TypebotService, and BaileysStartupService.
This commit introduces a new feature that transcribes audio messages to text using OpenAI's Whisper model. The following files were modified to implement this feature:
- `CHANGELOG.md`: Added a new entry under the 'Features' section to document the speech-to-text functionality.
- `prisma/postgresql-schema.prisma`: Added a new boolean field `speechToText` to the `OpenaiSetting` model.
- `src/api/integrations/openai/dto/openai.dto.ts`: Added a new optional boolean property `speechToText` to the `OpenaiSettingDto` class.
- `src/api/integrations/openai/services/openai.service.ts`: Implemented the `speechToText` method to handle the transcription process.
- `src/api/integrations/openai/validate/openai.schema.ts`: Added a new required boolean schema for the `speechToText` property in the `openaiSettingSchema`.
- `src/api/integrations/typebot/services/typebot.service.ts`: Updated the `audioMessage` property to consider the new `speechToText` field.
- `src/api/services/channels/whatsapp.baileys.service.ts` and `src/api/services/channels/whatsapp.business.service.ts`: Added logic to handle the transcription of audio messages when the `speechToText` setting is enabled.
The purpose of this change is to provide a more accessible way for users to interact with audio messages by converting them to text. This improvement will be particularly useful for users with hearing impairments or those in noisy environments.
Modified the implementation of Dify and OpenAI services to improve overall functionality. These changes aim to enhance the stability and performance of the integration layer, although no new features have been added.
Changes affected the following files:
- dify.service.ts
- openai.service.ts
Adds support for Dify integration, including new routes, services, and controllers. The configuration for Dify has been added to the environment file, and the necessary changes have been made to the `.env.example` file. Additionally, the WhatsApp Baileys service has been updated to handle Dify notifications.
Modified files:
- `.env.example`
- `package.json`
- `src/api/integrations/openai/services/openai.service.ts`
- `src/api/routes/index.router.ts`
- `src/api/server.module.ts`
- `src/api/services/channel.service.ts`
- `src/api/services/channels/whatsapp.baileys.service.ts`
- `src/config/env.config.ts`
- `src/validate/validate.schema.ts`
Introduced files:
- `src/api/integrations/dify/`
- `src/api/integrations/dify/controllers/dify.controller.ts`
- `src/api/integrations/dify/dto/dify.dto.ts`
- `src/api/integrations/dify/routes/dify.router.ts`
- `src/api/integrations/dify/services/dify.service.ts`
- `src/api/integrations/dify/validate/dify.schema.ts`
This commit fixes an issue where openai sessions were not being properly deleted or paused. It updates the `openai.service.ts` and `openai.schema.ts` files to correctly handle session deletion and pausing.
The `openai.service.ts` file now includes additional checks for session status before deleting or updating. The `openai.schema.ts` file has been updated to include a new 'delete' status option.
These changes ensure that openai sessions are properly managed and that the bot can be paused and resumed as intended. This improves the overall functionality and user experience of the application.
Corrected an issue in the validation of openai triggers by changing the 'findFirst' method to 'findMany' and implementing a loop to find the correct trigger match. This change improves the accuracy of trigger validation and ensures that all possible matches are considered.
Impact: This fix ensures that the correct trigger is identified, improving the overall functionality of the openai integration.
Affected files:
- openai.service.ts
Modifies the TriggerType enum to include a 'none' option and updates the OpenAI and Typebot services to handle this new option. Additionally, the services now require a trigger operator and value when the trigger type is set to 'keyword'.
Modified files:
- prisma/postgresql-schema.prisma
- src/api/integrations/openai/services/openai.service.ts
- src/api/integrations/typebot/services/typebot.service.ts
Untracked file:
- prisma/migrations/20240729115127_modify_trigger_type_openai_typebot_table/
Remove unnecessary initialization of empty arrays for systemMessages, assistantMessages, and userMessages in OpenaiService.
Also, implement a function to handle open chat completion and refactor the code for better readability and maintainability.
Affected files: openai.service.ts