fix(chatbot): made error handling more explicit in replies.

This commit is contained in:
Nic D 2026-02-25 14:08:04 -05:00
parent 883e6f8a3d
commit 0b7e29e5d0
4 changed files with 20 additions and 11 deletions

View File

@ -41,7 +41,7 @@ export default defineConfig((ctx) => {
build: {
target: {
browser: [ 'es2022', 'firefox115', 'chrome115', 'safari14' ],
node: 'node20'
node: 'node20',
},
typescript: {
@ -66,7 +66,11 @@ export default defineConfig((ctx) => {
// polyfillModulePreload: true,
// distDir
// extendViteConf (viteConf) {},
extendViteConf: (_config) => ({
optimizeDeps: {
exclude: ['tesseract.js']
}
}),
// viteVuePluginOptions: {},
vitePlugins: [

View File

@ -5,9 +5,11 @@ export default {
chat_placeholder: "Enter a Message",
chat_thinking: "Thinking...",
error: {
NO_REPLY_RECEIVED: "encountered an error while waiting for chatbot to reply",
SEND_MESSAGE_FAILED: "unable to send message to chatbot",
GENERIC_RESPONSE_ERROR: "An error was encountered while waiting for the chatbot to reply, please try again.",
NO_REPLY_RECEIVED: "FRONTEND ERROR: the backend did not include a message text in the response",
NO_DATA_RECEIVED: "BACKEND ERROR: the backend did not receive any data from the AI agent",
NO_OUTPUT_RECEIVED: "BACKEND ERROR: the backend received data, but no output, from the AI agent",
SEND_MESSAGE_FAILED: "FRONTEND ERROR: Your message could not send or was timed out",
GENERIC_RESPONSE_ERROR: "BACKEND ERROR: An unexpected error occured while waiting for the backend to respond",
},
},

View File

@ -5,9 +5,11 @@ export default {
chat_placeholder: "Entrez un Message",
chat_thinking: "Réflexion en cours...",
error: {
NO_REPLY_RECEIVED: "Une erreur est survenu lors de la réception de la réponse du chatbot",
SEND_MESSAGE_FAILED: "Une erreur est survenue lors de l'envoi de votre message",
GENERIC_RESPONSE_ERROR: "Le chatbot ne réponds pas pour le moment, veuillez réessayer.",
NO_REPLY_RECEIVED: "ERREUR FRONTEND: Le frontend n'a pas recu de message de l'IA dans la réponse du backend",
NO_DATA_RECEIVED: "ERREUR BACKEND: L'agent IA n'a pas inclu de data dans sa réponse au backend",
NO_OUTPUT_RECEIVED: "ERREUR BACKEND: L'agent IA a inclu du data, mais pas de output, dans sa réponse au backend",
SEND_MESSAGE_FAILED: "ERREUR FRONTEND: Une erreur est survenue lors de l'envoi de votre message, ou la connexion a été perdu",
GENERIC_RESPONSE_ERROR: "ERREUR BACKEND: Une erreur est survenu lors de la réception de la réponse du AI",
},
},

View File

@ -16,17 +16,18 @@ export const useChatbotStore = defineStore("chatbot", () => {
try {
const chatbot_response = await chatbotService.sendChatMessage(user_message, current_page_context.value);
if (chatbot_response) {
if (chatbot_response.text) {
last_chatbot_message.text = chatbot_response.text;
last_chatbot_message.isThinking = false;
} else {
last_chatbot_message.text = 'chatbot.error.NO_REPLY_RECEIVED';
last_chatbot_message.isThinking = false;
}
}
catch (error) {
} catch (error) {
last_chatbot_message.text = 'chatbot.error.SEND_MESSAGE_FAILED';
last_chatbot_message.isThinking = false;
console.error('error sending message: ', error);
}
};