fix: 🐛 brain

changes when selected
This commit is contained in:
Stan Girard 2024-01-22 12:31:59 -08:00
parent 29aea3457f
commit 3375c0f0b9
2 changed files with 12 additions and 5 deletions

View File

@ -72,11 +72,18 @@ class BrainfulChat(ChatInterface):
history = chat_service.get_chat_history(chat_id)
if history:
question = history[0].user_message
list_brains = vector_store.find_brain_closest_query(user_id, question)
if list_brains:
brain_id_to_use = list_brains[0]["id"]
brain_id_to_use = history[0].brain_id
list_brains = []
if history:
list_brains = vector_store.find_brain_closest_query(user_id, question)
metadata["close_brains"] = list_brains
else:
brain_id_to_use = None
list_brains = vector_store.find_brain_closest_query(user_id, question)
if list_brains:
brain_id_to_use = list_brains[0]["id"]
else:
brain_id_to_use = None
# Add to metadata close_brains and close_brains_similarity
metadata["close_brains"] = list_brains

View File

@ -20,7 +20,7 @@ export const SearchBar = (): JSX.Element => {
useEffect(() => {
setCurrentBrainId(null);
});
}, [setCurrentBrainId]);
const submit = async (): Promise<void> => {
setSearching(true);