mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-13 15:14:49 -06:00
fix: remove quebras de linha extras nas mensagens do N8n
Corrige o problema de formatação nas mensagens do N8n onde quebras de linha extras estavam sendo adicionadas antes e depois das mídias (imagens, vídeos, etc). Agora o texto é enviado mantendo apenas as quebras de linha intencionais.
This commit is contained in:
parent
5b817028a9
commit
65111481b9
@ -186,7 +186,7 @@ export class N8nService extends BaseChatbotService<N8n, N8nSetting> {
|
||||
while ((match = linkRegex.exec(message)) !== null) {
|
||||
const [fullMatch, exclamation, altText, url] = match;
|
||||
const mediaType = this.getMediaType(url);
|
||||
const beforeText = message.slice(lastIndex, match.index);
|
||||
const beforeText = message.slice(lastIndex, match.index).trim();
|
||||
|
||||
if (beforeText) {
|
||||
textBuffer += beforeText;
|
||||
@ -298,7 +298,7 @@ export class N8nService extends BaseChatbotService<N8n, N8nSetting> {
|
||||
lastIndex = match.index + fullMatch.length;
|
||||
}
|
||||
|
||||
const remainingText = message.slice(lastIndex);
|
||||
const remainingText = message.slice(lastIndex).trim();
|
||||
if (remainingText) {
|
||||
textBuffer += remainingText;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user