Skip to content

Commit

Permalink
Merge pull request #280 from amosproj/function-chat-fix
Browse files Browse the repository at this point in the history
refactor: Update Chat component to include chat history in
  • Loading branch information
preetvadaliya authored Jul 17, 2024
2 parents a78bafa + 15249c7 commit d44ef01
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/frontend/screens/Chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,16 @@ export function Chat() {
if (!queryText) return;
if (activeChatId === 'new') {
const chatId = await createNewChat(text);
const data = await fetchResponse(queryText);
const { data } = await getResponse({
query: queryText,
llms: chat?.model || ['gpt-4']
});
await updateChat(chatId, { conversation: arrayUnion({ type: 'AI', message: data }) });
} else {
await updateChat(activeChatId, {
conversation: arrayUnion({ type: 'USER', message: queryText })
});
const data = await fetchResponse(queryText);
const { data } = await getResponse({ query: queryText, llms: chat?.model || [] });
await updateChat(activeChatId, { conversation: arrayUnion({ type: 'AI', message: data }) });
}
} catch (error) {
Expand Down

0 comments on commit d44ef01

Please sign in to comment.