Giter VIP home page Giter VIP logo

chatgpt-ui-server's People

Contributors

erritis avatar shizacat avatar wongsaang avatar zeekozhu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

chatgpt-ui-server's Issues

ChatGPT Response Containing Emoji Causes Error

If GPT responds with a message that contains an emoji the response is not able to be saved to the sql table and throws an error on the screen.

..."Incorrect string value: '\\\\xF0\\\\x9F\\\\x92\\\\xA9' for column...)

The response can still be read in that session, but will not be maintained/persisted.

This was confirmed with mysql/mariadb, it may not affect sqlite or postgresql

Issue is resolved by:

  1. ensuring sql DB is set to utf8mb4-unicode-ci
  2. Change dj_database_url.config within /chatgpt_ui_server/settings.py to use OPTIONS, with charset being set to utf8mb4

Below is example for how I resolved, but it only handles mysql as I didn't know if the problem affected the other database types

in settings.py:

# define dj_database_url.config to be used below
dbcfg = dj_database_url.config('DB_URL', 'sqlite:///db.sqlite3')

# check if database engine in mysql
if dbcfg.get('ENGINE') == 'django.db.backends.mysql':
    dbcfg['OPTIONS'] = {'charset': 'utf8mb4'}

# define databases
DATABASES = {
    'default': dbcfg
}

找不到管理后台的UI文件

[15/Jul/2023 23:20:45] "GET /admin/ HTTP/1.1" 302 0
[15/Jul/2023 23:20:45] "GET /admin/login/?next=/admin/ HTTP/1.1" 200 4031
[15/Jul/2023 23:20:45] "GET /static/admin/simpleui-x/elementui/theme-chalk/index.css HTTP/1.1" 404 179
[15/Jul/2023 23:20:45] "GET /static/admin/simpleui-x/elementui/index.js?=2023.03.01 HTTP/1.1" 404 179
[15/Jul/2023 23:20:45] "GET /static/admin/simpleui-x/particles/particles.js HTTP/1.1" 404 179
[15/Jul/2023 23:20:45] "GET /static/admin/simpleui-x/particles/app.js HTTP/1.1" 404 179
[15/Jul/2023 23:20:46] "GET /static/admin/simpleui-x/js/login.js?
=3.3 HTTP/1.1" 404 179
[15/Jul/2023 23:20:46] "GET /static/admin/simpleui-x/fontawesome-free-6.2.0-web/css/all.min.css HTTP/1.1" 404 179
[15/Jul/2023 23:20:46] "GET /static/admin/simpleui-x/js/vue.min.js?=2023.03.01 HTTP/1.1" 404 179
[15/Jul/2023 23:20:46] "GET /static/admin/simpleui-x/css/login.css?
=2.1 HTTP/1.1" 404 179
[15/Jul/2023 23:20:46] "GET /static/admin/simpleui-x/img/logo.png HTTP/1.1" 404 179
[15/Jul/2023 23:20:46] "GET /static/admin/simpleui-x/img/bg.svg HTTP/1.1" 404 179
[15/Jul/2023 23:20:46] "GET /favicon.ico HTTP/1.1" 404 179
[15/Jul/2023 23:20:49] "GET /admin/login/?next=/admin/ HTTP/1.1" 200 4031
[15/Jul/2023 23:20:49] "GET /static/admin/simpleui-x/js/vue.min.js?=2023.03.01 HTTP/1.1" 404 179
[15/Jul/2023 23:20:49] "GET /static/admin/simpleui-x/elementui/index.js?
=2023.03.01 HTTP/1.1" 404 179
[15/Jul/2023 23:20:49] "GET /static/admin/simpleui-x/css/login.css?=2.1 HTTP/1.1" 404 179
[15/Jul/2023 23:20:49] "GET /static/admin/simpleui-x/js/login.js?
=3.3 HTTP/1.1" 404 179
[15/Jul/2023 23:20:49] "GET /static/admin/simpleui-x/elementui/theme-chalk/index.css HTTP/1.1" 404 179
[15/Jul/2023 23:20:49] "GET /static/admin/simpleui-x/fontawesome-free-6.2.0-web/css/all.min.css HTTP/1.1" 404 179
[15/Jul/2023 23:20:49] "GET /static/admin/simpleui-x/img/bg.svg HTTP/1.1" 404 179
[15/Jul/2023 23:20:49] "GET /static/admin/simpleui-x/particles/particles.js HTTP/1.1" 404 179
[15/Jul/2023 23:20:49] "GET /static/admin/simpleui-x/img/logo.png HTTP/1.1" 404 179
[15/Jul/2023 23:20:49] "GET /static/admin/simpleui-x/particles/app.js HTTP/1.1" 404 179
[15/Jul/2023 23:20:50] "GET /admin/login/?next=/admin/ HTTP/1.1" 200 4031
[15/Jul/2023 23:20:50] "GET /static/admin/simpleui-x/fontawesome-free-6.2.0-web/css/all.min.css HTTP/1.1" 404 179
[15/Jul/2023 23:20:50] "GET /static/admin/simpleui-x/css/login.css?=2.1 HTTP/1.1" 404 179
[15/Jul/2023 23:20:50] "GET /static/admin/simpleui-x/elementui/index.js?
=2023.03.01 HTTP/1.1" 404 179
[15/Jul/2023 23:20:50] "GET /static/admin/simpleui-x/elementui/theme-chalk/index.css HTTP/1.1" 404 179
[15/Jul/2023 23:20:50] "GET /static/admin/simpleui-x/js/vue.min.js?=2023.03.01 HTTP/1.1" 404 179
[15/Jul/2023 23:20:51] "GET /static/admin/simpleui-x/js/login.js?
=3.3 HTTP/1.1" 404 179
[15/Jul/2023 23:20:51] "GET /static/admin/simpleui-x/particles/particles.js HTTP/1.1" 404 179
[15/Jul/2023 23:20:51] "GET /static/admin/simpleui-x/particles/app.js HTTP/1.1" 404 179
[15/Jul/2023 23:20:51] "GET /static/admin/simpleui-x/img/logo.png HTTP/1.1" 404 179
[15/Jul/2023 23:20:51] "GET /static/admin/simpleui-x/img/bg.svg HTTP/1.1" 404 179

