mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-13 15:14:49 -06:00
refactor: type-safe applyFormatting
This commit is contained in:
parent
14474ede62
commit
f9eaf1c295
@ -9,6 +9,16 @@ import axios from 'axios';
|
||||
import { BaseChatbotService } from '../../base-chatbot.service';
|
||||
import { OpenaiService } from '../../openai/services/openai.service';
|
||||
|
||||
interface RichTextNode {
|
||||
text?: string;
|
||||
type?: string;
|
||||
children?: RichTextNode[];
|
||||
bold?: boolean;
|
||||
italic?: boolean;
|
||||
underline?: boolean;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export class TypebotService extends BaseChatbotService<TypebotModel, any> {
|
||||
private openaiService: OpenaiService;
|
||||
|
||||
@ -196,9 +206,8 @@ export class TypebotService extends BaseChatbotService<TypebotModel, any> {
|
||||
/**
|
||||
* Apply rich text formatting for TypeBot messages
|
||||
*/
|
||||
private applyFormatting(element: any): string {
|
||||
if (typeof element === 'string') return element;
|
||||
if (!element) return '';
|
||||
private applyFormatting(element: string | RichTextNode | undefined): string {
|
||||
if (!element || typeof element === 'string') return element || '';
|
||||
|
||||
let text = '';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user