Skip to content

Commit

Permalink
small performance improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
bruffridge committed Jan 25, 2024
1 parent abb14fa commit f0ec67c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@ npm run dev

- deep-chat textToSpeech: doesn't read messages aloud on safari or chrome on iOS.

- if user has used bidara (assistant id is set in localStorage), then if they delete the assistant, they will get an error. Only way to get rid of error is to delete the assistant id from localStorage. Try to catch the error, and delete the localStorage for them.

### Nice to haves

- save chat logs.
- ability rate responses and add feedback.
- ability to send ratings, feedback and chat log to us.
- don't do TtS unless StT has been used.
- Proxy requests to OpenAI through an authenticated API. Users can request access. Ability to generate api keys once authenticated. Authorized API keys required to communicate with API.

- Show the quote from the file used to generate the response when BIDARA uses knowledge retrieval. https://platform.openai.com/docs/assistants/how-it-works/message-annotations
Expand Down
20 changes: 12 additions & 8 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,28 @@
onMount(async () => { // runs after the component has finished loading.
const deepChatRef = document.getElementById('chat-element');
let openAIKeySet = false;
let openAIAsstSet = false;
deepChatRef.onError = (error) => {
console.log(error);
}
deepChatRef.onNewMessage = (message) => {
// save messages to localStorage.
// this function is called once for each message including initialMessages, ai messages, and user messages.
if (deepChatRef._activeService.rawBody.assistant_id) {
if (localStorage.getItem("openai-asst-id") === null) {
localStorage.setItem('openai-asst-id', deepChatRef._activeService.rawBody.assistant_id);
}
if (!openAIAsstSet && deepChatRef._activeService.rawBody.assistant_id) {
localStorage.setItem('openai-asst-id', deepChatRef._activeService.rawBody.assistant_id);
openAIAsstSet = true;
}
};
deepChatRef.onComponentRender = () => {
// save key to localStorage.
// The event occurs before key is set, and again, after key is set.
if (deepChatRef._activeService.key) {
if (localStorage.getItem("openai-key") === null) {
localStorage.setItem('openai-key', deepChatRef._activeService.key);
}
if (!openAIKeySet && deepChatRef._activeService.key) {
localStorage.setItem('openai-key', deepChatRef._activeService.key);
openAIKeySet = true;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/bidara.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f0ec67c

Please sign in to comment.