Compare commits
56 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ff914582a | ||
|
|
f20a3562f3 | ||
|
|
4a1adf6d00 | ||
|
|
ddce1c9721 | ||
|
|
f67ed7621c | ||
|
|
97649e4bee | ||
|
|
1082da050b | ||
|
|
d89d1e288d | ||
|
|
cd89d11d0b | ||
|
|
cf0053a060 | ||
|
|
019da4399e | ||
|
|
044961bb01 | ||
|
|
2374c81edb | ||
|
|
699760713e | ||
|
|
d75413cc49 | ||
|
|
8175f199d2 | ||
|
|
f8c2f396c1 | ||
|
|
8217647df8 | ||
|
|
288c9eeeca | ||
|
|
4d09ff7c8a | ||
|
|
5fa059017c | ||
|
|
323f10844b | ||
|
|
ee035390db | ||
|
|
be743bf799 | ||
|
|
a59f84f2bf | ||
|
|
ed0cf2997d | ||
|
|
7f00c74097 | ||
|
|
f007417fa4 | ||
|
|
27c5e2a3ac | ||
|
|
e90dc0c12b | ||
|
|
837fd8c9ff | ||
|
|
ce0b1004f3 | ||
|
|
1ff1c46e37 | ||
|
|
afa3e499dc | ||
|
|
70ce5746bc | ||
|
|
35d4292d29 | ||
|
|
8bbc44e7bf | ||
|
|
3dcb4be6e4 | ||
|
|
83f8072625 | ||
|
|
3992121b71 | ||
|
|
d08806f0c9 | ||
|
|
85ac73efcc | ||
|
|
7cc5a6b347 | ||
|
|
983e4d436d | ||
|
|
727826f1b1 | ||
|
|
386659109c | ||
|
|
bd9e8bf45e | ||
|
|
4e40530a8c | ||
|
|
ea69a350f4 | ||
|
|
18a4251714 | ||
|
|
878fda0054 | ||
|
|
1f3a025918 | ||
|
|
f9db3e5866 | ||
|
|
c9615ed05c | ||
|
|
0d4b6247e2 | ||
|
|
c9c3431cff |
49
README.md
49
README.md
@@ -1,25 +1,38 @@
|
||||
<p align="center">
|
||||
<img alt="demo" src="./demos/demo.gif?v=1">
|
||||
</p>
|
||||
<div align="center">
|
||||
<h1>ChatGPT UI</h1>
|
||||
</div>
|
||||
|
||||
[English](./README.md) | [中文](./docs/zh/README.md)
|
||||
|
||||
# ChatGPT UI
|
||||
|
||||
A ChatGPT web client that supports multiple users, multiple database connections for persistent data storage, supports i18n. Provides Docker images and quick deployment scripts.
|
||||
|
||||
https://user-images.githubusercontent.com/46235412/227156264-ca17ab17-999b-414f-ab06-3f75b5235bfe.mp4
|
||||
|
||||
|
||||
## 📢Updates
|
||||
|
||||
<details open>
|
||||
<summary><strong>2023-03-10</strong></summary>
|
||||
<summary><strong>2023-03-27</strong></summary>
|
||||
🚀 Support gpt-4 model. You can select the model in the "Model Parameters" of the front-end.
|
||||
The GPT-4 model requires whitelist access from OpenAI.
|
||||
</details>
|
||||
|
||||
Add 2 environment variables to control the typewriter effect:
|
||||
|
||||
- `NUXT_PUBLIC_TYPEWRITER=true` to enable/disable the typewriter effect
|
||||
- `NUXT_PUBLIC_TYPEWRITER_DELAY=50` to set the delay time for each character in milliseconds.
|
||||
<details open>
|
||||
<summary><strong>2023-03-23</strong></summary>
|
||||
Added web search capability to generate more relevant and up-to-date answers from ChatGPT!
|
||||
This feature is off by default, you can turn it on in `Chat->Settings` in the admin panel, there is a record `open_web_search` in Settings, set its value to True.
|
||||
|
||||
</details>
|
||||
|
||||
<details open>
|
||||
<summary><strong>2023-03-15</strong></summary>
|
||||
|
||||
Add "open_registration" setting option in the admin panel to control whether user registration is enabled. You can log in to the admin panel and find this setting option under `Chat->Setting`. The default value of this setting is `True` (allow user registration). If you do not need it, please change it to `False`.
|
||||
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>2023-03-04</strong></summary>
|
||||
|
||||
**Update to the latest official chat model** `gpt-3.5-turbo`
|
||||
@@ -82,9 +95,6 @@ services:
|
||||
image: wongsaang/chatgpt-ui-client:latest
|
||||
environment:
|
||||
- SERVER_DOMAIN=http://backend-web-server
|
||||
- NUXT_PUBLIC_APP_NAME='ChatGPT UI' # App name
|
||||
- NUXT_PUBLIC_TYPEWRITER=true # Enable typewriter effect, default is false
|
||||
- NUXT_PUBLIC_TYPEWRITER_DELAY=100 # Typewriter effect delay time, default is 50ms
|
||||
depends_on:
|
||||
- backend-web-server
|
||||
ports:
|
||||
@@ -95,17 +105,20 @@ services:
|
||||
image: wongsaang/chatgpt-ui-wsgi-server:latest
|
||||
environment:
|
||||
- APP_DOMAIN=${APP_DOMAIN:-localhost:9000} # CSRF whitelist,Add the address of your chatgpt-ui-web-server here, default is localhost:9000
|
||||
- SERVER_WORKERS=3 # Number of gunicorn workers, default is 3
|
||||
#- DB_URL=postgres://postgres:postgrespw@localhost:49153/chatgpt # If this parameter is not set, the built-in Sqlite will be used by default. It should be noted that if you do not connect to an external database, the data will be lost after the container is destroyed.
|
||||
#- OPENAI_API_PROXY=https://openai.proxy.com/v1 # Proxy for https://api.openai.com/v1
|
||||
- DJANGO_SUPERUSER_USERNAME=admin # default superuser name
|
||||
- DJANGO_SUPERUSER_PASSWORD=password # default superuser password
|
||||
- DJANGO_SUPERUSER_EMAIL=admin@example.com # default superuser email
|
||||
- ACCOUNT_EMAIL_VERIFICATION=none # Determines the e-mail verification method during signup – choose one of "none", "optional", or "mandatory". Default is "optional". If you don't need to verify the email, you can set it to "none".
|
||||
# If you want to use the email verification function, you need to configure the following parameters
|
||||
# - EMAIL_HOST=SMTP server address
|
||||
# - EMAIL_PORT=SMTP server port
|
||||
# - EMAIL_HOST_USER=
|
||||
# - EMAIL_HOST_PASSWORD=
|
||||
# - EMAIL_USE_TLS=True
|
||||
# - EMAIL_FROM=no-reply@example.com #Default sender email address
|
||||
ports:
|
||||
- '8000:8000'
|
||||
networks:
|
||||
@@ -147,6 +160,16 @@ Before you can start chatting, you need to add an OpenAI API key. In the Setting
|
||||
|
||||
Now you can access the web client at `http(s)://your.domain` or `http://123.123.123.123` to start chatting.
|
||||
|
||||
## Donation
|
||||
|
||||
> If it is helpful to you, it is also helping me.
|
||||
|
||||
If you want to support me, Buy me a coffee ❤️ [https://www.buymeacoffee.com/WongSaang](https://www.buymeacoffee.com/WongSaang)
|
||||
|
||||
<p align="center">
|
||||
<img height="150" src="https://github.com/WongSaang/chatgpt-ui/blob/main/demos/bmc_qr.png?raw=true"/>
|
||||
</p>
|
||||
|
||||
## Development
|
||||
|
||||
### Setup
|
||||
|
||||
8
app.vue
Normal file
8
app.vue
Normal file
@@ -0,0 +1,8 @@
|
||||
<template>
|
||||
<div>
|
||||
<NuxtLoadingIndicator />
|
||||
<NuxtLayout>
|
||||
<NuxtPage />
|
||||
</NuxtLayout>
|
||||
</div>
|
||||
</template>
|
||||
289
components/Conversation.vue
Normal file
289
components/Conversation.vue
Normal file
@@ -0,0 +1,289 @@
|
||||
<script setup>
|
||||
import {EventStreamContentType, fetchEventSource} from '@microsoft/fetch-event-source'
|
||||
import {addConversation} from "../utils/helper";
|
||||
|
||||
const { $i18n, $auth } = useNuxtApp()
|
||||
const runtimeConfig = useRuntimeConfig()
|
||||
const currentModel = useCurrentModel()
|
||||
const openaiApiKey = useApiKey()
|
||||
const fetchingResponse = ref(false)
|
||||
const messageQueue = []
|
||||
let isProcessingQueue = false
|
||||
|
||||
const props = defineProps({
|
||||
conversation: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const processMessageQueue = () => {
|
||||
if (isProcessingQueue || messageQueue.length === 0) {
|
||||
return
|
||||
}
|
||||
if (!props.conversation.messages[props.conversation.messages.length - 1].is_bot) {
|
||||
props.conversation.messages.push({id: null, is_bot: true, message: ''})
|
||||
}
|
||||
isProcessingQueue = true
|
||||
const nextMessage = messageQueue.shift()
|
||||
if (runtimeConfig.public.typewriter) {
|
||||
let wordIndex = 0;
|
||||
const intervalId = setInterval(() => {
|
||||
props.conversation.messages[props.conversation.messages.length - 1].message += nextMessage[wordIndex]
|
||||
wordIndex++
|
||||
if (wordIndex === nextMessage.length) {
|
||||
clearInterval(intervalId)
|
||||
isProcessingQueue = false
|
||||
processMessageQueue()
|
||||
}
|
||||
}, runtimeConfig.public.typewriterDelay)
|
||||
} else {
|
||||
props.conversation.messages[props.conversation.messages.length - 1].message += nextMessage
|
||||
isProcessingQueue = false
|
||||
processMessageQueue()
|
||||
}
|
||||
}
|
||||
|
||||
let ctrl
|
||||
const abortFetch = () => {
|
||||
if (ctrl) {
|
||||
ctrl.abort()
|
||||
}
|
||||
fetchingResponse.value = false
|
||||
}
|
||||
const fetchReply = async (message) => {
|
||||
ctrl = new AbortController()
|
||||
|
||||
let webSearchParams = {}
|
||||
if (enableWebSearch.value) {
|
||||
webSearchParams['web_search'] = {
|
||||
ua: navigator.userAgent,
|
||||
default_prompt: $i18n.t('webSearchDefaultPrompt')
|
||||
}
|
||||
}
|
||||
|
||||
const data = Object.assign({}, currentModel.value, {
|
||||
openaiApiKey: enableCustomApiKey.value ? openaiApiKey.value : null,
|
||||
message: message,
|
||||
conversationId: props.conversation.id
|
||||
}, webSearchParams)
|
||||
|
||||
try {
|
||||
await fetchEventSource('/api/conversation/', {
|
||||
signal: ctrl.signal,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
onopen(response) {
|
||||
if (response.ok && response.headers.get('content-type') === EventStreamContentType) {
|
||||
return;
|
||||
}
|
||||
throw new Error(`Failed to send message. HTTP ${response.status} - ${response.statusText}`);
|
||||
},
|
||||
onclose() {
|
||||
if (ctrl.signal.aborted === true) {
|
||||
return;
|
||||
}
|
||||
throw new Error(`Failed to send message. Server closed the connection unexpectedly.`);
|
||||
},
|
||||
onerror(err) {
|
||||
throw err;
|
||||
},
|
||||
async onmessage(message) {
|
||||
const event = message.event
|
||||
const data = JSON.parse(message.data)
|
||||
|
||||
if (event === 'error') {
|
||||
abortFetch()
|
||||
showSnackbar(data.error)
|
||||
return;
|
||||
}
|
||||
|
||||
if (event === 'userMessageId') {
|
||||
props.conversation.messages[props.conversation.messages.length - 1].id = data.userMessageId
|
||||
return;
|
||||
}
|
||||
|
||||
if (event === 'done') {
|
||||
if (props.conversation.id === null) {
|
||||
props.conversation.id = data.conversationId
|
||||
genTitle(props.conversation.id)
|
||||
}
|
||||
props.conversation.messages[props.conversation.messages.length - 1].id = data.messageId
|
||||
abortFetch()
|
||||
return;
|
||||
}
|
||||
|
||||
messageQueue.push(data.content)
|
||||
processMessageQueue()
|
||||
|
||||
scrollChatWindow()
|
||||
},
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
abortFetch()
|
||||
showSnackbar(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
const grab = ref(null)
|
||||
const scrollChatWindow = () => {
|
||||
if (grab.value === null) {
|
||||
return;
|
||||
}
|
||||
grab.value.scrollIntoView({behavior: 'smooth'})
|
||||
}
|
||||
|
||||
const checkOrAddConversation = () => {
|
||||
if (props.conversation.messages.length === 0) {
|
||||
props.conversation.messages.push({id: null, is_bot: true, message: ''})
|
||||
}
|
||||
}
|
||||
|
||||
const send = (message) => {
|
||||
fetchingResponse.value = true
|
||||
if (props.conversation.messages.length === 0) {
|
||||
addConversation(props.conversation)
|
||||
}
|
||||
props.conversation.messages.push({message: message})
|
||||
fetchReply(message)
|
||||
scrollChatWindow()
|
||||
}
|
||||
const stop = () => {
|
||||
abortFetch()
|
||||
}
|
||||
|
||||
const snackbar = ref(false)
|
||||
const snackbarText = ref('')
|
||||
const showSnackbar = (text) => {
|
||||
snackbarText.value = text
|
||||
snackbar.value = true
|
||||
}
|
||||
|
||||
const editor = ref(null)
|
||||
const usePrompt = (prompt) => {
|
||||
editor.value.usePrompt(prompt)
|
||||
}
|
||||
|
||||
const deleteMessage = (index) => {
|
||||
props.conversation.messages.splice(index, 1)
|
||||
}
|
||||
|
||||
const showWebSearchToggle = ref(false)
|
||||
const enableWebSearch = ref(false)
|
||||
const enableCustomApiKey = ref(false)
|
||||
|
||||
const settings = useSettings()
|
||||
|
||||
watchEffect(() => {
|
||||
if (settings.value) {
|
||||
const settingsValue = toRaw(settings.value)
|
||||
showWebSearchToggle.value = settingsValue.open_web_search && settingsValue.open_web_search === 'True'
|
||||
enableCustomApiKey.value = settingsValue.open_api_key_setting && settingsValue.open_api_key_setting === 'True'
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="conversation.loadingMessages"
|
||||
class="text-center"
|
||||
>
|
||||
<v-progress-circular
|
||||
indeterminate
|
||||
color="primary"
|
||||
></v-progress-circular>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div
|
||||
v-if="conversation.messages.length > 0"
|
||||
ref="chatWindow"
|
||||
>
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col
|
||||
v-for="(message, index) in conversation.messages" :key="index"
|
||||
cols="12"
|
||||
>
|
||||
<div
|
||||
class="d-flex align-center"
|
||||
:class="message.is_bot ? 'justify-start' : 'justify-end'"
|
||||
>
|
||||
<MessageActions
|
||||
v-if="!message.is_bot"
|
||||
:message="message"
|
||||
:message-index="index"
|
||||
:use-prompt="usePrompt"
|
||||
:delete-message="deleteMessage"
|
||||
/>
|
||||
<MsgContent :message="message" />
|
||||
<MessageActions
|
||||
v-if="message.is_bot"
|
||||
:message="message"
|
||||
:message-index="index"
|
||||
:use-prompt="usePrompt"
|
||||
:delete-message="deleteMessage"
|
||||
/>
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
|
||||
<div ref="grab" class="w-100" style="height: 200px;"></div>
|
||||
</div>
|
||||
<Welcome v-if="conversation.id === null && conversation.messages.length === 0" />
|
||||
</div>
|
||||
|
||||
|
||||
<v-footer app>
|
||||
<div class="px-md-16 w-100 d-flex flex-column">
|
||||
<div class="d-flex align-center">
|
||||
<v-btn
|
||||
v-show="fetchingResponse"
|
||||
icon="close"
|
||||
title="stop"
|
||||
class="mr-3"
|
||||
@click="stop"
|
||||
></v-btn>
|
||||
<MsgEditor ref="editor" :send-message="send" :disabled="fetchingResponse" :loading="fetchingResponse" />
|
||||
</div>
|
||||
<v-toolbar
|
||||
density="comfortable"
|
||||
color="transparent"
|
||||
>
|
||||
<Prompt v-show="!fetchingResponse" :use-prompt="usePrompt" />
|
||||
<v-switch
|
||||
v-if="showWebSearchToggle"
|
||||
v-model="enableWebSearch"
|
||||
hide-details
|
||||
color="primary"
|
||||
:label="$t('webSearch')"
|
||||
></v-switch>
|
||||
<v-spacer></v-spacer>
|
||||
</v-toolbar>
|
||||
</div>
|
||||
</v-footer>
|
||||
<v-snackbar
|
||||
v-model="snackbar"
|
||||
multi-line
|
||||
location="top"
|
||||
>
|
||||
{{ snackbarText }}
|
||||
|
||||
<template v-slot:actions>
|
||||
<v-btn
|
||||
color="red"
|
||||
variant="text"
|
||||
@click="snackbar = false"
|
||||
>
|
||||
Close
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
|
||||
</template>
|
||||
98
components/MessageActions.vue
Normal file
98
components/MessageActions.vue
Normal file
@@ -0,0 +1,98 @@
|
||||
<script setup>
|
||||
import copy from 'copy-to-clipboard'
|
||||
|
||||
const props = defineProps({
|
||||
message: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
messageIndex: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
usePrompt: {
|
||||
type: Function,
|
||||
required: true
|
||||
},
|
||||
deleteMessage: {
|
||||
type: Function,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const snackbar = ref(false)
|
||||
const snackbarText = ref('')
|
||||
const showSnackbar = (text) => {
|
||||
snackbarText.value = text
|
||||
snackbar.value = true
|
||||
}
|
||||
|
||||
const copyMessage = () => {
|
||||
copy(props.message.message)
|
||||
showSnackbar('Copied!')
|
||||
}
|
||||
|
||||
const editMessage = () => {
|
||||
props.usePrompt(props.message.message)
|
||||
}
|
||||
|
||||
const deleteMessage = async () => {
|
||||
const { data, error } = await useAuthFetch(`/api/chat/messages/${props.message.id}/`, {
|
||||
method: 'DELETE'
|
||||
})
|
||||
if (!error.value) {
|
||||
props.deleteMessage(props.messageIndex)
|
||||
showSnackbar('Deleted!')
|
||||
}
|
||||
showSnackbar('Delete failed')
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-menu
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn
|
||||
v-bind="props"
|
||||
icon
|
||||
variant="text"
|
||||
class="mx-1"
|
||||
>
|
||||
<v-icon icon="more_horiz"></v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list-item
|
||||
@click="copyMessage()"
|
||||
:title="$t('copy')"
|
||||
prepend-icon="content_copy"
|
||||
>
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
@click="editMessage()"
|
||||
:title="$t('edit')"
|
||||
prepend-icon="edit"
|
||||
>
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
@click="deleteMessage()"
|
||||
:title="$t('delete')"
|
||||
prepend-icon="delete"
|
||||
>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
|
||||
<v-snackbar
|
||||
v-model="snackbar"
|
||||
location="top"
|
||||
timeout="2000"
|
||||
>
|
||||
{{ snackbarText }}
|
||||
</v-snackbar>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
195
components/ModelParameters.vue
Normal file
195
components/ModelParameters.vue
Normal file
@@ -0,0 +1,195 @@
|
||||
<script setup>
|
||||
|
||||
const dialog = ref(false)
|
||||
const currentModel = useCurrentModel()
|
||||
const availableModels = [
|
||||
'gpt-3.5-turbo',
|
||||
'gpt-4'
|
||||
]
|
||||
const currentModelDefault = ref(MODELS[currentModel.value.name])
|
||||
|
||||
watch(currentModel, (newVal, oldVal) => {
|
||||
currentModelDefault.value = MODELS[newVal.name]
|
||||
saveCurrentModel(newVal)
|
||||
}, { deep: true })
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-dialog
|
||||
v-model="dialog"
|
||||
persistent
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-list-item
|
||||
v-bind="props"
|
||||
rounded="xl"
|
||||
prepend-icon="tune"
|
||||
:title="$t('modelParameters')"
|
||||
></v-list-item>
|
||||
</template>
|
||||
<v-card>
|
||||
<v-toolbar
|
||||
density="compact"
|
||||
>
|
||||
<v-toolbar-title>{{ $t('modelParameters') }}</v-toolbar-title>
|
||||
|
||||
<v-spacer></v-spacer>
|
||||
|
||||
<v-btn icon="close" @click="dialog = false"></v-btn>
|
||||
</v-toolbar>
|
||||
<v-card-text>
|
||||
<v-select
|
||||
v-model="currentModel.name"
|
||||
:label="$t('model')"
|
||||
:items="availableModels"
|
||||
variant="underlined"
|
||||
></v-select>
|
||||
|
||||
<v-row
|
||||
no-gutters
|
||||
>
|
||||
<v-col cols="12">
|
||||
<div class="d-flex justify-space-between align-center">
|
||||
<v-list-subheader>{{ $t('temperature') }}</v-list-subheader>
|
||||
<v-text-field
|
||||
v-model="currentModel.temperature"
|
||||
hide-details
|
||||
single-line
|
||||
density="compact"
|
||||
type="number"
|
||||
max="1"
|
||||
step="0.01"
|
||||
style="width: 100px"
|
||||
class="flex-grow-0"
|
||||
></v-text-field>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<v-slider
|
||||
v-model="currentModel.temperature"
|
||||
:max="1"
|
||||
:step="0.01"
|
||||
hide-details
|
||||
>
|
||||
</v-slider>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row
|
||||
no-gutters
|
||||
>
|
||||
<v-col cols="12">
|
||||
<div class="d-flex justify-space-between align-center">
|
||||
<v-list-subheader>{{ $t('maxTokens') }}</v-list-subheader>
|
||||
<v-text-field
|
||||
v-model="currentModel.max_tokens"
|
||||
hide-details
|
||||
single-line
|
||||
density="compact"
|
||||
type="number"
|
||||
:max="currentModelDefault.total_tokens"
|
||||
step="1"
|
||||
style="width: 100px"
|
||||
class="flex-grow-0"
|
||||
></v-text-field>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<v-slider
|
||||
v-model="currentModel.max_tokens"
|
||||
:max="currentModelDefault.total_tokens"
|
||||
:step="1"
|
||||
hide-details
|
||||
>
|
||||
</v-slider>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row
|
||||
no-gutters
|
||||
>
|
||||
<v-col cols="12">
|
||||
<div class="d-flex justify-space-between align-center">
|
||||
<v-list-subheader>{{ $t('topP') }}</v-list-subheader>
|
||||
<v-text-field
|
||||
v-model="currentModel.top_p"
|
||||
hide-details
|
||||
single-line
|
||||
density="compact"
|
||||
type="number"
|
||||
max="1"
|
||||
step="0.01"
|
||||
style="width: 100px"
|
||||
class="flex-grow-0"
|
||||
></v-text-field>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<v-slider
|
||||
v-model="currentModel.top_p"
|
||||
:max="1"
|
||||
:step="0.01"
|
||||
hide-details
|
||||
>
|
||||
</v-slider>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters>
|
||||
<v-col cols="12">
|
||||
<div class="d-flex justify-space-between align-center">
|
||||
<v-list-subheader>{{ $t('frequencyPenalty') }}</v-list-subheader>
|
||||
<v-text-field
|
||||
v-model="currentModel.frequency_penalty"
|
||||
hide-details
|
||||
single-line
|
||||
density="compact"
|
||||
type="number"
|
||||
max="2"
|
||||
step="0.01"
|
||||
style="width: 100px"
|
||||
class="flex-grow-0"
|
||||
></v-text-field>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<v-slider
|
||||
v-model="currentModel.frequency_penalty"
|
||||
:max="2"
|
||||
:step="0.01"
|
||||
hide-details
|
||||
></v-slider>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters>
|
||||
<v-col cols="12">
|
||||
<div class="d-flex justify-space-between align-center">
|
||||
<v-list-subheader>{{ $t('presencePenalty') }}</v-list-subheader>
|
||||
<v-text-field
|
||||
v-model="currentModel.presence_penalty"
|
||||
hide-details
|
||||
single-line
|
||||
density="compact"
|
||||
type="number"
|
||||
max="2"
|
||||
step="0.01"
|
||||
style="width: 100px"
|
||||
class="flex-grow-0"
|
||||
></v-text-field>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<v-slider
|
||||
v-model="currentModel.presence_penalty"
|
||||
:max="2"
|
||||
:step="0.01"
|
||||
hide-details
|
||||
></v-slider>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -12,14 +12,19 @@ const md = new MarkdownIt({
|
||||
},
|
||||
})
|
||||
|
||||
const props = defineProps(['content'])
|
||||
const props = defineProps({
|
||||
message: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const contentHtml = ref('')
|
||||
|
||||
const contentElm = ref(null)
|
||||
|
||||
watchEffect(() => {
|
||||
contentHtml.value = props.content ? md.render(props.content) : ''
|
||||
contentHtml.value = props.message.message ? md.render(props.message.message) : ''
|
||||
})
|
||||
|
||||
const bindCopyCodeToButtons = () => {
|
||||
@@ -54,11 +59,19 @@ onUpdated(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
ref="contentElm"
|
||||
v-html="contentHtml"
|
||||
class="chat-msg-content"
|
||||
></div>
|
||||
<v-card
|
||||
:color="message.is_bot ? '' : 'primary'"
|
||||
rounded="lg"
|
||||
elevation="2"
|
||||
>
|
||||
<v-card-text>
|
||||
<div
|
||||
ref="contentElm"
|
||||
v-html="contentHtml"
|
||||
class="chat-msg-content"
|
||||
></div>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -1,17 +1,29 @@
|
||||
<template>
|
||||
<v-textarea
|
||||
v-model="message"
|
||||
:label="$t('writeAMessage')"
|
||||
:placeholder="hint"
|
||||
rows="1"
|
||||
:auto-grow="autoGrow"
|
||||
:disabled="disabled"
|
||||
:loading="loading"
|
||||
:hide-details="true"
|
||||
append-inner-icon="send"
|
||||
@keyup.enter.exact="enterOnly"
|
||||
@click:appendInner="clickSendBtn"
|
||||
></v-textarea>
|
||||
<div
|
||||
class="flex-grow-1 d-flex align-center justify-space-between"
|
||||
>
|
||||
<v-textarea
|
||||
v-model="message"
|
||||
:label="$t('writeAMessage')"
|
||||
:placeholder="hint"
|
||||
:rows="rows"
|
||||
max-rows="8"
|
||||
:auto-grow="autoGrow"
|
||||
:disabled="disabled"
|
||||
:loading="loading"
|
||||
:hide-details="true"
|
||||
clearable
|
||||
variant="outlined"
|
||||
@keydown.enter.exact="enterOnly"
|
||||
></v-textarea>
|
||||
<v-btn
|
||||
:disabled="loading"
|
||||
icon="send"
|
||||
title="Send"
|
||||
class="ml-3"
|
||||
@click="clickSendBtn"
|
||||
></v-btn>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -39,7 +51,7 @@ export default {
|
||||
message(val) {
|
||||
const lines = val.split(/\r\n|\r|\n/).length;
|
||||
if (lines > 8) {
|
||||
this.rows = lines;
|
||||
this.rows = 8;
|
||||
this.autoGrow = false;
|
||||
} else {
|
||||
this.rows = 1;
|
||||
@@ -65,7 +77,8 @@ export default {
|
||||
clickSendBtn () {
|
||||
this.send()
|
||||
},
|
||||
enterOnly () {
|
||||
enterOnly (event) {
|
||||
event.preventDefault();
|
||||
if (!isMobile()) {
|
||||
this.send()
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
const menu = ref(false)
|
||||
const prompts = ref([])
|
||||
const editingPrompt = ref(null)
|
||||
const newTitlePrompt = ref(null)
|
||||
const newPrompt = ref('')
|
||||
const submittingNewPrompt = ref(false)
|
||||
const promptInputErrorMessage = ref('')
|
||||
@@ -24,11 +25,13 @@ const addPrompt = async () => {
|
||||
const { data, error } = await useAuthFetch('/api/chat/prompts/', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
title: newTitlePrompt.value,
|
||||
prompt: newPrompt.value
|
||||
})
|
||||
})
|
||||
if (!error.value) {
|
||||
prompts.value.push(data.value)
|
||||
newTitlePrompt.value = null
|
||||
newPrompt.value = ''
|
||||
}
|
||||
submittingNewPrompt.value = false
|
||||
@@ -43,6 +46,7 @@ const updatePrompt = async (index) => {
|
||||
const { data, error } = await useAuthFetch(`/api/chat/prompts/${editingPrompt.value.id}/`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({
|
||||
title: editingPrompt.value.title,
|
||||
prompt: editingPrompt.value.prompt
|
||||
})
|
||||
})
|
||||
@@ -96,10 +100,12 @@ onMounted( () => {
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn
|
||||
v-bind="props"
|
||||
icon="speaker_notes"
|
||||
title="Common prompts"
|
||||
class="mr-3"
|
||||
></v-btn>
|
||||
icon
|
||||
>
|
||||
<v-icon
|
||||
icon="speaker_notes"
|
||||
></v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<v-container>
|
||||
@@ -108,7 +114,7 @@ onMounted( () => {
|
||||
max-width="500"
|
||||
>
|
||||
<v-card-title>
|
||||
<span class="headline">Frequently prompts</span>
|
||||
<span class="headline">{{ $t('frequentlyPrompts') }}</span>
|
||||
</v-card-title>
|
||||
|
||||
<v-divider></v-divider>
|
||||
@@ -125,35 +131,47 @@ onMounted( () => {
|
||||
>
|
||||
<v-list-item
|
||||
active-color="primary"
|
||||
rounded="xl"
|
||||
v-if="editingPrompt && editingPrompt.id === prompt.id"
|
||||
>
|
||||
<v-textarea
|
||||
rows="2"
|
||||
v-model="editingPrompt.prompt"
|
||||
:loading="editingPrompt.updating"
|
||||
variant="underlined"
|
||||
hide-details
|
||||
density="compact"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<div class="d-flex flex-column">
|
||||
<v-btn
|
||||
icon="done"
|
||||
variant="text"
|
||||
:loading="editingPrompt.updating"
|
||||
@click="updatePrompt(idx)"
|
||||
>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
icon="close"
|
||||
variant="text"
|
||||
@click="cancelEditPrompt()"
|
||||
>
|
||||
</v-btn>
|
||||
</div>
|
||||
</template>
|
||||
</v-textarea>
|
||||
<div class="d-flex flex-row" :style="{ marginTop: '5px' }">
|
||||
<div class="flex-grow-1">
|
||||
<v-text-field
|
||||
v-model="editingPrompt.title"
|
||||
:loading="editingPrompt.updating"
|
||||
:label="$t('titlePrompt')"
|
||||
variant="underlined"
|
||||
density="compact"
|
||||
hide-details
|
||||
>
|
||||
</v-text-field>
|
||||
<v-textarea
|
||||
rows="2"
|
||||
v-model="editingPrompt.prompt"
|
||||
:loading="editingPrompt.updating"
|
||||
variant="underlined"
|
||||
density="compact"
|
||||
hide-details
|
||||
>
|
||||
</v-textarea>
|
||||
</div>
|
||||
<div>
|
||||
<div class="d-flex flex-column">
|
||||
<v-btn
|
||||
icon="done"
|
||||
variant="text"
|
||||
:loading="editingPrompt.updating"
|
||||
@click="updatePrompt(idx)"
|
||||
>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
icon="close"
|
||||
variant="text"
|
||||
@click="cancelEditPrompt()"
|
||||
>
|
||||
</v-btn>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
v-if="!editingPrompt || editingPrompt.id !== prompt.id"
|
||||
@@ -161,7 +179,7 @@ onMounted( () => {
|
||||
active-color="primary"
|
||||
@click="selectPrompt(prompt)"
|
||||
>
|
||||
<v-list-item-title>{{ prompt.prompt }}</v-list-item-title>
|
||||
<v-list-item-title>{{ prompt.title ? prompt.title : prompt.prompt }}</v-list-item-title>
|
||||
<template v-slot:append>
|
||||
<v-btn
|
||||
icon="edit"
|
||||
@@ -182,6 +200,25 @@ onMounted( () => {
|
||||
</v-list-item>
|
||||
</template>
|
||||
|
||||
<v-list-item
|
||||
active-color="primary"
|
||||
>
|
||||
<div
|
||||
class="pt-3"
|
||||
>
|
||||
<v-text-field
|
||||
rows="1"
|
||||
v-model="newTitlePrompt"
|
||||
:label="$t('titlePrompt')"
|
||||
variant="outlined"
|
||||
density="compact"
|
||||
hide-details
|
||||
clearable
|
||||
>
|
||||
</v-text-field>
|
||||
</div>
|
||||
</v-list-item>
|
||||
|
||||
<v-list-item
|
||||
active-color="primary"
|
||||
>
|
||||
@@ -191,7 +228,7 @@ onMounted( () => {
|
||||
<v-textarea
|
||||
rows="2"
|
||||
v-model="newPrompt"
|
||||
label="Add a new prompt"
|
||||
:label="$t('addNewPrompt')"
|
||||
variant="outlined"
|
||||
density="compact"
|
||||
:error-messages="promptInputErrorMessage"
|
||||
@@ -209,7 +246,7 @@ onMounted( () => {
|
||||
@click="addPrompt()"
|
||||
>
|
||||
<v-icon icon="add"></v-icon>
|
||||
Add prompt
|
||||
{{ $t('addPrompt') }}
|
||||
</v-btn>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
|
||||
@@ -15,26 +15,23 @@
|
||||
</template>
|
||||
<v-card>
|
||||
<v-toolbar
|
||||
dark
|
||||
color="primary"
|
||||
>
|
||||
<v-btn
|
||||
icon
|
||||
dark
|
||||
@click="dialog = false"
|
||||
>
|
||||
<v-icon>close</v-icon>
|
||||
<v-icon icon="close"></v-icon>
|
||||
</v-btn>
|
||||
<v-toolbar-title>{{ $t('language') }}</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<!-- <v-toolbar-items>-->
|
||||
<!-- <v-btn-->
|
||||
<!-- variant="text"-->
|
||||
<!-- @click="dialog = false"-->
|
||||
<!-- >-->
|
||||
<!-- Save-->
|
||||
<!-- </v-btn>-->
|
||||
<!-- </v-toolbar-items>-->
|
||||
<v-toolbar-items>
|
||||
<v-btn
|
||||
variant="text"
|
||||
@click="dialog = false"
|
||||
>
|
||||
Save
|
||||
</v-btn>
|
||||
</v-toolbar-items>
|
||||
</v-toolbar>
|
||||
<v-list
|
||||
>
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
|
||||
export const useModels = () => useState('models', () => getStoredModels())
|
||||
// export const useModels = () => useState('models', () => getStoredModels())
|
||||
|
||||
export const useCurrentModel = () => useState('currentModel', () => getCurrentModel())
|
||||
|
||||
export const useApiKey = () => useState('apiKey', () => getStoredApiKey())
|
||||
|
||||
export const useConversion = () => useState('conversion', () => getDefaultConversionData())
|
||||
export const useConversation = () => useState('conversation', () => getDefaultConversationData())
|
||||
|
||||
export const useConversions = () => useState('conversions', () => [])
|
||||
export const useConversations = () => useState('conversations', () => [])
|
||||
|
||||
export const useSettings = () => useState('settings', () => {})
|
||||
BIN
demos/bmc_qr.png
Normal file
BIN
demos/bmc_qr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
BIN
demos/demo.mp4
Normal file
BIN
demos/demo.mp4
Normal file
Binary file not shown.
@@ -1,6 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
read -p "Please enter a resolved domain name: " domain
|
||||
read -p "Please enter a domain name or external IP address [default: localhost]: " APP_DOMAIN
|
||||
|
||||
if [ -z "$APP_DOMAIN" ]; then
|
||||
APP_DOMAIN="localhost"
|
||||
fi
|
||||
|
||||
read -p "Please set a port for the frontend server [default: 80]: " CLIENT_PORT
|
||||
|
||||
if [ -z "$CLIENT_PORT" ]; then
|
||||
CLIENT_PORT="80"
|
||||
fi
|
||||
|
||||
read -p "Please set a port for the backend server [default: 9000]: " SERVER_PORT
|
||||
|
||||
if [ -z "$SERVER_PORT" ]; then
|
||||
SERVER_PORT="9000"
|
||||
fi
|
||||
|
||||
read -p "Please set a port for the backend WSGI server [default: 8000]: " WSGI_PORT
|
||||
|
||||
if [ -z "$WSGI_PORT" ]; then
|
||||
WSGI_PORT="8000"
|
||||
fi
|
||||
|
||||
if [[ $(which docker) ]]; then
|
||||
echo "Docker is already installed"
|
||||
@@ -43,6 +65,6 @@ sudo curl -L "https://raw.githubusercontent.com/WongSaang/chatgpt-ui/main/docker
|
||||
|
||||
echo "Starting services..."
|
||||
|
||||
sudo APP_DOMAIN="${domain}:9000" docker-compose up -d
|
||||
sudo APP_DOMAIN="${APP_DOMAIN}:${SERVER_PORT}" CLIENT_PORT=${CLIENT_PORT} SERVER_PORT=${SERVER_PORT} WSGI_PORT=${WSGI_PORT} docker-compose up --pull always -d
|
||||
|
||||
echo "Done"
|
||||
16
docker-compose.dev.yml
Normal file
16
docker-compose.dev.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
version: '3'
|
||||
services:
|
||||
client:
|
||||
platform: linux/x86_64
|
||||
build: .
|
||||
environment:
|
||||
SERVER_DOMAIN: http://web-server
|
||||
ports:
|
||||
- '${CLIENT_PORT:-8080}:80'
|
||||
networks:
|
||||
- chatgpt_network
|
||||
restart: always
|
||||
|
||||
networks:
|
||||
chatgpt_network:
|
||||
external: True
|
||||
@@ -1,46 +1,52 @@
|
||||
version: '3'
|
||||
services:
|
||||
client:
|
||||
platform: linux/x86_64
|
||||
image: wongsaang/chatgpt-ui-client:latest
|
||||
environment:
|
||||
- SERVER_DOMAIN=http://backend-web-server
|
||||
- NUXT_PUBLIC_APP_NAME='ChatGPT UI'
|
||||
- NUXT_PUBLIC_TYPEWRITER=true
|
||||
- NUXT_PUBLIC_TYPEWRITER_DELAY=100
|
||||
depends_on:
|
||||
- backend-web-server
|
||||
ports:
|
||||
- '80:80'
|
||||
- '${CLIENT_PORT:-80}:80'
|
||||
networks:
|
||||
- chatgpt_ui_network
|
||||
restart: always
|
||||
backend-wsgi-server:
|
||||
platform: linux/x86_64
|
||||
image: wongsaang/chatgpt-ui-wsgi-server:latest
|
||||
environment:
|
||||
- APP_DOMAIN=${APP_DOMAIN:-localhost:9000}
|
||||
- SERVER_WORKERS=3 # The number of worker processes for handling requests.
|
||||
# - DB_URL=postgres://postgres:postgrespw@localhost:49153/chatgpt # If this parameter is not set, the built-in Sqlite will be used by default. It should be noted that if you do not connect to an external database, the data will be lost after the container is destroyed.
|
||||
- DJANGO_SUPERUSER_USERNAME=admin # default superuser name
|
||||
- DJANGO_SUPERUSER_PASSWORD=password # default superuser password
|
||||
- DJANGO_SUPERUSER_EMAIL=admin@example.com # default superuser email
|
||||
- ACCOUNT_EMAIL_VERIFICATION=${ACCOUNT_EMAIL_VERIFICATION:-none} # Determines the e-mail verification method during signup – choose one of "none", "optional", or "mandatory". Default is "optional". If you don't need to verify the email, you can set it to "none".
|
||||
# If you want to use the email verification function, you need to configure the following parameters
|
||||
# - EMAIL_HOST=SMTP server address
|
||||
# - EMAIL_PORT=SMTP server port
|
||||
# - EMAIL_HOST_USER=
|
||||
# - EMAIL_HOST_PASSWORD=
|
||||
# - EMAIL_USE_TLS=True
|
||||
# - EMAIL_FROM=no-reply@example.com #Default sender email address
|
||||
ports:
|
||||
- '8000:8000'
|
||||
- '${WSGI_PORT:-8000}:8000'
|
||||
networks:
|
||||
- chatgpt_ui_network
|
||||
restart: always
|
||||
backend-web-server:
|
||||
platform: linux/x86_64
|
||||
image: wongsaang/chatgpt-ui-web-server:latest
|
||||
environment:
|
||||
- BACKEND_URL=http://backend-wsgi-server:8000
|
||||
ports:
|
||||
- '9000:80'
|
||||
- '${SERVER_PORT:-9000}:80'
|
||||
depends_on:
|
||||
- backend-wsgi-server
|
||||
networks:
|
||||
- chatgpt_ui_network
|
||||
restart: always
|
||||
|
||||
networks:
|
||||
chatgpt_ui_network:
|
||||
|
||||
@@ -1,25 +1,35 @@
|
||||
<p align="center">
|
||||
<img alt="demo" src="../../demos/demo.gif?v=1">
|
||||
</p>
|
||||
<div align="center">
|
||||
<h1>ChatGPT UI</h1>
|
||||
</div>
|
||||
|
||||
[English](../../README.md) | [中文](./docs/zh/README.md)
|
||||
|
||||
# ChatGPT UI
|
||||
|
||||
ChatGPT Web 客户端,支持多用户,支持 Mysql、PostgreSQL 等多种数据库连接进行数据持久化存储,支持多语言。提供 Docker 镜像和快速部署脚本。
|
||||
|
||||
https://user-images.githubusercontent.com/46235412/227156264-ca17ab17-999b-414f-ab06-3f75b5235bfe.mp4
|
||||
|
||||
|
||||
## 📢 更新
|
||||
|
||||
<details open>
|
||||
<summary><strong>2023-03-10</strong></summary>
|
||||
|
||||
增加 2 个环境变量来控制打字机效果, 详见下方 docker-compose 配置的环境变量说明
|
||||
|
||||
- `NUXT_PUBLIC_TYPEWRITER` 是否开启打字机效果
|
||||
- `NUXT_PUBLIC_TYPEWRITER_DELAY` 每个字的延迟时间,单位:毫秒
|
||||
|
||||
<summary><strong>2023-03-27</strong></summary>
|
||||
🚀 支持 gpt-4 模型。你可以在前端的“模型参数”中选择模型,gpt-4 模型需要通过 openai 的白名单才能使用。
|
||||
</details>
|
||||
|
||||
<details open>
|
||||
<summary><strong>2023-03-23</strong></summary>
|
||||
增加网页搜索能力,使得 ChatGPT 生成的回答更与时俱进!
|
||||
该功能默认处于关闭状态,你可以在管理后台的 `Chat->Settings` 中开启它,在 Settings 中有一个 `open_web_search` 的记录,把它的值设置为 True。
|
||||
</details>
|
||||
|
||||
<details open>
|
||||
<summary><strong>2023-03-15</strong></summary>
|
||||
|
||||
在管理后台增加 `open_registration` 设置项,用于控制是否开放用户注册。你可以登录管理后台,在 `Chat->Setting` 中看到这个设置项,默认是 `True` (允许用户注册),如果不需要,请改成 `False`。
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>2023-03-04</strong></summary>
|
||||
|
||||
**使用最新的官方聊天模型** `gpt-3.5-turbo`
|
||||
@@ -81,9 +91,6 @@ services:
|
||||
image: wongsaang/chatgpt-ui-client:latest
|
||||
environment:
|
||||
- SERVER_DOMAIN=http://backend-web-server
|
||||
- NUXT_PUBLIC_APP_NAME='ChatGPT UI' # App 名称,默认为 ChatGPT UI
|
||||
- NUXT_PUBLIC_TYPEWRITER=true # 是否启用打字机效果,默认关闭
|
||||
- NUXT_PUBLIC_TYPEWRITER_DELAY=100 # 打字机效果的延迟时间,默认 50毫秒
|
||||
depends_on:
|
||||
- backend-web-server
|
||||
ports:
|
||||
@@ -94,17 +101,20 @@ services:
|
||||
image: wongsaang/chatgpt-ui-wsgi-server:latest
|
||||
environment:
|
||||
- APP_DOMAIN=${APP_DOMAIN:-localhost:9000} # CSRF 白名单,在这里设置为 chatgpt-ui-web-server 的地址+端口, 默认: localhost:9000
|
||||
- SERVER_WORKERS=3 # gunicorn 的工作进程数,默认为 3
|
||||
#- DB_URL=postgres://postgres:postgrespw@localhost:49153/chatgpt # 连接外部数据库,如果不设置这个参数,则默认使用内置的 Sqlite。需要注意的是,如果不连接外部数据库,数据将在容器销毁后丢失。链接格式请看下面的 DB_URL 格式对照表
|
||||
#- OPENAI_API_PROXY=https://openai.proxy.com/v1 # https://api.openai.com/v1 的代理地址
|
||||
- DJANGO_SUPERUSER_USERNAME=admin # 默认超级用户
|
||||
- DJANGO_SUPERUSER_PASSWORD=password # 默认超级用户的密码
|
||||
- DJANGO_SUPERUSER_EMAIL=admin@example.com # 默认超级用户邮箱
|
||||
- ACCOUNT_EMAIL_VERIFICATION=none # 邮箱验证方式,可选值: none, optional, mandatory. 默认为 optional。如果你不需要验证用户的邮箱,可以设置为 none。
|
||||
# 如果您想使用电子邮件验证功能,需要配置以下参数:
|
||||
# - EMAIL_HOST=SMTP server address
|
||||
# - EMAIL_PORT=SMTP server port
|
||||
# - EMAIL_HOST_USER=
|
||||
# - EMAIL_HOST_PASSWORD=
|
||||
# - EMAIL_USE_TLS=True
|
||||
# - EMAIL_FROM=no-reply@example.com #默认发件邮箱地址
|
||||
ports:
|
||||
- '8000:8000'
|
||||
networks:
|
||||
@@ -146,6 +156,16 @@ networks:
|
||||
现在可以访问客户端地址 `http(s)://your.domain` / `http://123.123.123.123` 开始聊天。
|
||||
|
||||
|
||||
## 续杯咖啡
|
||||
|
||||
> 如果对您有帮助,也是在帮助我自己.
|
||||
|
||||
如果你想支持我,给我续杯咖啡吧 ❤️ [https://www.buymeacoffee.com/WongSaang](https://www.buymeacoffee.com/WongSaang)
|
||||
|
||||
<p align="center">
|
||||
<img height="150" src="https://github.com/WongSaang/chatgpt-ui/blob/main/demos/bmc_qr.png?raw=true"/>
|
||||
</p>
|
||||
|
||||
## Development
|
||||
|
||||
### Setup
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
"saveAndClose": "Save & Close",
|
||||
"pleaseSelectAtLeastOneModelDot": "Please select at least one model.",
|
||||
"writeAMessage": "Write a message",
|
||||
"frequentlyPrompts": "Frequently prompts",
|
||||
"addPrompt": "Add prompt",
|
||||
"titlePrompt": "Title",
|
||||
"addNewPrompt": "Add a new prompt",
|
||||
"pressEnterToSendYourMessageOrShiftEnterToAddANewLine": "Press Enter to send your message or Shift+Enter to add a new line",
|
||||
"lightMode": "Light Mode",
|
||||
"darkMode": "Dark Mode",
|
||||
@@ -17,11 +21,35 @@
|
||||
"themeMode": "Theme Mode",
|
||||
"feedback": "Feedback",
|
||||
"newConversation": "New conversation",
|
||||
"defaultConversationTitle": "Unnamed",
|
||||
"clearConversations": "Clear conversations",
|
||||
"modelParameters": "Model Parameters",
|
||||
"model": "Model",
|
||||
"temperature": "Temperature",
|
||||
"topP": "Top P",
|
||||
"frequencyPenalty": "Frequency Penalty",
|
||||
"presencePenalty": "Presence Penalty",
|
||||
"maxTokens": "Max Tokens",
|
||||
"roles": {
|
||||
"me": "Me",
|
||||
"ai": "AI"
|
||||
},
|
||||
"edit": "Edit",
|
||||
"copy": "Copy",
|
||||
"copied": "Copied",
|
||||
"delete": "Delete",
|
||||
"signOut": "Sign out",
|
||||
"resetPassword": "Reset password",
|
||||
"submit": "Submit",
|
||||
"agree": "Agree",
|
||||
"newPassword": "New password",
|
||||
"currentPassword": "Current password",
|
||||
"confirmPassword": "Confirm password",
|
||||
"yourPasswordHasBeenReset": "Your password has been reset",
|
||||
"nowYouNeedToSignInAgain": "Now you need to sign in again",
|
||||
"webSearch": "Web Search",
|
||||
"webSearchDefaultPrompt": "Web search results:\n\n[web_results]\nCurrent date: [current_date]\n\nInstructions: Using the provided web search results, write a comprehensive reply to the given query. Make sure to cite results using [[number](URL)] notation after the reference. If the provided search results refer to multiple subjects with the same name, write separate answers for each subject.\nQuery: [query]",
|
||||
"genTitlePrompt": "Generate a short title for the following content, no more than 10 words. \n\nContent: ",
|
||||
"welcomeScreen": {
|
||||
"introduction1": "is an unofficial client for ChatGPT, but uses the official OpenAI API.",
|
||||
"introduction2": "You will need an OpenAI API Key before you can use this client.",
|
||||
|
||||
75
lang/ru-RU.json
Normal file
75
lang/ru-RU.json
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"welcomeTo": "Добро пожаловать в",
|
||||
"language": "Язык",
|
||||
"setApiKey": "Установить ключ API",
|
||||
"setOpenAIApiKey": "Установить ключ API OpenAI",
|
||||
"openAIApiKey": "Ключ API OpenAI",
|
||||
"getAKey": "Получить ключ",
|
||||
"openAIModels": "Модели OpenAI",
|
||||
"aboutTheModels": "О моделях",
|
||||
"saveAndClose": "Сохранить & Закрыть",
|
||||
"pleaseSelectAtLeastOneModelDot": "Выберите хотя бы одну модель.",
|
||||
"writeAMessage": "Напишите сообщение",
|
||||
"frequentlyPrompts": "Список подсказок",
|
||||
"addPrompt": "Добавить подсказку",
|
||||
"titlePrompt": "Заголовок",
|
||||
"addNewPrompt": "Добавитьте новую подсказку",
|
||||
"pressEnterToSendYourMessageOrShiftEnterToAddANewLine": "Нажмите Enter, чтобы отправить сообщение, или Shift+Enter, чтобы добавить новую строку.",
|
||||
"lightMode": "Светлая",
|
||||
"darkMode": "Темная",
|
||||
"followSystem": "Системная",
|
||||
"themeMode": "Тема",
|
||||
"feedback": "Обратная связь",
|
||||
"newConversation": "Новый чат",
|
||||
"defaultConversationTitle": "Безымянный",
|
||||
"clearConversations": "Очистить чаты",
|
||||
"modelParameters": "Параметры модели",
|
||||
"model": "Модель",
|
||||
"temperature": "Temperature",
|
||||
"topP": "Top P",
|
||||
"frequencyPenalty": "Frequency Penalty",
|
||||
"presencePenalty": "Presence Penalty",
|
||||
"maxTokens": "Max Tokens",
|
||||
"roles": {
|
||||
"me": "Я",
|
||||
"ai": "AI"
|
||||
},
|
||||
"edit": "Редактировать",
|
||||
"copy": "Копировать",
|
||||
"copied": "Скопировано",
|
||||
"delete": "Удалить",
|
||||
"signOut": "Выход",
|
||||
"resetPassword": "Сбросить пароль",
|
||||
"submit": "Отправить",
|
||||
"agree": "Согласен",
|
||||
"newPassword": "Новый пароль",
|
||||
"currentPassword": "Текущий пароль",
|
||||
"confirmPassword": "Подтвердите пароль",
|
||||
"yourPasswordHasBeenReset": "Ваш пароль был сброшен",
|
||||
"nowYouNeedToSignInAgain": "Теперь вам нужно снова войти в систему",
|
||||
"webSearch": "Поиск в интернете",
|
||||
"webSearchDefaultPrompt": "Результаты веб-поиска:\n\n[web_results]\nТекущая дата: [current_date]\n\nИнструкции: Используя предоставленные результаты веб-поиска, напишите развернутый ответ на заданный запрос. Обязательно цитируйте результаты, используя обозначение [[number](URL)] после ссылки. Если предоставленные результаты поиска относятся к нескольким темам с одинаковым названием, напишите отдельные ответы для каждой темы.\nЗапрос: [query]",
|
||||
"genTitlePrompt": "Придумайте короткий заголовок для следующего содержания, не более 10 слов. \n\nСодержание: ",
|
||||
"welcomeScreen": {
|
||||
"introduction1": "является неофициальным клиентом для ChatGPT, но использует официальный API OpenAI.",
|
||||
"introduction2": "Вам понадобится ключ API OpenAI, прежде чем вы сможете использовать этот клиент.",
|
||||
"examples": {
|
||||
"title": "Примеры",
|
||||
"item1": "\"Объясни, что такое квантовые вычисления простыми словами\"",
|
||||
"item2": "\"Предложи несколько креативных идей для дня рождения 10-летнего ребенка?\"",
|
||||
"item3": "\"Как сделать HTTP-запрос в Javascript?\""
|
||||
},
|
||||
"capabilities": {
|
||||
"title": "Возможности",
|
||||
"item1": "Помнит, что пользователь сказал ранее в разговоре",
|
||||
"item2": "Позволяет пользователю вносить последующие исправления",
|
||||
"item3": "Научен отклонять неуместные запросы"
|
||||
},
|
||||
"limitations": {
|
||||
"title": "Ограничения",
|
||||
"item1": "Иногда может генерировать неверную информацию",
|
||||
"item2": "Иногда может создавать вредные инструкции или предвзятый контент",
|
||||
"item3": "Ограниченное знание мира и событий после 2021 года"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,10 @@
|
||||
"saveAndClose": "保存并关闭",
|
||||
"pleaseSelectAtLeastOneModelDot": "请至少选择一个模型",
|
||||
"writeAMessage": "输入信息",
|
||||
"frequentlyPrompts": "Frequently prompts",
|
||||
"addPrompt": "Add prompt",
|
||||
"titlePrompt": "Title",
|
||||
"addNewPrompt": "Add a new prompt",
|
||||
"pressEnterToSendYourMessageOrShiftEnterToAddANewLine": "按回车键发送您的信息,或按Shift+Enter键添加新行",
|
||||
"lightMode": "明亮模式",
|
||||
"darkMode": "暗色模式",
|
||||
@@ -17,11 +21,35 @@
|
||||
"themeMode": "主题模式",
|
||||
"feedback": "反馈",
|
||||
"newConversation": "新的对话",
|
||||
"defaultConversationTitle": "未命名",
|
||||
"clearConversations": "清除对话",
|
||||
"modelParameters": "模型参数",
|
||||
"model": "模型",
|
||||
"temperature": "Temperature",
|
||||
"topP": "Top P",
|
||||
"frequencyPenalty": "Frequency Penalty",
|
||||
"presencePenalty": "Presence Penalty",
|
||||
"maxTokens": "Max Tokens",
|
||||
"roles": {
|
||||
"me": "我",
|
||||
"ai": "AI"
|
||||
},
|
||||
"edit": "编辑",
|
||||
"copy": "复制",
|
||||
"copied": "已复制",
|
||||
"delete": "删除",
|
||||
"signOut": "退出登录",
|
||||
"resetPassword": "重置密码",
|
||||
"submit": "提交",
|
||||
"agree": "同意",
|
||||
"newPassword": "新密码",
|
||||
"currentPassword": "当前密码",
|
||||
"confirmPassword": "确认密码",
|
||||
"yourPasswordHasBeenReset": "您的密码已重置",
|
||||
"nowYouNeedToSignInAgain": "现在您需要再次登录",
|
||||
"webSearch": "网页搜索",
|
||||
"webSearchDefaultPrompt": "网络搜索结果:\n\n[web_results]\n当前日期:[current_date]\n\n说明:使用提供的网络搜索结果,对给定的查询写出全面的回复。确保在引用参考文献后使用 [[number](URL)] 符号进行引用结果. 如果提供的搜索结果涉及到多个具有相同名称的主题,请针对每个主题编写单独的答案。\n查询:[query]",
|
||||
"genTitlePrompt": "为以下内容生成一个不超过10个字的简短标题。 \n\n内容: ",
|
||||
"welcomeScreen": {
|
||||
"introduction1": "是一个非官方的ChatGPT客户端,但使用OpenAI的官方API",
|
||||
"introduction2": "在使用本客户端之前,您需要一个OpenAI API密钥。",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup>
|
||||
import {useDisplay} from "vuetify";
|
||||
|
||||
const { $i18n } = useNuxtApp()
|
||||
const { $i18n, $auth } = useNuxtApp()
|
||||
const runtimeConfig = useRuntimeConfig()
|
||||
const colorMode = useColorMode()
|
||||
const drawer = ref(null)
|
||||
@@ -22,8 +22,8 @@ const setLang = (lang) => {
|
||||
setLocale(lang)
|
||||
}
|
||||
|
||||
const conversations = useConversions()
|
||||
const currentConversation = useConversion()
|
||||
const conversations = useConversations()
|
||||
const currentConversation = useConversation()
|
||||
|
||||
const editingConversation = ref(null)
|
||||
const deletingConversationIndex = ref(null)
|
||||
@@ -54,7 +54,7 @@ const deleteConversation = async (index) => {
|
||||
deletingConversationIndex.value = null
|
||||
if (!error.value) {
|
||||
if (conversations.value[index].id === currentConversation.value.id) {
|
||||
createNewConversion()
|
||||
createNewConversation()
|
||||
}
|
||||
conversations.value.splice(index, 1)
|
||||
}
|
||||
@@ -78,18 +78,38 @@ const loadingConversations = ref(false)
|
||||
|
||||
const loadConversations = async () => {
|
||||
loadingConversations.value = true
|
||||
conversations.value = await getConversions()
|
||||
conversations.value = await getConversations()
|
||||
loadingConversations.value = false
|
||||
}
|
||||
|
||||
const {mdAndUp} = useDisplay()
|
||||
|
||||
|
||||
const drawerPermanent = computed(() => {
|
||||
return mdAndUp.value
|
||||
})
|
||||
|
||||
onNuxtReady(async () => {
|
||||
const signOut = async () => {
|
||||
const { data, error } = await useFetch('/api/account/logout/', {
|
||||
method: 'POST'
|
||||
})
|
||||
if (!error.value) {
|
||||
await $auth.logout()
|
||||
}
|
||||
}
|
||||
|
||||
const settings = useSettings()
|
||||
const showApiKeySetting = ref(false)
|
||||
watchEffect(() => {
|
||||
if (settings.value) {
|
||||
const settingsValue = toRaw(settings.value)
|
||||
showApiKeySetting.value = settingsValue.open_api_key_setting && settingsValue.open_api_key_setting === 'True'
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
loadConversations()
|
||||
loadSettings()
|
||||
})
|
||||
|
||||
</script>
|
||||
@@ -103,19 +123,53 @@ onNuxtReady(async () => {
|
||||
:permanent="drawerPermanent"
|
||||
width="300"
|
||||
>
|
||||
<div class="px-2 py-2">
|
||||
<template
|
||||
v-slot:prepend
|
||||
>
|
||||
<v-list>
|
||||
<v-list-item>
|
||||
<v-btn
|
||||
block
|
||||
variant="outlined"
|
||||
prepend-icon="add"
|
||||
@click="createNewConversion()"
|
||||
class="text-none"
|
||||
>
|
||||
{{ $t('newConversation') }}
|
||||
</v-btn>
|
||||
<v-list-item
|
||||
:title="$auth.user.username"
|
||||
:subtitle="$auth.user.email"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<v-icon
|
||||
icon="face"
|
||||
size="x-large"
|
||||
></v-icon>
|
||||
</template>
|
||||
<template v-slot:append>
|
||||
<v-menu>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn
|
||||
v-bind="props"
|
||||
size="small"
|
||||
variant="text"
|
||||
icon="expand_more"
|
||||
></v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list-item
|
||||
:title="$t('resetPassword')"
|
||||
to="/account/resetPassword"
|
||||
>
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
:title="$t('signOut')"
|
||||
@click="signOut"
|
||||
>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
|
||||
</template>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
|
||||
<v-divider></v-divider>
|
||||
</template>
|
||||
|
||||
<div class="px-2">
|
||||
<v-list>
|
||||
<v-list-item v-show="loadingConversations">
|
||||
<v-list-item-title class="d-flex justify-center">
|
||||
<v-progress-circular indeterminate></v-progress-circular>
|
||||
@@ -152,19 +206,19 @@ onNuxtReady(async () => {
|
||||
<v-list-item
|
||||
rounded="xl"
|
||||
active-color="primary"
|
||||
@click="openConversationMessages(conversation)"
|
||||
:to="conversation.id ? `/${conversation.id}` : undefined"
|
||||
v-bind="props"
|
||||
>
|
||||
<v-list-item-title>{{ conversation.topic }}</v-list-item-title>
|
||||
<v-list-item-title>{{ conversation.topic !== "" ? conversation.topic : $t('defaultConversationTitle') }}</v-list-item-title>
|
||||
<template v-slot:append>
|
||||
<div
|
||||
v-show="isHovering"
|
||||
v-show="isHovering && conversation.id"
|
||||
>
|
||||
<v-btn
|
||||
icon="edit"
|
||||
size="small"
|
||||
variant="text"
|
||||
@click.stop="editConversation(cIdx)"
|
||||
@click.prevent="editConversation(cIdx)"
|
||||
>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
@@ -172,7 +226,7 @@ onNuxtReady(async () => {
|
||||
size="small"
|
||||
variant="text"
|
||||
:loading="deletingConversationIndex === cIdx"
|
||||
@click.stop="deleteConversation(cIdx)"
|
||||
@click.prevent="deleteConversation(cIdx)"
|
||||
>
|
||||
</v-btn>
|
||||
</div>
|
||||
@@ -228,6 +282,12 @@ onNuxtReady(async () => {
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<ApiKeyDialog
|
||||
v-if="showApiKeySetting"
|
||||
/>
|
||||
|
||||
<ModelParameters/>
|
||||
|
||||
<v-menu
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
@@ -259,49 +319,41 @@ onNuxtReady(async () => {
|
||||
:title="$t('feedback')"
|
||||
@click="feedback"
|
||||
></v-list-item>
|
||||
|
||||
</v-list>
|
||||
</div>
|
||||
</template>
|
||||
</v-navigation-drawer>
|
||||
|
||||
<v-app-bar
|
||||
class="d-md-none"
|
||||
class=""
|
||||
>
|
||||
<v-app-bar-nav-icon @click="drawer = !drawer"></v-app-bar-nav-icon>
|
||||
|
||||
<v-toolbar-title>{{ runtimeConfig.public.appName }}</v-toolbar-title>
|
||||
<v-toolbar-title>{{ currentConversation.id ? currentConversation.topic : runtimeConfig.public.appName }}</v-toolbar-title>
|
||||
|
||||
<v-spacer></v-spacer>
|
||||
|
||||
<v-btn
|
||||
:title="$t('newConversation')"
|
||||
icon="add"
|
||||
@click="createNewConversion()"
|
||||
@click="createNewConversation"
|
||||
class="d-md-none"
|
||||
></v-btn>
|
||||
<v-btn
|
||||
variant="outlined"
|
||||
class="text-none d-none d-md-block"
|
||||
@click="createNewConversation"
|
||||
>
|
||||
{{ $t('newConversation') }}
|
||||
</v-btn>
|
||||
|
||||
<!-- <v-menu-->
|
||||
<!-- >-->
|
||||
<!-- <template v-slot:activator="{ props }">-->
|
||||
<!-- <v-btn-->
|
||||
<!-- v-bind="props"-->
|
||||
<!-- icon="help_outline"-->
|
||||
<!-- title="Feedback"-->
|
||||
<!-- ></v-btn>-->
|
||||
<!-- </template>-->
|
||||
<!-- <v-list-->
|
||||
<!-- >-->
|
||||
<!-- <v-list-item-->
|
||||
<!-- @click="feedback"-->
|
||||
<!-- >-->
|
||||
<!-- <v-list-item-title>{{ $t('feedback') }}</v-list-item-title>-->
|
||||
<!-- </v-list-item>-->
|
||||
<!-- </v-list>-->
|
||||
<!-- </v-menu>-->
|
||||
</v-app-bar>
|
||||
|
||||
<v-main>
|
||||
<NuxtPage/>
|
||||
</v-main>
|
||||
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
@@ -316,4 +368,5 @@ onNuxtReady(async () => {
|
||||
background-color: #999;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,5 +1,5 @@
|
||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||
const appName = 'ChatGPT UI'
|
||||
const appName = process.env.NUXT_PUBLIC_APP_NAME ?? 'ChatGPT UI'
|
||||
|
||||
export default defineNuxtConfig({
|
||||
dev: false,
|
||||
@@ -14,6 +14,7 @@ export default defineNuxtConfig({
|
||||
appName: appName,
|
||||
typewriter: false,
|
||||
typewriterDelay: 50,
|
||||
customApiKey: false
|
||||
}
|
||||
},
|
||||
build: {
|
||||
@@ -25,9 +26,20 @@ export default defineNuxtConfig({
|
||||
'highlight.js/styles/panda-syntax-dark.css',
|
||||
],
|
||||
modules: [
|
||||
'@kevinmarrec/nuxt-pwa',
|
||||
'@nuxtjs/color-mode',
|
||||
'@nuxtjs/i18n'
|
||||
'@nuxtjs/i18n',
|
||||
],
|
||||
pwa: {
|
||||
manifest: {
|
||||
name: appName,
|
||||
short_name: appName,
|
||||
description: 'A ChatGPT web Client'
|
||||
},
|
||||
workbox: {
|
||||
enabled: process.env.DEBUT_PWA === 'true',
|
||||
}
|
||||
},
|
||||
i18n: {
|
||||
strategy: 'no_prefix',
|
||||
locales: [
|
||||
@@ -42,6 +54,12 @@ export default defineNuxtConfig({
|
||||
iso: 'zh-CN',
|
||||
name: '简体中文',
|
||||
file: 'zh-CN.json',
|
||||
},
|
||||
{
|
||||
code: 'ru',
|
||||
iso: 'ru-RU',
|
||||
name: 'Русский',
|
||||
file: 'ru-RU.json',
|
||||
}
|
||||
],
|
||||
lazy: true,
|
||||
@@ -54,7 +72,7 @@ export default defineNuxtConfig({
|
||||
nitro: {
|
||||
devProxy: {
|
||||
"/api": {
|
||||
target: "http://localhost:8000/api",
|
||||
target: process.env.NUXT_DEV_SERVER ?? 'http://localhost:8000/api',
|
||||
prependPath: true,
|
||||
changeOrigin: true,
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"postinstall": "nuxt prepare"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kevinmarrec/nuxt-pwa": "^0.17.0",
|
||||
"@nuxtjs/color-mode": "^3.2.0",
|
||||
"@nuxtjs/i18n": "^8.0.0-beta.9",
|
||||
"material-design-icons-iconfont": "^6.7.0",
|
||||
|
||||
@@ -45,24 +45,32 @@ onNuxtReady(() => {
|
||||
elevation="0"
|
||||
>
|
||||
<div class="text-center">
|
||||
<h2 class="text-h4">Verify your email</h2>
|
||||
<p class="text-body-2 mt-5">
|
||||
We've sent a verification email to <strong>{{ $auth.user.email }}</strong>. <br>
|
||||
Please check your inbox and click the link to verify your email address.
|
||||
</p>
|
||||
<p v-if="errorMsg"
|
||||
class="text-red"
|
||||
>{{ errorMsg }}</p>
|
||||
<v-btn
|
||||
variant="text"
|
||||
class="mt-5"
|
||||
color="primary"
|
||||
:loading="sending"
|
||||
@click="resendEmail"
|
||||
:disabled="resent"
|
||||
>
|
||||
{{ resent ? 'Resent' : 'Resend email'}}
|
||||
</v-btn>
|
||||
<div v-if="route.query.email_verification_required && route.query.email_verification_required === 'none'">
|
||||
<h2 class="text-h4">Your registration is successful</h2>
|
||||
<p class="mt-5">
|
||||
You can now <NuxtLink to="/account/signin">login</NuxtLink> to your account.
|
||||
</p>
|
||||
</div>
|
||||
<div v-else>
|
||||
<h2 class="text-h4">Verify your email</h2>
|
||||
<p class="mt-5">
|
||||
We've sent a verification email to <strong>{{ $auth.user.email }}</strong>. <br>
|
||||
Please check your inbox and click the link to verify your email address.
|
||||
</p>
|
||||
<p v-if="errorMsg"
|
||||
class="text-red"
|
||||
>{{ errorMsg }}</p>
|
||||
<v-btn
|
||||
variant="text"
|
||||
class="mt-5"
|
||||
color="primary"
|
||||
:loading="sending"
|
||||
@click="resendEmail"
|
||||
:disabled="resent"
|
||||
>
|
||||
{{ resent ? 'Resent' : 'Resend email'}}
|
||||
</v-btn>
|
||||
</div>
|
||||
</div>
|
||||
</v-card>
|
||||
</v-col>
|
||||
|
||||
176
pages/account/resetPassword.vue
Normal file
176
pages/account/resetPassword.vue
Normal file
@@ -0,0 +1,176 @@
|
||||
<script setup>
|
||||
definePageMeta({
|
||||
middleware: ["auth"]
|
||||
})
|
||||
const formData = ref({
|
||||
old_password: '',
|
||||
new_password1: '',
|
||||
new_password2: ''
|
||||
})
|
||||
const formRules = ref({
|
||||
old_password: [
|
||||
v => !!v || 'Current password is required'
|
||||
],
|
||||
new_password1: [
|
||||
v => !!v || 'New password is required'
|
||||
],
|
||||
new_password2: [
|
||||
v => !!v || 'Confirm password is required',
|
||||
v => v === formData.value.new_password1 || 'Passwords do not match'
|
||||
]
|
||||
})
|
||||
const fieldErrors = ref({
|
||||
old_password: '',
|
||||
new_password1: '',
|
||||
new_password2: '',
|
||||
})
|
||||
const { $auth } = useNuxtApp()
|
||||
const errorMsg = ref(null)
|
||||
const resetForm = ref(null)
|
||||
const valid = ref(true)
|
||||
const submitting = ref(false)
|
||||
const route = useRoute()
|
||||
const passwordInputType = ref('password')
|
||||
|
||||
const signOut = async () => {
|
||||
const { data, error } = await useFetch('/api/account/logout/', {
|
||||
method: 'POST'
|
||||
})
|
||||
if (!error.value) {
|
||||
await $auth.logout()
|
||||
}
|
||||
}
|
||||
|
||||
const submit = async () => {
|
||||
errorMsg.value = null
|
||||
const { valid } = await resetForm.value.validate()
|
||||
if (valid) {
|
||||
submitting.value = true
|
||||
const { data, error } = await useFetch('/api/account/password/change/', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(formData.value)
|
||||
})
|
||||
submitting.value = false
|
||||
if (error.value) {
|
||||
if (error.value.status === 400) {
|
||||
for (const key in formData.value) {
|
||||
if (error.value.data[key]) {
|
||||
fieldErrors.value[key] = error.value.data[key][0]
|
||||
}
|
||||
}
|
||||
if (error.value.data.non_field_errors) {
|
||||
errorMsg.value = error.value.data.non_field_errors[0]
|
||||
}
|
||||
} else {
|
||||
if (error.value.data.detail) {
|
||||
errorMsg.value = error.value.data.detail
|
||||
} else {
|
||||
errorMsg.value = 'Something went wrong. Please try again.'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successDialog.value = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const handleFieldUpdate = (field) => {
|
||||
fieldErrors.value[field] = ''
|
||||
}
|
||||
|
||||
const successDialog = ref(false)
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-card
|
||||
style="height: 100vh"
|
||||
>
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col
|
||||
sm="9"
|
||||
offset-sm="1"
|
||||
md="6"
|
||||
offset-md="3"
|
||||
>
|
||||
<v-card
|
||||
class="mt-15"
|
||||
elevation="0"
|
||||
>
|
||||
<div class="text-center text-h4">{{ $t('resetPassword') }}</div>
|
||||
<v-card-text>
|
||||
<v-form ref="resetForm">
|
||||
<v-text-field
|
||||
v-model="formData.old_password"
|
||||
:rules="formRules.old_password"
|
||||
:error-messages="fieldErrors.old_password"
|
||||
@update:modelValue="handleFieldUpdate('old_password')"
|
||||
:label="$t('currentPassword')"
|
||||
variant="underlined"
|
||||
clearable
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-model="formData.new_password1"
|
||||
:rules="formRules.new_password1"
|
||||
:error-messages="fieldErrors.new_password1"
|
||||
@update:modelValue="handleFieldUpdate('new_password1')"
|
||||
:label="$t('newPassword')"
|
||||
variant="underlined"
|
||||
clearable
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-model="formData.new_password2"
|
||||
:rules="formRules.new_password2"
|
||||
:error-messages="fieldErrors.new_password2"
|
||||
@update:modelValue="handleFieldUpdate('new_password2')"
|
||||
:label="$t('confirmPassword')"
|
||||
variant="underlined"
|
||||
clearable
|
||||
></v-text-field>
|
||||
</v-form>
|
||||
|
||||
<div v-if="errorMsg" class="text-red">{{ errorMsg }}</div>
|
||||
|
||||
<div
|
||||
class="mt-5 d-flex justify-space-between"
|
||||
>
|
||||
<v-btn
|
||||
block
|
||||
color="primary"
|
||||
:loading="submitting"
|
||||
@click="submit"
|
||||
size="large"
|
||||
>{{ $t('submit') }}</v-btn>
|
||||
</div>
|
||||
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card>
|
||||
|
||||
<v-dialog
|
||||
v-model="successDialog"
|
||||
persistent
|
||||
width="auto"
|
||||
>
|
||||
<v-card>
|
||||
<v-card-title class="text-h5">
|
||||
{{ $t('yourPasswordHasBeenReset') }}
|
||||
</v-card-title>
|
||||
<v-card-text>{{ $t('nowYouNeedToSignInAgain') }}</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
color="green-darken-1"
|
||||
variant="text"
|
||||
@click="signOut"
|
||||
>
|
||||
{{ $t('agree') }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
@@ -67,11 +67,15 @@ const submit = async () => {
|
||||
errorMsg.value = error.value.data.non_field_errors[0]
|
||||
}
|
||||
} else {
|
||||
errorMsg.value = 'Something went wrong. Please try again.'
|
||||
if (error.value.data.detail) {
|
||||
errorMsg.value = error.value.data.detail
|
||||
} else {
|
||||
errorMsg.value = 'Something went wrong. Please try again.'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$auth.setUser(data.value.user)
|
||||
navigateTo('/account/onboarding')
|
||||
navigateTo('/account/onboarding?email_verification_required='+data.value.email_verification_required)
|
||||
}
|
||||
|
||||
submitting.value = false
|
||||
@@ -79,7 +83,7 @@ const submit = async () => {
|
||||
}
|
||||
|
||||
const handleFieldUpdate = (field) => {
|
||||
// fieldErrors.value[field] = ''
|
||||
fieldErrors.value[field] = ''
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -118,7 +122,7 @@ const handleFieldUpdate = (field) => {
|
||||
:error-messages="fieldErrors.email"
|
||||
label="Email"
|
||||
variant="underlined"
|
||||
@@update:modelValue="handleFieldUpdate('email')"
|
||||
@update:modelValue="handleFieldUpdate('email')"
|
||||
clearable
|
||||
></v-text-field>
|
||||
|
||||
|
||||
255
pages/index.vue
255
pages/index.vue
@@ -1,235 +1,46 @@
|
||||
<script setup>
|
||||
import Prompt from "~/components/Prompt.vue";
|
||||
|
||||
definePageMeta({
|
||||
middleware: ["auth"]
|
||||
middleware: ["auth"],
|
||||
path: '/:id?',
|
||||
keepalive: true
|
||||
})
|
||||
import {EventStreamContentType, fetchEventSource} from '@microsoft/fetch-event-source'
|
||||
import { nextTick } from 'vue'
|
||||
const route = useRoute()
|
||||
const currentConversation = useConversation()
|
||||
const conversation = ref(getDefaultConversationData())
|
||||
|
||||
const { $i18n, $auth } = useNuxtApp()
|
||||
const runtimeConfig = useRuntimeConfig()
|
||||
const currentModel = useCurrentModel()
|
||||
const openaiApiKey = useApiKey()
|
||||
const fetchingResponse = ref(false)
|
||||
const messageQueue = []
|
||||
let isProcessingQueue = false
|
||||
const loadConversation = async () => {
|
||||
const { data, error } = await useAuthFetch('/api/chat/conversations/' + route.params.id)
|
||||
if (!error.value) {
|
||||
conversation.value = Object.assign(conversation.value, data.value)
|
||||
console.log(conversation.value)
|
||||
}
|
||||
}
|
||||
|
||||
const processMessageQueue = () => {
|
||||
if (isProcessingQueue || messageQueue.length === 0) {
|
||||
return
|
||||
const loadMessage = async () => {
|
||||
const { data, error } = await useAuthFetch('/api/chat/messages/?conversationId=' + route.params.id)
|
||||
if (!error.value) {
|
||||
conversation.value.messages = data.value
|
||||
}
|
||||
if (!currentConversation.value.messages[currentConversation.value.messages.length - 1].is_bot) {
|
||||
currentConversation.value.messages.push({id: null, is_bot: true, message: ''})
|
||||
}
|
||||
isProcessingQueue = true
|
||||
const nextMessage = messageQueue.shift()
|
||||
if (runtimeConfig.public.typewriter) {
|
||||
let wordIndex = 0;
|
||||
const intervalId = setInterval(() => {
|
||||
currentConversation.value.messages[currentConversation.value.messages.length - 1].message += nextMessage[wordIndex]
|
||||
wordIndex++
|
||||
if (wordIndex === nextMessage.length) {
|
||||
clearInterval(intervalId)
|
||||
isProcessingQueue = false
|
||||
processMessageQueue()
|
||||
}
|
||||
}, runtimeConfig.public.typewriterDelay)
|
||||
}
|
||||
|
||||
onActivated(async () => {
|
||||
console.log('activated')
|
||||
if (route.params.id) {
|
||||
conversation.value.loadingMessages = true
|
||||
await loadConversation()
|
||||
await loadMessage()
|
||||
conversation.value.loadingMessages = false
|
||||
} else {
|
||||
currentConversation.value.messages[currentConversation.value.messages.length - 1].message += nextMessage
|
||||
isProcessingQueue = false
|
||||
processMessageQueue()
|
||||
conversation.value = getDefaultConversationData()
|
||||
}
|
||||
}
|
||||
|
||||
let ctrl
|
||||
const abortFetch = () => {
|
||||
if (ctrl) {
|
||||
ctrl.abort()
|
||||
}
|
||||
fetchingResponse.value = false
|
||||
}
|
||||
const fetchReply = async (message, parentMessageId) => {
|
||||
ctrl = new AbortController()
|
||||
try {
|
||||
await fetchEventSource('/api/conversation/', {
|
||||
signal: ctrl.signal,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
model: currentModel.value,
|
||||
openaiApiKey: openaiApiKey.value,
|
||||
message: message,
|
||||
parentMessageId: parentMessageId,
|
||||
conversationId: currentConversation.value.id
|
||||
}),
|
||||
onopen(response) {
|
||||
if (response.ok && response.headers.get('content-type') === EventStreamContentType) {
|
||||
return;
|
||||
}
|
||||
throw new Error(`Failed to send message. HTTP ${response.status} - ${response.statusText}`);
|
||||
},
|
||||
onclose() {
|
||||
if (ctrl.signal.aborted === true) {
|
||||
return;
|
||||
}
|
||||
throw new Error(`Failed to send message. Server closed the connection unexpectedly.`);
|
||||
},
|
||||
onerror(err) {
|
||||
throw err;
|
||||
},
|
||||
async onmessage(message) {
|
||||
// console.log(message)
|
||||
const event = message.event
|
||||
const data = JSON.parse(message.data)
|
||||
|
||||
if (event === 'error') {
|
||||
throw new Error(data.error);
|
||||
}
|
||||
|
||||
if (event === 'done') {
|
||||
if (currentConversation.value.id === null) {
|
||||
currentConversation.value.id = data.conversationId
|
||||
genTitle(currentConversation.value.id)
|
||||
}
|
||||
currentConversation.value.messages[currentConversation.value.messages.length - 1].id = data.messageId
|
||||
abortFetch()
|
||||
return;
|
||||
}
|
||||
|
||||
messageQueue.push(data.content)
|
||||
processMessageQueue()
|
||||
|
||||
scrollChatWindow()
|
||||
},
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
abortFetch()
|
||||
showSnackbar(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
const currentConversation = useConversion()
|
||||
|
||||
const grab = ref(null)
|
||||
const scrollChatWindow = () => {
|
||||
if (grab.value === null) {
|
||||
return;
|
||||
}
|
||||
grab.value.scrollIntoView({behavior: 'smooth'})
|
||||
}
|
||||
|
||||
|
||||
const send = (message) => {
|
||||
fetchingResponse.value = true
|
||||
let parentMessageId = null
|
||||
if (currentConversation.value.messages.length > 0) {
|
||||
const lastMessage = currentConversation.value.messages[currentConversation.value.messages.length - 1]
|
||||
if (lastMessage.is_bot && lastMessage.id !== null) {
|
||||
parentMessageId = lastMessage.id
|
||||
}
|
||||
}
|
||||
currentConversation.value.messages.push({parentMessageId: parentMessageId, message: message})
|
||||
fetchReply(message, parentMessageId)
|
||||
scrollChatWindow()
|
||||
}
|
||||
const stop = () => {
|
||||
abortFetch()
|
||||
}
|
||||
|
||||
const snackbar = ref(false)
|
||||
const snackbarText = ref('')
|
||||
const showSnackbar = (text) => {
|
||||
snackbarText.value = text
|
||||
snackbar.value = true
|
||||
}
|
||||
|
||||
const editor = ref(null)
|
||||
const usePrompt = (prompt) => {
|
||||
editor.value.usePrompt(prompt)
|
||||
}
|
||||
currentConversation.value = Object.assign({}, conversation.value)
|
||||
})
|
||||
|
||||
watchEffect(() => {
|
||||
console.log('conversation.value', conversation.value)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="currentConversation.messages.length > 0"
|
||||
ref="chatWindow"
|
||||
>
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col
|
||||
v-for="(message, index) in currentConversation.messages" :key="index"
|
||||
cols="12"
|
||||
>
|
||||
<div
|
||||
class="d-flex"
|
||||
:class="message.is_bot ? 'justify-start mr-16' : 'justify-end ml-16'"
|
||||
>
|
||||
<v-card
|
||||
:color="message.is_bot ? '' : 'primary'"
|
||||
rounded="lg"
|
||||
elevation="2"
|
||||
>
|
||||
<v-card-text>
|
||||
<MsgContent :content="message.message" />
|
||||
</v-card-text>
|
||||
|
||||
<!-- <v-card-actions-->
|
||||
<!-- v-if="message.is_bot"-->
|
||||
<!-- >-->
|
||||
<!-- <v-spacer></v-spacer>-->
|
||||
<!-- <v-tooltip text="Copy">-->
|
||||
<!-- <template v-slot:activator="{ props }">-->
|
||||
<!-- <v-btn v-bind="props" icon="content_copy"></v-btn>-->
|
||||
<!-- </template>-->
|
||||
<!-- </v-tooltip>-->
|
||||
<!-- </v-card-actions>-->
|
||||
</v-card>
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
|
||||
<div ref="grab" class="w-100" style="height: 200px;"></div>
|
||||
</div>
|
||||
<Welcome v-else />
|
||||
<v-footer app class="d-flex flex-column">
|
||||
<div class="px-md-16 w-100 d-flex align-center">
|
||||
<Prompt v-show="!fetchingResponse" :use-prompt="usePrompt" />
|
||||
<v-btn
|
||||
v-show="fetchingResponse"
|
||||
icon="close"
|
||||
title="stop"
|
||||
class="mr-3"
|
||||
@click="stop"
|
||||
></v-btn>
|
||||
<MsgEditor ref="editor" :send-message="send" :disabled="fetchingResponse" :loading="fetchingResponse" />
|
||||
</div>
|
||||
|
||||
<div class="px-4 py-2 text-disabled text-caption font-weight-light text-center w-100">
|
||||
© {{ new Date().getFullYear() }} {{ runtimeConfig.public.appName }}
|
||||
</div>
|
||||
</v-footer>
|
||||
<v-snackbar
|
||||
v-model="snackbar"
|
||||
multi-line
|
||||
location="top"
|
||||
>
|
||||
{{ snackbarText }}
|
||||
|
||||
<template v-slot:actions>
|
||||
<v-btn
|
||||
color="red"
|
||||
variant="text"
|
||||
@click="snackbar = false"
|
||||
>
|
||||
Close
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
<Conversation :conversation="conversation" />
|
||||
</template>
|
||||
3
public/icon-black.svg
Normal file
3
public/icon-black.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="900" height="900" viewBox="0 0 900 900" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M504.908 750H839.476C850.103 750.001 860.542 747.229 869.745 741.963C878.948 736.696 886.589 729.121 891.9 719.999C897.211 710.876 900.005 700.529 900 689.997C899.995 679.465 897.193 669.12 891.873 660.002L667.187 274.289C661.876 265.169 654.237 257.595 645.036 252.329C635.835 247.064 625.398 244.291 614.773 244.291C604.149 244.291 593.711 247.064 584.511 252.329C575.31 257.595 567.67 265.169 562.36 274.289L504.908 372.979L392.581 179.993C387.266 170.874 379.623 163.301 370.42 158.036C361.216 152.772 350.777 150 340.151 150C329.525 150 319.086 152.772 309.883 158.036C300.679 163.301 293.036 170.874 287.721 179.993L8.12649 660.002C2.80743 669.12 0.00462935 679.465 5.72978e-06 689.997C-0.00461789 700.529 2.78909 710.876 8.10015 719.999C13.4112 729.121 21.0523 736.696 30.255 741.963C39.4576 747.229 49.8973 750.001 60.524 750H270.538C353.748 750 415.112 713.775 457.336 643.101L559.849 467.145L614.757 372.979L779.547 655.834H559.849L504.908 750ZM267.114 655.737L120.551 655.704L340.249 278.586L449.87 467.145L376.474 593.175C348.433 639.03 316.577 655.737 267.114 655.737Z" fill="#0C0C0D"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
BIN
public/icon.png
Normal file
BIN
public/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
2
public/robots.txt
Normal file
2
public/robots.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
User-agent: *
|
||||
Allow: /
|
||||
@@ -1,6 +1,29 @@
|
||||
|
||||
export const STORAGE_KEY = {
|
||||
OPENAI_MODELS: 'openai_models',
|
||||
CURRENT_OPENAI_MODEL: 'current_openai_model',
|
||||
MODELS: 'models',
|
||||
CURRENT_MODEL: 'current_model',
|
||||
OPENAI_API_KEY: 'openai_api_key',
|
||||
}
|
||||
|
||||
export const MODELS = {
|
||||
'gpt-3.5-turbo': {
|
||||
name: 'gpt-3.5-turbo',
|
||||
frequency_penalty: 0.0,
|
||||
presence_penalty: 0.0,
|
||||
total_tokens: 4096,
|
||||
max_tokens: 1000,
|
||||
temperature: 0.7,
|
||||
top_p: 1.0
|
||||
},
|
||||
'gpt-4': {
|
||||
name: 'gpt-4',
|
||||
frequency_penalty: 0.0,
|
||||
presence_penalty: 0.0,
|
||||
total_tokens: 8192,
|
||||
max_tokens: 2000,
|
||||
temperature: 0.7,
|
||||
top_p: 1.0
|
||||
}
|
||||
}
|
||||
|
||||
export const DEFAULT_MODEL_NAME = 'gpt-3.5-turbo'
|
||||
@@ -1,14 +1,15 @@
|
||||
|
||||
export const getDefaultConversionData = () => {
|
||||
export const getDefaultConversationData = () => {
|
||||
const { $i18n } = useNuxtApp()
|
||||
return {
|
||||
id: null,
|
||||
topic: null,
|
||||
topic: $i18n.t('defaultConversationTitle'),
|
||||
messages: [],
|
||||
loadingMessages: false,
|
||||
}
|
||||
}
|
||||
|
||||
export const getConversions = async () => {
|
||||
export const getConversations = async () => {
|
||||
const { data, error } = await useAuthFetch('/api/chat/conversations/')
|
||||
if (!error.value) {
|
||||
return data.value
|
||||
@@ -16,38 +17,53 @@ export const getConversions = async () => {
|
||||
return []
|
||||
}
|
||||
|
||||
export const createNewConversion = () => {
|
||||
const conversation = useConversion()
|
||||
conversation.value = getDefaultConversionData()
|
||||
export const createNewConversation = () => {
|
||||
navigateTo('/')
|
||||
}
|
||||
|
||||
export const openConversationMessages = async (currentConversation) => {
|
||||
const conversation = useConversion()
|
||||
conversation.value = Object.assign(conversation.value, currentConversation)
|
||||
conversation.value.loadingMessages = true
|
||||
const { data, error } = await useAuthFetch('/api/chat/messages/?conversationId=' + currentConversation.id)
|
||||
if (!error.value) {
|
||||
conversation.value.messages = data.value
|
||||
}
|
||||
conversation.value.loadingMessages = true
|
||||
|
||||
export const addConversation = (conversation) => {
|
||||
const conversations = useConversations()
|
||||
conversations.value = [conversation, ...conversations.value]
|
||||
}
|
||||
|
||||
|
||||
export const genTitle = async (conversationId) => {
|
||||
const { $i18n } = useNuxtApp()
|
||||
const { data, error } = await useAuthFetch('/api/gen_title/', {
|
||||
method: 'POST',
|
||||
body: {
|
||||
conversationId: conversationId
|
||||
conversationId: conversationId,
|
||||
prompt: $i18n.t('genTitlePrompt')
|
||||
}
|
||||
})
|
||||
if (!error.value) {
|
||||
const conversation = {
|
||||
id: conversationId,
|
||||
topic: data.value.title,
|
||||
const conversations = useConversations()
|
||||
let index = conversations.value.findIndex(item => item.id === conversationId)
|
||||
if (index === -1) {
|
||||
index = 0
|
||||
}
|
||||
const conversations = useConversions()
|
||||
// prepend to conversations
|
||||
conversations.value = [conversation, ...conversations.value]
|
||||
conversations.value[index].topic = data.value.title
|
||||
return data.value.title
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
const transformData = (list) => {
|
||||
const result = {};
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const item = list[i];
|
||||
result[item.name] = item.value;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export const loadSettings = async () => {
|
||||
const settings = useSettings()
|
||||
const { data, error } = await useAuthFetch('/api/chat/settings/', {
|
||||
method: 'GET'
|
||||
})
|
||||
if (!error.value) {
|
||||
settings.value = transformData(data.value)
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import {MODELS} from "~/utils/enums";
|
||||
|
||||
const get = (key) => {
|
||||
let val = localStorage.getItem(key)
|
||||
@@ -11,32 +12,28 @@ const set = (key, val) => {
|
||||
localStorage.setItem(key, JSON.stringify(val))
|
||||
}
|
||||
|
||||
const DEFAULT_OPENAI_MODEL = 'text-davinci-003'
|
||||
|
||||
export const setModels = (val) => {
|
||||
const models = useModels()
|
||||
set(STORAGE_KEY.OPENAI_MODELS, val)
|
||||
set(STORAGE_KEY.MODELS, val)
|
||||
models.value = val
|
||||
}
|
||||
|
||||
export const getStoredModels = () => {
|
||||
let models = get(STORAGE_KEY.OPENAI_MODELS)
|
||||
if (!models) {
|
||||
models = [DEFAULT_OPENAI_MODEL]
|
||||
}
|
||||
return models
|
||||
}
|
||||
// export const getStoredModels = () => {
|
||||
// let models = get(STORAGE_KEY.MODELS)
|
||||
// if (!models) {
|
||||
// models = [DEFAULT_MODEL]
|
||||
// }
|
||||
// return models
|
||||
// }
|
||||
|
||||
export const setCurrentModel = (val) => {
|
||||
const model = useCurrentModel()
|
||||
set(STORAGE_KEY.CURRENT_OPENAI_MODEL, val)
|
||||
model.value = val
|
||||
export const saveCurrentModel = (val) => {
|
||||
set(STORAGE_KEY.CURRENT_MODEL, val)
|
||||
}
|
||||
|
||||
export const getCurrentModel = () => {
|
||||
let model = get(STORAGE_KEY.CURRENT_OPENAI_MODEL)
|
||||
let model = get(STORAGE_KEY.CURRENT_MODEL)
|
||||
if (!model) {
|
||||
model = DEFAULT_OPENAI_MODEL
|
||||
model = MODELS[DEFAULT_MODEL_NAME]
|
||||
}
|
||||
return model
|
||||
}
|
||||
|
||||
209
yarn.lock
209
yarn.lock
@@ -652,6 +652,15 @@
|
||||
"@jridgewell/resolve-uri" "3.1.0"
|
||||
"@jridgewell/sourcemap-codec" "1.4.14"
|
||||
|
||||
"@kevinmarrec/nuxt-pwa@^0.17.0":
|
||||
version "0.17.0"
|
||||
resolved "https://registry.npmmirror.com/@kevinmarrec/nuxt-pwa/-/nuxt-pwa-0.17.0.tgz#384a7d63062b5b71a2c14cc53d0b8c4b449d7399"
|
||||
integrity sha512-TI/0Fe30g6/VL2Y2jDLF/q5sov8UBE5K4/+CRPUnJbQPCXhCzTBM8EjllDUwslZ3bPtCk2TqwDFZOHaKtY/eoA==
|
||||
dependencies:
|
||||
hasha "^5.2.2"
|
||||
sharp "^0.31.3"
|
||||
std-env "^3.3.2"
|
||||
|
||||
"@mapbox/node-pre-gyp@^1.0.5":
|
||||
version "1.0.10"
|
||||
resolved "https://registry.npmmirror.com/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.10.tgz#8e6735ccebbb1581e5a7e652244cadc8a844d03c"
|
||||
@@ -1533,6 +1542,11 @@ chokidar@^3.5.1, chokidar@^3.5.3:
|
||||
optionalDependencies:
|
||||
fsevents "~2.3.2"
|
||||
|
||||
chownr@^1.1.1:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.npmmirror.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b"
|
||||
integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==
|
||||
|
||||
chownr@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.npmmirror.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece"
|
||||
@@ -1607,16 +1621,32 @@ color-name@1.1.3:
|
||||
resolved "https://registry.npmmirror.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
|
||||
integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==
|
||||
|
||||
color-name@~1.1.4:
|
||||
color-name@^1.0.0, color-name@~1.1.4:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||
|
||||
color-string@^1.9.0:
|
||||
version "1.9.1"
|
||||
resolved "https://registry.npmmirror.com/color-string/-/color-string-1.9.1.tgz#4467f9146f036f855b764dfb5bf8582bf342c7a4"
|
||||
integrity sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==
|
||||
dependencies:
|
||||
color-name "^1.0.0"
|
||||
simple-swizzle "^0.2.2"
|
||||
|
||||
color-support@^1.1.2:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.npmmirror.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2"
|
||||
integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==
|
||||
|
||||
color@^4.2.3:
|
||||
version "4.2.3"
|
||||
resolved "https://registry.npmmirror.com/color/-/color-4.2.3.tgz#d781ecb5e57224ee43ea9627560107c0e0c6463a"
|
||||
integrity sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==
|
||||
dependencies:
|
||||
color-convert "^2.0.1"
|
||||
color-string "^1.9.0"
|
||||
|
||||
colord@^2.9.1:
|
||||
version "2.9.3"
|
||||
resolved "https://registry.npmmirror.com/colord/-/colord-2.9.3.tgz#4f8ce919de456f1d5c1c368c307fe20f3e59fb43"
|
||||
@@ -1840,6 +1870,18 @@ debug@4, debug@^4.1.0, debug@^4.3.1, debug@^4.3.4:
|
||||
dependencies:
|
||||
ms "2.1.2"
|
||||
|
||||
decompress-response@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.npmmirror.com/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc"
|
||||
integrity sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==
|
||||
dependencies:
|
||||
mimic-response "^3.1.0"
|
||||
|
||||
deep-extend@^0.6.0:
|
||||
version "0.6.0"
|
||||
resolved "https://registry.npmmirror.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
|
||||
integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==
|
||||
|
||||
deepmerge@^4.2.2:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.npmmirror.com/deepmerge/-/deepmerge-4.3.0.tgz#65491893ec47756d44719ae520e0e2609233b59b"
|
||||
@@ -1887,7 +1929,7 @@ destroy@1.2.0:
|
||||
resolved "https://registry.npmmirror.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015"
|
||||
integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==
|
||||
|
||||
detect-libc@^2.0.0:
|
||||
detect-libc@^2.0.0, detect-libc@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.npmmirror.com/detect-libc/-/detect-libc-2.0.1.tgz#e1897aa88fa6ad197862937fbc0441ef352ee0cd"
|
||||
integrity sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==
|
||||
@@ -1976,7 +2018,7 @@ encodeurl@~1.0.2:
|
||||
resolved "https://registry.npmmirror.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
|
||||
integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==
|
||||
|
||||
end-of-stream@^1.4.1:
|
||||
end-of-stream@^1.1.0, end-of-stream@^1.4.1:
|
||||
version "1.4.4"
|
||||
resolved "https://registry.npmmirror.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0"
|
||||
integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==
|
||||
@@ -2151,6 +2193,11 @@ execa@^5.1.1:
|
||||
signal-exit "^3.0.3"
|
||||
strip-final-newline "^2.0.0"
|
||||
|
||||
expand-template@^2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.npmmirror.com/expand-template/-/expand-template-2.0.3.tgz#6e14b3fcee0f3a6340ecb57d2e8918692052a47c"
|
||||
integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==
|
||||
|
||||
external-editor@^3.0.3:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.npmmirror.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495"
|
||||
@@ -2356,6 +2403,11 @@ git-url-parse@^13.1.0:
|
||||
dependencies:
|
||||
git-up "^7.0.0"
|
||||
|
||||
github-from-package@0.0.0:
|
||||
version "0.0.0"
|
||||
resolved "https://registry.npmmirror.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce"
|
||||
integrity sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==
|
||||
|
||||
glob-parent@^5.1.2, glob-parent@~5.1.2:
|
||||
version "5.1.2"
|
||||
resolved "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
|
||||
@@ -2464,6 +2516,14 @@ hash-sum@^2.0.0:
|
||||
resolved "https://registry.npmmirror.com/hash-sum/-/hash-sum-2.0.0.tgz#81d01bb5de8ea4a214ad5d6ead1b523460b0b45a"
|
||||
integrity sha512-WdZTbAByD+pHfl/g9QSsBIIwy8IT+EsPiKDs0KNX+zSHhdDLFKdZu0BQHljvO+0QI/BasbMSUa8wYNCZTvhslg==
|
||||
|
||||
hasha@^5.2.2:
|
||||
version "5.2.2"
|
||||
resolved "https://registry.npmmirror.com/hasha/-/hasha-5.2.2.tgz#a48477989b3b327aea3c04f53096d816d97522a1"
|
||||
integrity sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==
|
||||
dependencies:
|
||||
is-stream "^2.0.0"
|
||||
type-fest "^0.8.0"
|
||||
|
||||
highlight.js@^11.7.0:
|
||||
version "11.7.0"
|
||||
resolved "https://registry.npmmirror.com/highlight.js/-/highlight.js-11.7.0.tgz#3ff0165bc843f8c9bce1fd89e2fda9143d24b11e"
|
||||
@@ -2547,7 +2607,7 @@ inherits@2, inherits@2.0.4, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3:
|
||||
resolved "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
|
||||
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
|
||||
|
||||
ini@^1.3.5:
|
||||
ini@^1.3.5, ini@~1.3.0:
|
||||
version "1.3.8"
|
||||
resolved "https://registry.npmmirror.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c"
|
||||
integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==
|
||||
@@ -2598,6 +2658,11 @@ iron-webcrypto@^0.4.0:
|
||||
resolved "https://registry.npmmirror.com/iron-webcrypto/-/iron-webcrypto-0.4.0.tgz#8e23931ea0649c9c5cefb5e43c8375e60cd7952d"
|
||||
integrity sha512-5OG53gJ4dBTq4y3IJqK7MEG9CPZRsYn9EP9J4jjgH4TcP/ywdsSMAmqj9VTSzdXu0/xfUrqjGHU7WLUme2+k5Q==
|
||||
|
||||
is-arrayish@^0.3.1:
|
||||
version "0.3.2"
|
||||
resolved "https://registry.npmmirror.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03"
|
||||
integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==
|
||||
|
||||
is-binary-path@~2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.npmmirror.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09"
|
||||
@@ -3034,6 +3099,11 @@ mimic-fn@^2.1.0:
|
||||
resolved "https://registry.npmmirror.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
|
||||
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
|
||||
|
||||
mimic-response@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.npmmirror.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9"
|
||||
integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==
|
||||
|
||||
minimatch@^3.0.4, minimatch@^3.1.1:
|
||||
version "3.1.2"
|
||||
resolved "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
|
||||
@@ -3055,6 +3125,11 @@ minimatch@~3.0.4:
|
||||
dependencies:
|
||||
brace-expansion "^1.1.7"
|
||||
|
||||
minimist@^1.2.0, minimist@^1.2.3:
|
||||
version "1.2.8"
|
||||
resolved "https://registry.npmmirror.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
|
||||
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
|
||||
|
||||
minipass@^3.0.0:
|
||||
version "3.3.6"
|
||||
resolved "https://registry.npmmirror.com/minipass/-/minipass-3.3.6.tgz#7bba384db3a1520d18c9c0e5251c3444e95dd94a"
|
||||
@@ -3080,6 +3155,11 @@ mkdir@^0.0.2:
|
||||
resolved "https://registry.npmmirror.com/mkdir/-/mkdir-0.0.2.tgz#3b9da7a4e5b13004ebc636581b160e1e04776851"
|
||||
integrity sha512-98OnjcWaNEIRUJJe9rFoWlbkQ5n9z8F86wIPCrI961YEViiVybTuJln919WuuSHSnlrqXy0ELKCntoPy8C7lqg==
|
||||
|
||||
mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3:
|
||||
version "0.5.3"
|
||||
resolved "https://registry.npmmirror.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113"
|
||||
integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==
|
||||
|
||||
mkdirp@^1.0.3:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.npmmirror.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
|
||||
@@ -3130,6 +3210,11 @@ nanoid@^4.0.0, nanoid@^4.0.1:
|
||||
resolved "https://registry.npmmirror.com/nanoid/-/nanoid-4.0.1.tgz#398d7ccfdbf9faf2231b2ca7e8fff5dbca6a509b"
|
||||
integrity sha512-udKGtCCUafD3nQtJg9wBhRP3KMbPglUsgV5JVsXhvyBs/oefqb4sqMEhKBBgqZncYowu58p1prsZQBYvAj/Gww==
|
||||
|
||||
napi-build-utils@^1.0.1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npmmirror.com/napi-build-utils/-/napi-build-utils-1.0.2.tgz#b1fddc0b2c46e380a0b7a76f984dd47c41a13806"
|
||||
integrity sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==
|
||||
|
||||
nitropack@^2.2.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.npmmirror.com/nitropack/-/nitropack-2.2.1.tgz#8fec1dd5bd6732faea3b05b1ba63c9e26ea2b9fa"
|
||||
@@ -3194,6 +3279,18 @@ nitropack@^2.2.1:
|
||||
unimport "^2.2.4"
|
||||
unstorage "^1.1.4"
|
||||
|
||||
node-abi@^3.3.0:
|
||||
version "3.33.0"
|
||||
resolved "https://registry.npmmirror.com/node-abi/-/node-abi-3.33.0.tgz#8b23a0cec84e1c5f5411836de6a9b84bccf26e7f"
|
||||
integrity sha512-7GGVawqyHF4pfd0YFybhv/eM9JwTtPqx0mAanQ146O3FlSh3pA24zf9IRQTOsfTSqXTNzPSP5iagAJ94jjuVog==
|
||||
dependencies:
|
||||
semver "^7.3.5"
|
||||
|
||||
node-addon-api@^5.0.0:
|
||||
version "5.1.0"
|
||||
resolved "https://registry.npmmirror.com/node-addon-api/-/node-addon-api-5.1.0.tgz#49da1ca055e109a23d537e9de43c09cca21eb762"
|
||||
integrity sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==
|
||||
|
||||
node-domexception@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.npmmirror.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
|
||||
@@ -3364,7 +3461,7 @@ on-finished@2.4.1:
|
||||
dependencies:
|
||||
ee-first "1.1.1"
|
||||
|
||||
once@^1.3.0, once@^1.4.0:
|
||||
once@^1.3.0, once@^1.3.1, once@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.npmmirror.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
||||
integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==
|
||||
@@ -3733,6 +3830,24 @@ postcss@^8.1.10, postcss@^8.4.21:
|
||||
picocolors "^1.0.0"
|
||||
source-map-js "^1.0.2"
|
||||
|
||||
prebuild-install@^7.1.1:
|
||||
version "7.1.1"
|
||||
resolved "https://registry.npmmirror.com/prebuild-install/-/prebuild-install-7.1.1.tgz#de97d5b34a70a0c81334fd24641f2a1702352e45"
|
||||
integrity sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==
|
||||
dependencies:
|
||||
detect-libc "^2.0.0"
|
||||
expand-template "^2.0.3"
|
||||
github-from-package "0.0.0"
|
||||
minimist "^1.2.3"
|
||||
mkdirp-classic "^0.5.3"
|
||||
napi-build-utils "^1.0.1"
|
||||
node-abi "^3.3.0"
|
||||
pump "^3.0.0"
|
||||
rc "^1.2.7"
|
||||
simple-get "^4.0.0"
|
||||
tar-fs "^2.0.0"
|
||||
tunnel-agent "^0.6.0"
|
||||
|
||||
pretty-bytes@^6.1.0:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.npmmirror.com/pretty-bytes/-/pretty-bytes-6.1.0.tgz#1d1cc9aae1939012c74180b679da6684616bf804"
|
||||
@@ -3753,6 +3868,14 @@ prr@~1.0.1:
|
||||
resolved "https://registry.npmmirror.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476"
|
||||
integrity sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==
|
||||
|
||||
pump@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.npmmirror.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64"
|
||||
integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==
|
||||
dependencies:
|
||||
end-of-stream "^1.1.0"
|
||||
once "^1.3.1"
|
||||
|
||||
queue-microtask@^1.2.2:
|
||||
version "1.2.3"
|
||||
resolved "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
|
||||
@@ -3784,6 +3907,16 @@ rc9@^2.0.0:
|
||||
destr "^1.2.2"
|
||||
flat "^5.0.2"
|
||||
|
||||
rc@^1.2.7:
|
||||
version "1.2.8"
|
||||
resolved "https://registry.npmmirror.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed"
|
||||
integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==
|
||||
dependencies:
|
||||
deep-extend "^0.6.0"
|
||||
ini "~1.3.0"
|
||||
minimist "^1.2.0"
|
||||
strip-json-comments "~2.0.1"
|
||||
|
||||
read-cache@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.npmmirror.com/read-cache/-/read-cache-1.0.0.tgz#e664ef31161166c9751cdbe8dbcf86b5fb58f774"
|
||||
@@ -3919,7 +4052,7 @@ rxjs@^7.5.7:
|
||||
dependencies:
|
||||
tslib "^2.1.0"
|
||||
|
||||
safe-buffer@^5.1.0, safe-buffer@~5.2.0:
|
||||
safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@~5.2.0:
|
||||
version "5.2.1"
|
||||
resolved "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
|
||||
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
|
||||
@@ -4004,6 +4137,20 @@ setprototypeof@1.2.0:
|
||||
resolved "https://registry.npmmirror.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424"
|
||||
integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==
|
||||
|
||||
sharp@^0.31.3:
|
||||
version "0.31.3"
|
||||
resolved "https://registry.npmmirror.com/sharp/-/sharp-0.31.3.tgz#60227edc5c2be90e7378a210466c99aefcf32688"
|
||||
integrity sha512-XcR4+FCLBFKw1bdB+GEhnUNXNXvnt0tDo4WsBsraKymuo/IAuPuCBVAL2wIkUw2r/dwFW5Q5+g66Kwl2dgDFVg==
|
||||
dependencies:
|
||||
color "^4.2.3"
|
||||
detect-libc "^2.0.1"
|
||||
node-addon-api "^5.0.0"
|
||||
prebuild-install "^7.1.1"
|
||||
semver "^7.3.8"
|
||||
simple-get "^4.0.1"
|
||||
tar-fs "^2.1.1"
|
||||
tunnel-agent "^0.6.0"
|
||||
|
||||
shebang-command@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.npmmirror.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"
|
||||
@@ -4021,6 +4168,27 @@ signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3:
|
||||
resolved "https://registry.npmmirror.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
|
||||
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==
|
||||
|
||||
simple-concat@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npmmirror.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f"
|
||||
integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==
|
||||
|
||||
simple-get@^4.0.0, simple-get@^4.0.1:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.npmmirror.com/simple-get/-/simple-get-4.0.1.tgz#4a39db549287c979d352112fa03fd99fd6bc3543"
|
||||
integrity sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==
|
||||
dependencies:
|
||||
decompress-response "^6.0.0"
|
||||
once "^1.3.1"
|
||||
simple-concat "^1.0.0"
|
||||
|
||||
simple-swizzle@^0.2.2:
|
||||
version "0.2.2"
|
||||
resolved "https://registry.npmmirror.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"
|
||||
integrity sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==
|
||||
dependencies:
|
||||
is-arrayish "^0.3.1"
|
||||
|
||||
slash@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.npmmirror.com/slash/-/slash-4.0.0.tgz#2422372176c4c6c5addb5e2ada885af984b396a7"
|
||||
@@ -4130,6 +4298,11 @@ strip-final-newline@^2.0.0:
|
||||
resolved "https://registry.npmmirror.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad"
|
||||
integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==
|
||||
|
||||
strip-json-comments@~2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.npmmirror.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
|
||||
integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==
|
||||
|
||||
strip-literal@^1.0.0, strip-literal@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npmmirror.com/strip-literal/-/strip-literal-1.0.1.tgz#0115a332710c849b4e46497891fb8d585e404bd2"
|
||||
@@ -4192,7 +4365,17 @@ tapable@^2.2.0:
|
||||
resolved "https://registry.npmmirror.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"
|
||||
integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==
|
||||
|
||||
tar-stream@^2.2.0:
|
||||
tar-fs@^2.0.0, tar-fs@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.npmmirror.com/tar-fs/-/tar-fs-2.1.1.tgz#489a15ab85f1f0befabb370b7de4f9eb5cbe8784"
|
||||
integrity sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==
|
||||
dependencies:
|
||||
chownr "^1.1.1"
|
||||
mkdirp-classic "^0.5.2"
|
||||
pump "^3.0.0"
|
||||
tar-stream "^2.1.4"
|
||||
|
||||
tar-stream@^2.1.4, tar-stream@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.npmmirror.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287"
|
||||
integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==
|
||||
@@ -4274,11 +4457,23 @@ tslib@^2.1.0:
|
||||
resolved "https://registry.npmmirror.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf"
|
||||
integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==
|
||||
|
||||
tunnel-agent@^0.6.0:
|
||||
version "0.6.0"
|
||||
resolved "https://registry.npmmirror.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd"
|
||||
integrity sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==
|
||||
dependencies:
|
||||
safe-buffer "^5.0.1"
|
||||
|
||||
type-fest@^0.21.3:
|
||||
version "0.21.3"
|
||||
resolved "https://registry.npmmirror.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37"
|
||||
integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==
|
||||
|
||||
type-fest@^0.8.0:
|
||||
version "0.8.1"
|
||||
resolved "https://registry.npmmirror.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
|
||||
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==
|
||||
|
||||
type-fest@^2.11.2:
|
||||
version "2.19.0"
|
||||
resolved "https://registry.npmmirror.com/type-fest/-/type-fest-2.19.0.tgz#88068015bb33036a598b952e55e9311a60fd3a9b"
|
||||
|
||||
Reference in New Issue
Block a user