Skip to content

Commit

Permalink
fix default date, chatroom being duplicated after every message
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekleon committed Dec 4, 2024
1 parent bec4cef commit 8f88d61
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 4 additions & 1 deletion backend/app/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ def run_query(query: QueryRequest):

# Step 2: Check if any pinned events exist
city = info.get('city')
date = info.get('date') or datetime.today()
date = info.get('date')
if date is None:
date = datetime.today().strftime('%Y-%m-%d')

keywords = info.get('keywords')
if city is None or date is None:
CITY_NOT_FOUND = "You seem to have not provided the city or date correctly. Please double check it"
Expand Down
12 changes: 7 additions & 5 deletions frontend/src/components/Chatbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ const Chatbox: React.FC = () => {
if (data) {
const botResponse: Message = { user_or_chatbot: 'chatbot', message: data.message };
addMessage(botResponse);
addItem({
segment: `chat/${data.id}`,
title: data.id,
}, 4);
navigate(`/chat/${data.id}`, { replace: true });
if (sessionId === '/') {
addItem({
segment: `chat/${data.id}`,
title: data.id,
}, 4);
navigate(`/chat/${data.id}`, { replace: true });
}
}
};

Expand Down

0 comments on commit 8f88d61

Please sign in to comment.