diff --git a/.gitignore b/.gitignore index c52cd94..d8e5134 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ dist-ssr *.njsproj *.sln *.sw? +*.env diff --git a/package-lock.json b/package-lock.json index 43e4794..d7161ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "@tauri-apps/cli": "^1.2.3", "@tsconfig/svelte": "^3.0.0", "@types/marked": "^4.0.8", + "@types/node": "^18.15.3", "bulma": "^0.9.4", "bulma-prefers-dark": "^0.1.0-beta.1", "copy-to-clipboard": "^3.3.3", @@ -788,6 +789,12 @@ "integrity": "sha512-HVNzMT5QlWCOdeuBsgXP8EZzKUf0+AXzN+sLmjvaB3ZlLqO+e4u0uXrdw9ub69wBKFs+c6/pA4r9sy6cCDvImw==", "dev": true }, + "node_modules/@types/node": { + "version": "18.15.3", + "resolved": "https://mirrors.cloud.tencent.com/npm/@types/node/-/node-18.15.3.tgz", + "integrity": "sha512-p6ua9zBxz5otCmbpb5D3U4B5Nanw6Pk3PPyX05xnxbB/fRv71N7CPmORg7uAD5P70T0xmx1pzAx/FUfa5X+3cw==", + "dev": true + }, "node_modules/@types/pug": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/pug/-/pug-2.0.6.tgz", diff --git a/package.json b/package.json index cedabc5..3458c16 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@tauri-apps/cli": "^1.2.3", "@tsconfig/svelte": "^3.0.0", "@types/marked": "^4.0.8", + "@types/node": "^18.15.3", "bulma": "^0.9.4", "bulma-prefers-dark": "^0.1.0-beta.1", "copy-to-clipboard": "^3.3.3", diff --git a/src/app.scss b/src/app.scss index f3cb785..fbc1aa5 100644 --- a/src/app.scss +++ b/src/app.scss @@ -53,6 +53,7 @@ a.is-disabled { /* Style the chat input */ .chat-input { overflow-y:hidden; + resize: vertical; } $footer-padding: 3rem 1.5rem; diff --git a/src/lib/Chat.svelte b/src/lib/Chat.svelte index 3d037ac..3a1d2ce 100644 --- a/src/lib/Chat.svelte +++ b/src/lib/Chat.svelte @@ -145,7 +145,7 @@ // Send API request /* // Not working yet: a way to get the response as a stream - await fetchEventSource("https://api.openai.com/v1/chat/completions", { + await fetchEventSource(import.meta.env.VITE_API_BASE + "/v1/chat/completions", { method: "POST", headers: { Authorization: @@ -186,7 +186,7 @@ }, {}) } response = await ( - await fetch('https://api.openai.com/v1/chat/completions', { + await fetch(import.meta.env.VITE_API_BASE + '/v1/chat/completions', { method: 'POST', headers: { Authorization: `Bearer ${$apiKeyStorage}`, @@ -295,7 +295,7 @@ // Load available models from OpenAI const allModels = (await ( - await fetch('https://api.openai.com/v1/models', { + await fetch(import.meta.env.VITE_API_BASE + '/v1/models', { method: 'GET', headers: { Authorization: `Bearer ${$apiKeyStorage}`, @@ -442,7 +442,7 @@ {/if} -