Skip to content

Commit

Permalink
Add environment variable WORKER_TIMEOUT and conversation response hea…
Browse files Browse the repository at this point in the history
…ders
  • Loading branch information
WongSaang committed Apr 11, 2023
1 parent 5041587 commit 15ee1db
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
10 changes: 9 additions & 1 deletion chat/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import json
import openai
import time
import datetime
import tiktoken
from .models import Conversation, Message, Setting, Prompt
Expand Down Expand Up @@ -256,7 +257,14 @@ def stream_content():
'conversationId': conversation_obj.id
})

return StreamingHttpResponse(stream_content(), content_type='text/event-stream')
response = StreamingHttpResponse(
stream_content(),
content_type='text/event-stream'
)
response['X-Accel-Buffering'] = 'no'
response['Cache-Control'] = 'no-cache'
return response



def build_messages(model, conversation_obj, web_search_params, frugal_mode = False):
Expand Down
6 changes: 5 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ services:
target: wsgi-server
environment:
APP_DOMAIN: localhost:9000
WORKER_TIMEOUT: 180
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".
# DEBUG: True
# DB_URL: postgres://postgres:postgrespw@localhost:49153/chatgpt
ports:
- '8000:8000'
networks:
- chatgpt_network
web-server:
image: wongsaang/chatgpt-ui-web-server:latest
build:
context: .
environment:
- BACKEND_URL=http://wsgi-server:8000
ports:
Expand Down
4 changes: 3 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ python manage.py createsuperuser --no-input

export WORKERS=${SERVER_WORKERS:-3}

exec gunicorn chatgpt_ui_server.wsgi --workers=$WORKERS --timeout 60 --bind 0.0.0.0:8000 --access-logfile -
export TIMEOUT=${WORKER_TIMEOUT:-180}

exec gunicorn chatgpt_ui_server.wsgi --workers=$WORKERS --timeout $TIMEOUT --bind 0.0.0.0:8000 --access-logfile -

0 comments on commit 15ee1db

Please sign in to comment.