Merge pull request #56 from ryanhex53/main
chat textarea and button ui fix.
This commit is contained in:
commit
4046f9e7c8
|
@ -24,3 +24,4 @@ dist-ssr
|
|||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
*.env
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -53,6 +53,7 @@ a.is-disabled {
|
|||
/* Style the chat input */
|
||||
.chat-input {
|
||||
overflow-y:hidden;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
$footer-padding: 3rem 1.5rem;
|
||||
|
|
|
@ -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 @@
|
|||
<progress class="progress is-small is-dark" max="100" />
|
||||
{/if}
|
||||
|
||||
<form class="field has-addons has-addons-right" on:submit|preventDefault={() => submitForm()}>
|
||||
<form class="field has-addons has-addons-right is-align-items-flex-end" on:submit|preventDefault={() => submitForm()}>
|
||||
<p class="control is-expanded">
|
||||
<textarea
|
||||
class="input is-info is-focused chat-input"
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
import { defineConfig } from 'vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
||||
|
||||
import purgecss from '@fullhuman/postcss-purgecss'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(({ command, mode, ssrBuild }) => {
|
||||
// Load env file based on `mode` in the current working directory.
|
||||
const env = loadEnv(mode, process.cwd())
|
||||
// Set default api base url
|
||||
env.VITE_API_BASE = 'https://api.openai.com'
|
||||
// Only run PurgeCSS in production builds
|
||||
if (command === 'build') {
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue