fix(chatbot): reverted testing changes, made error messages more explicit
This commit is contained in:
parent
c75bbb445e
commit
64f289a98d
|
|
@ -13,14 +13,28 @@ export class ChatbotService {
|
|||
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 }
|
||||
{
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user