Compare commits

..

6 Commits

10 changed files with 90 additions and 32 deletions

View File

@@ -9,6 +9,15 @@
A ChatGPT web client that supports multiple users, multiple database connections for persistent data storage, supports i18n. Provides Docker images and quick deployment scripts. A ChatGPT web client that supports multiple users, multiple database connections for persistent data storage, supports i18n. Provides Docker images and quick deployment scripts.
## 📢Updates ## 📢Updates
<details open>
<summary><strong>2023-03-10</strong></summary>
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>
<details open> <details open>
<summary><strong>2023-03-04</strong></summary> <summary><strong>2023-03-04</strong></summary>
@@ -19,7 +28,7 @@ A ChatGPT web client that supports multiple users, multiple database connections
</details> </details>
<details open> <details>
<summary><strong>2023-02-24</strong></summary> <summary><strong>2023-02-24</strong></summary>
Version 2 is a major update that separates the backend functionality as an independent project, hosted at [chatgpt-ui-server](https://github.com/WongSaang/chatgpt-ui-server). Version 2 is a major update that separates the backend functionality as an independent project, hosted at [chatgpt-ui-server](https://github.com/WongSaang/chatgpt-ui-server).
@@ -73,6 +82,9 @@ services:
image: wongsaang/chatgpt-ui-client:latest image: wongsaang/chatgpt-ui-client:latest
environment: environment:
- SERVER_DOMAIN=http://backend-web-server - 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: depends_on:
- backend-web-server - backend-web-server
ports: ports:

View File

@@ -63,7 +63,7 @@ onUpdated(() => {
<style> <style>
.chat-msg-content ol { .chat-msg-content ol {
list-style-position: inside; padding-left: 2em;
} }
.hljs-code-container { .hljs-code-container {
border-radius: 3px; border-radius: 3px;

View File

@@ -1,6 +1,28 @@
#!/bin/bash #!/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 if [[ $(which docker) ]]; then
echo "Docker is already installed" echo "Docker is already installed"
@@ -43,6 +65,6 @@ sudo curl -L "https://raw.githubusercontent.com/WongSaang/chatgpt-ui/main/docker
echo "Starting services..." 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 -d
echo "Done" echo "Done"

View File

@@ -4,12 +4,16 @@ services:
image: wongsaang/chatgpt-ui-client:latest image: wongsaang/chatgpt-ui-client:latest
environment: environment:
- SERVER_DOMAIN=http://backend-web-server - SERVER_DOMAIN=http://backend-web-server
- NUXT_PUBLIC_APP_NAME='ChatGPT UI'
- NUXT_PUBLIC_TYPEWRITER=true
- NUXT_PUBLIC_TYPEWRITER_DELAY=100
depends_on: depends_on:
- backend-web-server - backend-web-server
ports: ports:
- '80:80' - '${CLIENT_PORT:-80}:80'
networks: networks:
- chatgpt_ui_network - chatgpt_ui_network
restart: always
backend-wsgi-server: backend-wsgi-server:
image: wongsaang/chatgpt-ui-wsgi-server:latest image: wongsaang/chatgpt-ui-wsgi-server:latest
environment: environment:
@@ -25,19 +29,21 @@ services:
# - EMAIL_HOST_PASSWORD= # - EMAIL_HOST_PASSWORD=
# - EMAIL_USE_TLS=True # - EMAIL_USE_TLS=True
ports: ports:
- '8000:8000' - '${WSGI_PORT:-8000}:8000'
networks: networks:
- chatgpt_ui_network - chatgpt_ui_network
restart: always
backend-web-server: backend-web-server:
image: wongsaang/chatgpt-ui-web-server:latest image: wongsaang/chatgpt-ui-web-server:latest
environment: environment:
- BACKEND_URL=http://backend-wsgi-server:8000 - BACKEND_URL=http://backend-wsgi-server:8000
ports: ports:
- '9000:80' - '${SERVER_PORT:-9000}:80'
depends_on: depends_on:
- backend-wsgi-server - backend-wsgi-server
networks: networks:
- chatgpt_ui_network - chatgpt_ui_network
restart: always
networks: networks:
chatgpt_ui_network: chatgpt_ui_network:

View File

@@ -9,6 +9,15 @@
ChatGPT Web 客户端,支持多用户,支持 Mysql、PostgreSQL 等多种数据库连接进行数据持久化存储,支持多语言。提供 Docker 镜像和快速部署脚本。 ChatGPT Web 客户端,支持多用户,支持 Mysql、PostgreSQL 等多种数据库连接进行数据持久化存储,支持多语言。提供 Docker 镜像和快速部署脚本。
## 📢 更新 ## 📢 更新
<details open>
<summary><strong>2023-03-10</strong></summary>
增加 2 个环境变量来控制打字机效果, 详见下方 docker-compose 配置的环境变量说明
- `NUXT_PUBLIC_TYPEWRITER` 是否开启打字机效果
- `NUXT_PUBLIC_TYPEWRITER_DELAY` 每个字的延迟时间,单位:毫秒
</details>
<details open> <details open>
<summary><strong>2023-03-04</strong></summary> <summary><strong>2023-03-04</strong></summary>
@@ -19,7 +28,7 @@ ChatGPT Web 客户端,支持多用户,支持 Mysql、PostgreSQL 等多种数
</details> </details>
<details open> <details>
<summary><strong>2023-02-24</strong></summary> <summary><strong>2023-02-24</strong></summary>
V2 是一个重要的更新,将后端功能分离为一个独立的项目,托管在 [chatgpt-ui-server](https://github.com/WongSaang/chatgpt-ui-server), 该项目使用基于 Python 的 Django 框架。 V2 是一个重要的更新,将后端功能分离为一个独立的项目,托管在 [chatgpt-ui-server](https://github.com/WongSaang/chatgpt-ui-server), 该项目使用基于 Python 的 Django 框架。
@@ -72,6 +81,9 @@ services:
image: wongsaang/chatgpt-ui-client:latest image: wongsaang/chatgpt-ui-client:latest
environment: environment:
- SERVER_DOMAIN=http://backend-web-server - 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: depends_on:
- backend-web-server - backend-web-server
ports: ports:

View File

@@ -1,6 +1,4 @@
<script setup> <script setup>
import {useConversions} from "../composables/states";
import {getConversions} from "../utils/helper";
import {useDisplay} from "vuetify"; import {useDisplay} from "vuetify";
const { $i18n } = useNuxtApp() const { $i18n } = useNuxtApp()
@@ -25,6 +23,7 @@ const setLang = (lang) => {
} }
const conversations = useConversions() const conversations = useConversions()
const currentConversation = useConversion()
const editingConversation = ref(null) const editingConversation = ref(null)
const deletingConversationIndex = ref(null) const deletingConversationIndex = ref(null)
@@ -54,6 +53,9 @@ const deleteConversation = async (index) => {
}) })
deletingConversationIndex.value = null deletingConversationIndex.value = null
if (!error.value) { if (!error.value) {
if (conversations.value[index].id === currentConversation.value.id) {
createNewConversion()
}
conversations.value.splice(index, 1) conversations.value.splice(index, 1)
} }
} }
@@ -162,7 +164,7 @@ onNuxtReady(async () => {
icon="edit" icon="edit"
size="small" size="small"
variant="text" variant="text"
@click="editConversation(cIdx)" @click.stop="editConversation(cIdx)"
> >
</v-btn> </v-btn>
<v-btn <v-btn
@@ -170,7 +172,7 @@ onNuxtReady(async () => {
size="small" size="small"
variant="text" variant="text"
:loading="deletingConversationIndex === cIdx" :loading="deletingConversationIndex === cIdx"
@click="deleteConversation(cIdx)" @click.stop="deleteConversation(cIdx)"
> >
</v-btn> </v-btn>
</div> </div>

View File

@@ -11,7 +11,9 @@ export default defineNuxtConfig({
}, },
runtimeConfig: { runtimeConfig: {
public: { public: {
appName: appName appName: appName,
typewriter: false,
typewriterDelay: 50,
} }
}, },
build: { build: {

View File

@@ -66,9 +66,13 @@ const submit = async () => {
if (error.value.data.non_field_errors) { if (error.value.data.non_field_errors) {
errorMsg.value = error.value.data.non_field_errors[0] errorMsg.value = error.value.data.non_field_errors[0]
} }
} else {
if (error.value.data.detail) {
errorMsg.value = error.value.data.detail
} else { } else {
errorMsg.value = 'Something went wrong. Please try again.' errorMsg.value = 'Something went wrong. Please try again.'
} }
}
} else { } else {
$auth.setUser(data.value.user) $auth.setUser(data.value.user)
navigateTo('/account/onboarding') navigateTo('/account/onboarding')

View File

@@ -24,19 +24,22 @@ const processMessageQueue = () => {
} }
isProcessingQueue = true isProcessingQueue = true
const nextMessage = messageQueue.shift() 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)
} else {
currentConversation.value.messages[currentConversation.value.messages.length - 1].message += nextMessage currentConversation.value.messages[currentConversation.value.messages.length - 1].message += nextMessage
isProcessingQueue = false isProcessingQueue = false
processMessageQueue() processMessageQueue()
// 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()
// }
// }, 50)
} }
let ctrl let ctrl

View File

@@ -2973,11 +2973,6 @@ markdown-it@^13.0.1:
mdurl "^1.0.1" mdurl "^1.0.1"
uc.micro "^1.0.5" uc.micro "^1.0.5"
marked@^4.2.12:
version "4.2.12"
resolved "https://registry.npmmirror.com/marked/-/marked-4.2.12.tgz#d69a64e21d71b06250da995dcd065c11083bebb5"
integrity sha512-yr8hSKa3Fv4D3jdZmtMMPghgVt6TWbk86WQaWhDloQjRSQhMMYCAro7jP7VDJrjjdV8pxVxMssXS8B8Y5DZ5aw==
material-design-icons-iconfont@^6.7.0: material-design-icons-iconfont@^6.7.0:
version "6.7.0" version "6.7.0"
resolved "https://registry.npmmirror.com/material-design-icons-iconfont/-/material-design-icons-iconfont-6.7.0.tgz#55cf0f3d7e4c76e032855b7e810b6e30535eff3c" resolved "https://registry.npmmirror.com/material-design-icons-iconfont/-/material-design-icons-iconfont-6.7.0.tgz#55cf0f3d7e4c76e032855b7e810b6e30535eff3c"