Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add brain missing message #958

Merged
merged 1 commit into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": "Мозг не найден"
}