Compare commits
No commits in common. "ef5022ff64902708ef11e971dacc14e2fb4df900" and "00c5f5ac4eacaf833c0e33f0adb699f343ff6c1d" have entirely different histories.
ef5022ff64
...
00c5f5ac4e
@ -6,5 +6,4 @@ RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
RUN python3 -m pip install --upgrade pip && pip3 install --upgrade setuptools
|
||||
COPY . /web-gpt
|
||||
RUN pip3 install -r /web-gpt/requirements.txt
|
||||
RUN pip3 install waitress
|
||||
CMD cd /web-gpt && waitress-serve --listen 0.0.0.0:5000 project:app
|
||||
CMD cd /web-gpt && flask --app=project run --host=0.0.0.0
|
@ -1,7 +1,7 @@
|
||||
[app]
|
||||
NAME=APP_NAME
|
||||
SECRET_KEY=SOME_RANDOM_STRING
|
||||
HOMEPAGE_NOTICE=1. 此网站基于openAI的API提供服务\n2. 为了限制滥用,注册后需要管理员激活才能使用\n3. 为了支持多轮对话,历史聊天会保存在服务端\n4. 网站不做关键词过滤,但请不要违反相关法律\n5. GPT生成的任何内容不保证准确性,请自行甄别
|
||||
HOMEPAGE_NOTICE=1. 此网站基于openAI的API提供服务\n2. 为了限制滥用,注册后需要管理员激活才能使用\n3. 为了支持多轮对话,历史聊天会保存在服务端\n4. 网站不做关键词过滤,但请不要违反相关法律
|
||||
SQLALCHEMY_DATABASE_URI=sqlite:///sqlite.db
|
||||
#SQLALCHEMY_DATABASE_URI=mysql://username:password@server/db
|
||||
|
||||
@ -11,4 +11,4 @@ PROXY=http://127.0.0.1:7890
|
||||
[openai]
|
||||
API_KEY=
|
||||
MODEL_NAME=gpt-3.5-turbo
|
||||
PROMPT=你是一个有用的人工智能助理,你尽力确保回答的准确性,避免给出误导信息。
|
||||
PROMPT=You are a helpful assistant
|
||||
|
@ -45,6 +45,3 @@ def create_app():
|
||||
app.register_blueprint(main_blueprint)
|
||||
|
||||
return app
|
||||
|
||||
|
||||
app = create_app()
|
||||
|
@ -95,14 +95,12 @@ def chat_post():
|
||||
else:
|
||||
messages.append(
|
||||
{"role": "user", "content": chat.request})
|
||||
try:
|
||||
|
||||
openai_resp = openai.ChatCompletion.create(
|
||||
model=current_app.config['OPENAI_MODEL_NAME'],
|
||||
messages=messages
|
||||
)
|
||||
msg_resp = openai_resp['choices'][0]['message']['content']
|
||||
except:
|
||||
msg_resp = "请求错误,请尝试重发。如果持续错误,请联系管理员检查。"
|
||||
if msg_resp:
|
||||
response = {"message": msg_resp, "status": "success"}
|
||||
else:
|
||||
|
Reference in New Issue
Block a user