diff --git a/src/app-config.json b/src/app-config.json
index 2c22176..2141966 100644
--- a/src/app-config.json
+++ b/src/app-config.json
@@ -2,12 +2,6 @@
"accessibility": {
"keyboardShortcut": "ctrl+?"
},
- "assistant": {
- "assistantId": "asst_xmAX5oxByssXrkBymMbcsVEm",
- "instructions": "You are DAVAI, a Data Analysis through Voice and Artificial Intelligence partner. You are an intermediary for a user who is blind who wants to interact with data tables in a data analysis app named CODAP.",
- "modelName": "gpt-4o-mini",
- "useExisting": true
- },
"dimensions": {
"height": 680,
"width": 380
diff --git a/src/components/App.tsx b/src/components/App.tsx
index e35f2d6..89d8189 100755
--- a/src/components/App.tsx
+++ b/src/components/App.tsx
@@ -3,11 +3,12 @@ import { observer } from "mobx-react-lite";
import { initializePlugin, selectSelf } from "@concord-consortium/codap-plugin-api";
import { useAppConfigContext } from "../hooks/use-app-config-context";
import { useAssistantStore } from "../hooks/use-assistant-store";
+import { useOpenAIContext } from "../hooks/use-open-ai-context";
import { ChatInputComponent } from "./chat-input";
import { ChatTranscriptComponent } from "./chat-transcript";
import { ReadAloudMenu } from "./readaloud-menu";
import { KeyboardShortcutControls } from "./keyboard-shortcut-controls";
-import { DAVAI_SPEAKER, GREETING, USER_SPEAKER } from "../constants";
+import { DAVAI_SPEAKER, defaultAssistantId, GREETING, USER_SPEAKER } from "../constants";
import { DeveloperOptionsComponent } from "./developer-options";
import { getUrlParam } from "../utils/utils";
@@ -34,7 +35,9 @@ export const App = observer(() => {
useEffect(() => {
initializePlugin({pluginName: kPluginName, version: kVersion, dimensions});
selectSelf();
- assistantStore.initialize();
+ if (!isDevMode) {
+ assistantStore.initializeAssistant(defaultAssistantId);
+ }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
@@ -104,10 +107,6 @@ export const App = observer(() => {
}
};
- if (!assistantStore.assistant) {
- return
Loading...
;
- }
-
return (
@@ -142,7 +141,7 @@ export const App = observer(() => {
}
();
+
+ useEffect(() => {
+ const fetchAssistants = async () => {
+ try {
+ const res = await apiConnection.beta.assistants.list();
+ const assistantIds = res.data.map(asst => asst.id);
+ setAssistantOptioms(assistantIds);
+ } catch (err) {
+ console.error(err);
+ }
+ };
+
+ fetchAssistants();
+ }, [apiConnection.beta.assistants]);
+
+ const handleSetSelectedAssistant = (e: React.ChangeEvent) => {
+ const id = e.target.value;
+ assistantStore.initializeAssistant(id);
+ };
+
return (