Merge pull request 'fix(chatbot): made error handling more explicit in replies.' (#84) from dev/nicolas/timeoff-requests into main
Reviewed-on: Targo/targo_frontend#84
This commit is contained in:
commit
561a104e07
|
|
@ -41,7 +41,7 @@ export default defineConfig((ctx) => {
|
||||||
build: {
|
build: {
|
||||||
target: {
|
target: {
|
||||||
browser: [ 'es2022', 'firefox115', 'chrome115', 'safari14' ],
|
browser: [ 'es2022', 'firefox115', 'chrome115', 'safari14' ],
|
||||||
node: 'node20'
|
node: 'node20',
|
||||||
},
|
},
|
||||||
|
|
||||||
typescript: {
|
typescript: {
|
||||||
|
|
@ -66,7 +66,11 @@ export default defineConfig((ctx) => {
|
||||||
// polyfillModulePreload: true,
|
// polyfillModulePreload: true,
|
||||||
// distDir
|
// distDir
|
||||||
|
|
||||||
// extendViteConf (viteConf) {},
|
extendViteConf: (_config) => ({
|
||||||
|
optimizeDeps: {
|
||||||
|
exclude: ['tesseract.js']
|
||||||
|
}
|
||||||
|
}),
|
||||||
// viteVuePluginOptions: {},
|
// viteVuePluginOptions: {},
|
||||||
|
|
||||||
vitePlugins: [
|
vitePlugins: [
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,11 @@ export default {
|
||||||
chat_placeholder: "Enter a Message",
|
chat_placeholder: "Enter a Message",
|
||||||
chat_thinking: "Thinking...",
|
chat_thinking: "Thinking...",
|
||||||
error: {
|
error: {
|
||||||
NO_REPLY_RECEIVED: "encountered an error while waiting for chatbot to reply",
|
NO_REPLY_RECEIVED: "FRONTEND ERROR: the backend did not include a message text in the response",
|
||||||
SEND_MESSAGE_FAILED: "unable to send message to chatbot",
|
NO_DATA_RECEIVED: "BACKEND ERROR: the backend did not receive any data from the AI agent",
|
||||||
GENERIC_RESPONSE_ERROR: "An error was encountered while waiting for the chatbot to reply, please try again.",
|
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",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,11 @@ export default {
|
||||||
chat_placeholder: "Entrez un Message",
|
chat_placeholder: "Entrez un Message",
|
||||||
chat_thinking: "Réflexion en cours...",
|
chat_thinking: "Réflexion en cours...",
|
||||||
error: {
|
error: {
|
||||||
NO_REPLY_RECEIVED: "Une erreur est survenu lors de la réception de la réponse du chatbot",
|
NO_REPLY_RECEIVED: "ERREUR FRONTEND: Le frontend n'a pas recu de message de l'IA dans la réponse du backend",
|
||||||
SEND_MESSAGE_FAILED: "Une erreur est survenue lors de l'envoi de votre message",
|
NO_DATA_RECEIVED: "ERREUR BACKEND: L'agent IA n'a pas inclu de data dans sa réponse au backend",
|
||||||
GENERIC_RESPONSE_ERROR: "Le chatbot ne réponds pas pour le moment, veuillez réessayer.",
|
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",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,18 @@ export const useChatbotStore = defineStore("chatbot", () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const chatbot_response = await chatbotService.sendChatMessage(user_message, current_page_context.value);
|
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.text = chatbot_response.text;
|
||||||
last_chatbot_message.isThinking = false;
|
last_chatbot_message.isThinking = false;
|
||||||
} else {
|
} else {
|
||||||
last_chatbot_message.text = 'chatbot.error.NO_REPLY_RECEIVED';
|
last_chatbot_message.text = 'chatbot.error.NO_REPLY_RECEIVED';
|
||||||
last_chatbot_message.isThinking = false;
|
last_chatbot_message.isThinking = false;
|
||||||
}
|
}
|
||||||
}
|
} catch (error) {
|
||||||
catch (error) {
|
|
||||||
last_chatbot_message.text = 'chatbot.error.SEND_MESSAGE_FAILED';
|
last_chatbot_message.text = 'chatbot.error.SEND_MESSAGE_FAILED';
|
||||||
last_chatbot_message.isThinking = false;
|
last_chatbot_message.isThinking = false;
|
||||||
|
|
||||||
console.error('error sending message: ', error);
|
console.error('error sending message: ', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user