diff --git a/package.json b/package.json
index e5a9abb8..cda5cfd2 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "koala-client",
"private": true,
- "version": "2.0.8",
+ "version": "2.1.0",
"type": "module",
"homepage": "./",
"main": "electron/index.cjs",
diff --git a/src/App.tsx b/src/App.tsx
index f73dfe57..3e079d55 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -22,6 +22,10 @@ function App() {
const setHideSideMenu = useStore((state) => state.setHideSideMenu);
const hideSideMenu = useStore((state) => state.hideSideMenu);
const bottomMessageRef = useStore((state) => state.bottomMessageRef);
+ const setApiAuth = useStore((state) => state.setApiAuth);
+ const apiAuth = useStore((state) => state.apiAuth);
+ const apiKey = useStore((state) => state.apiKey);
+ const setApiKey = useStore((state) => state.setApiKey);
const initialiseNewChat = useInitialiseNewChat();
const addChat = useAddChat();
@@ -30,6 +34,13 @@ function App() {
const copyCodeBlock = useCopyCodeBlock();
const { handleSubmit } = useSubmit();
+ if (apiKey && !apiAuth[0].apiKey) {
+ const old = apiAuth;
+ old[0].apiKey = apiKey;
+ setApiAuth(old);
+ setApiKey('');
+ }
+
const handleGenerate = () => {
if (useStore.getState().generating) return;
const updatedChats: ChatInterface[] = JSON.parse(
diff --git a/src/api/api.ts b/src/api/api.ts
index 28897c02..e139fbab 100644
--- a/src/api/api.ts
+++ b/src/api/api.ts
@@ -19,7 +19,7 @@ export const getChatCompletion = async (
if (isAzureEndpoint(endpoint) && apiKey) {
headers['api-key'] = apiKey;
- const modelName = modelDef.name;
+ const modelName = modelDef.model;
const apiVersion = '2023-03-15-preview';
@@ -69,7 +69,7 @@ export const getChatCompletionStream = async (
if (isAzureEndpoint(endpoint) && apiKey) {
headers['api-key'] = apiKey;
- const modelName = modelDef.name;
+ const modelName = modelDef.model;
const apiVersion = '2023-03-15-preview';
diff --git a/src/components/ApiMenu/ApiMenu.tsx b/src/components/ApiMenu/ApiMenu.tsx
index 0a11cfae..e76d6571 100644
--- a/src/components/ApiMenu/ApiMenu.tsx
+++ b/src/components/ApiMenu/ApiMenu.tsx
@@ -249,10 +249,12 @@ const ApiMenu = ({
}}
>
- {_apiAuth[modelDef.endpoint].endpoint.replace(
- /^https?:\/\//,
- ''
- )}
+ {_apiAuth[modelDef.endpoint]
+ ? _apiAuth[modelDef.endpoint].endpoint.replace(
+ /^https?:\/\//,
+ ''
+ )
+ : 'Endpoint Undefined'}