Support for LocalAI

LocalAI (https://github.com/go-skynet/LocalAI/) is a drop-in replacement for ChatGPT API allowing to serve a wide range of other models to be able to use it with ChatGPT libraries and clients.

OpenAI library allows you to override the API URL using an environment variable both in their Python and their Node version (https://github.com/go-skynet/LocalAI#clients).

It would be great if this could also be configurable here.

Ofc, this implies that no API key would be needed later for its use.

Support for Azure OpenAI

I've been struggling to get Azure OpenAI supported in a fork so that I could submit a pull request back to main. I feel others would be more proficient and it might be easy, so am expressing the desire to the community.

启动邮箱验证启动报错,

^Ckk@kkpc:/mnt/d/projects/chatuiserver$ python3 manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/home/kk/.local/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/home/kk/.local/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
autoreload.raise_last_exception()
File "/home/kk/.local/lib/python3.10/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "/home/kk/.local/lib/python3.10/site-packages/django/core/management/init.py", line 398, in execute
autoreload.check_errors(django.setup)()
File "/home/kk/.local/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/home/kk/.local/lib/python3.10/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/kk/.local/lib/python3.10/site-packages/django/apps/registry.py", line 116, in populate
app_config.import_models()
File "/home/kk/.local/lib/python3.10/site-packages/django/apps/config.py", line 269, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in call_with_frames_removed
File "/home/kk/.local/lib/python3.10/site-packages/allauth/account/models.py", line 9, in
from . import app_settings, signals
File "/home/kk/.local/lib/python3.10/site-packages/allauth/account/app_settings.py", line 373, in
app_settings = AppSettings("ACCOUNT
")
File "/home/kk/.local/lib/python3.10/site-packages/allauth/account/app_settings.py", line 27, in init
assert (
AssertionError

Isn't there any refresh token mechanism for the JWT authentication ?

Hi,

I experienced being disconnected really often, the access token has a 1 day lifetime but isn't there any refresh token mechanism to refresh it ?
The UX isn't great since it's not an app where you want maximal security like a bank application or whatever.

If it's too tedious to implement why not just using session auth ? It works fine with DRF as well

REST_FRAMEWORK = {
    "DEFAULT_AUTHENTICATION_CLASSES": [
        "rest_framework.authentication.SessionAuthentication",
        # "rest_framework.authentication.TokenAuthentication",
        # 'rest_framework_simplejwt.authentication.JWTAuthentication',
    ],
}

And is easy to implement in your (Vue) frontend with something like that :

import axios from "axios";

axios.defaults.xsrfCookieName = "csrftoken";
axios.defaults.xsrfHeaderName = "X-CSRFTOKEN";

export const BASE_API_URL = process.env.MY_DOMAIN

const axiosInstance = axios.create({
  baseURL: BASE_API_URL,
  timeout: 10000,
  withCredentials: true,
});

export { axiosInstance };

没有数据库迁移脚本,启动后找不到表

参考开发指南执行,启动后数据库没有进行迁移

Internal Server Error: /api/account/login/
Traceback (most recent call last):
  File "/Users/dev/opt/miniconda3/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/Users/dev/opt/miniconda3/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 357, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: auth_user

docker build 打包出错

docker build --target wsgi-server -t chatgpt-server-wsgi-server:latest .

docker run --rm -p 9000:8000 chatgpt-server-wsgi-server:latest

报错:
exec ./entrypoint.sh: no such file or directory

Contact details?

Hi Wong Saang, I'd like to know if there is a way to contact you and see how we can collaborate. Do you use WeChat, WhatsApp or emails? Can we have a quick chat? Thanks!

使用 sqlite 数据库,但是连接不上

使用 sqlite 数据库,定义了 DB_URL 路径,和 volumes,但是 chatgpt-ui-backend-wsgi-server 会报错:

  File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 282, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 263, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 167, in get_new_connection
    conn = Database.connect(**conn_params)
django.db.utils.OperationalError: unable to open database file

提示无法打开数据库文件。

请问还需要做什么配置吗?

以下是 docker-compose 的 backend-wsgi-server 的配置片段:

  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=sqlite:///db.sqlite3 # 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
      - [email protected] # 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 protected]  #Default sender email address
    volumes:
      - ./db.sqlite3:/app/db.sqlite3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.