Skip to content

Commit

Permalink
feat: add brain missing message (#958)
Browse files Browse the repository at this point in the history
  • Loading branch information
mamadoudicko authored Aug 16, 2023
1 parent 89af479 commit 38b43c0
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
11 changes: 10 additions & 1 deletion frontend/app/chat/[chatId]/hooks/useChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ export const useChat = () => {
setChatId(currentChatId);
}

if (currentBrain?.id === undefined) {
publish({
variant: "danger",
text: t("missing_brain"),
});

return;
}

void track("QUESTION_ASKED");
const chatConfig = getChatConfigFromLocalStorage(currentChatId);

Expand All @@ -53,7 +62,7 @@ export const useChat = () => {
question,
temperature: chatConfig?.temperature,
max_tokens: chatConfig?.maxTokens,
brain_id: currentBrain?.id,
brain_id: currentBrain.id,
};

await addStreamQuestion(currentChatId, chatQuestion);
Expand Down
3 changes: 2 additions & 1 deletion frontend/public/locales/en/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
"chat_title_intro": "Chat with your",
"empty_brain_title_prefix": "Upload files in a",
"empty_brain_title_suffix": "and chat with them",
"actions_bar_placeholder": "Ask a question to @brains or /files and choose your #prompt"
"actions_bar_placeholder": "Ask a question to @brains or /files and choose your #prompt",
"missing_brain": "Please select a brain to chat with"
}
3 changes: 2 additions & 1 deletion frontend/public/locales/es/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
"shortcut_select_file": "/: Seleccionar un archivo para hablar",
"subtitle": "Habla con un modelo de lenguaje acerca de tus datos subidos",
"thinking": "Pensando...",
"title": "Conversa con {{brain}}"
"title": "Conversa con {{brain}}",
"missing_brain": "No hay cerebro seleccionado"
}
3 changes: 2 additions & 1 deletion frontend/public/locales/fr/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
"shortcut_select_file": "/: Sélectionner un fichier pour discuter",
"subtitle": "Parlez à un modèle linguistique de vos données téléchargées",
"thinking": "Réflexion...",
"title": "Discuter avec {{brain}}"
"title": "Discuter avec {{brain}}",
"missing_brain": "Veuillez selectionner un cerveau pour discuter"
}
3 changes: 2 additions & 1 deletion frontend/public/locales/pt-br/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
"shortcut_select_file": "/: Selecione um arquivo para conversar",
"subtitle": "Converse com um modelo de linguagem sobre seus dados enviados",
"thinking": "Pensando...",
"title": "Converse com {{brain}}"
"title": "Converse com {{brain}}",
"missing_brain": "Cérebro não encontrado"
}
3 changes: 2 additions & 1 deletion frontend/public/locales/ru/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
"shortcut_select_file": "/: Выберите файл для общения",
"subtitle": "Общайтесь с языковой моделью о ваших загруженных данных",
"thinking": "Думаю...",
"title": "Чат с {{brain}}"
"title": "Чат с {{brain}}",
"missing_brain": "Мозг не найден"
}

0 comments on commit 38b43c0

Please sign in to comment.