fix(chatbot): reverted testing changes, made error messages more explicit

This commit is contained in:
Nic D 2026-02-25 14:08:43 -05:00
parent c75bbb445e
commit 64f289a98d

View File

@ -12,15 +12,29 @@ export class ChatbotService {
async pingExternalApi(body: UserMessageDto, email: string): Promise<Message> {
try {
const response = await firstValueFrom(this.httpService.post(
'https://n8nai.targo.ca/webhook/chatty-Mcbot',
{ userInput: body.userInput, userId: email, sessionId: this.sessionId, pageContext: body.pageContext ?? undefined }
'https://n8nai.targo.ca/webhook/chatty-Mcbot',
{
userInput: body.userInput,
userId: email,
sessionId: this.sessionId,
pageContext: body.pageContext ?? undefined
}
));
console.log('chatbot data received: ', response);
if (!response.data)
return {
text: 'chatbot.error.NO_DATA_RECEIVED',
sent: false,
}
if (!response.data[0].output)
return {
text: 'chatbot.error.NO_OUTPUT_RECEIVED',
sent: false,
}
return {
// text: data[0].output,
text: 'success',
text: response.data[0].output,
sent: false,
};
} catch (error) {