close sse
This commit is contained in:
4
app.vue
4
app.vue
@@ -120,17 +120,13 @@ onNuxtReady(() => {
|
|||||||
permanent
|
permanent
|
||||||
>
|
>
|
||||||
<v-list>
|
<v-list>
|
||||||
<ClientOnly>
|
|
||||||
<ModelDialog/>
|
<ModelDialog/>
|
||||||
</ClientOnly>
|
|
||||||
</v-list>
|
</v-list>
|
||||||
|
|
||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
<v-list>
|
<v-list>
|
||||||
<ClientOnly>
|
|
||||||
<ApiKeyDialog/>
|
<ApiKeyDialog/>
|
||||||
</ClientOnly>
|
|
||||||
|
|
||||||
<v-list-item
|
<v-list-item
|
||||||
rounded="xl"
|
rounded="xl"
|
||||||
|
|||||||
@@ -33,16 +33,16 @@
|
|||||||
clearable
|
clearable
|
||||||
:disabled="!editable"
|
:disabled="!editable"
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
<v-div
|
<div
|
||||||
v-if="editable"
|
v-if="editable"
|
||||||
>
|
>
|
||||||
<v-btn class="ml-3" icon="done" @click="save"></v-btn>
|
<v-btn class="ml-3" icon="done" @click="save"></v-btn>
|
||||||
</v-div>
|
</div>
|
||||||
<v-div
|
<div
|
||||||
v-else
|
v-else
|
||||||
>
|
>
|
||||||
<v-btn class="ml-3" icon="edit" @click="editable = true"></v-btn>
|
<v-btn class="ml-3" icon="edit" @click="editable = true"></v-btn>
|
||||||
</v-div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
<template>
|
|
||||||
<v-list-item v-if="showApiKeyEditor">
|
|
||||||
<v-text-field
|
|
||||||
label="Api key"
|
|
||||||
v-model="apiKeyInput"
|
|
||||||
hide-details
|
|
||||||
variant="outlined"
|
|
||||||
></v-text-field>
|
|
||||||
<template v-slot:append>
|
|
||||||
<v-icon icon="done" size="small" @click="submitApiKey"></v-icon>
|
|
||||||
<v-icon icon="close" size="small" @click="showApiKeyEditor = false"></v-icon>
|
|
||||||
</template>
|
|
||||||
</v-list-item>
|
|
||||||
<v-list-item
|
|
||||||
v-else
|
|
||||||
:title="currentApiKey"
|
|
||||||
subtitle="OpenAI API key"
|
|
||||||
>
|
|
||||||
<template v-slot:append>
|
|
||||||
<v-icon icon="edit" @click="showApiKeyEditor = true"></v-icon>
|
|
||||||
</template>
|
|
||||||
</v-list-item>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
const { data } = await useFetch('/api/settings/?key=apiKey')
|
|
||||||
const currentApiKey = ref(data.value.data??'Not set yet')
|
|
||||||
const apiKeyInput = ref(currentApiKey.value)
|
|
||||||
const showApiKeyEditor = ref(false)
|
|
||||||
const submitApiKey = async () => {
|
|
||||||
try {
|
|
||||||
const { data } = await useFetch('/api/settings', {
|
|
||||||
method: 'POST',
|
|
||||||
body: { key: 'apiKey', value: apiKeyInput.value }
|
|
||||||
})
|
|
||||||
if (data.value.status === 'success') {
|
|
||||||
currentApiKey.value = apiKeyInput.value
|
|
||||||
showApiKeyEditor.value = false
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -3,6 +3,7 @@ const appName = 'ChatGPT UI'
|
|||||||
|
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
dev: false,
|
dev: false,
|
||||||
|
ssr: false,
|
||||||
app: {
|
app: {
|
||||||
head: {
|
head: {
|
||||||
title: appName,
|
title: appName,
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
|
|
||||||
const get = (key) => {
|
const get = (key) => {
|
||||||
if (typeof window !== 'undefined') {
|
|
||||||
let val = localStorage.getItem(key)
|
let val = localStorage.getItem(key)
|
||||||
if (val) {
|
if (val) {
|
||||||
val = JSON.parse(val)
|
val = JSON.parse(val)
|
||||||
}
|
}
|
||||||
return val
|
return val
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const set = (key, val) => {
|
const set = (key, val) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user