There will be a wait if the queue is empty but prompts are processing

This commit is contained in:
Cyberes 2023-08-25 13:53:23 -06:00
parent 0e6aadf5e1
commit c6edeb2b70
1 changed files with 8 additions and 2 deletions

View File

@ -100,12 +100,18 @@ app.register_blueprint(bp, url_prefix='/api/v1/')
def home():
if not opts.full_client_api:
opts.full_client_api = f'https://{request.headers.get("Host")}/{opts.frontend_api_client.strip("/")}'
stats = collections.OrderedDict(sorted(generate_stats().items()))
stats = generate_stats()
if not bool(redis.get('backend_online')) or not stats['online']:
running_model = estimated_wait_sec = 'offline'
else:
running_model = opts.running_model
if stats['estimated_wait_sec'] == 0 and stats['stats']['proompts']['processing'] > 0:
# There will be a wait if the queue is empty but prompts are processing, but we don't
# know how long.
estimated_wait_sec = f"> 1 seconds"
else:
estimated_wait_sec = f"{stats['estimated_wait_sec']} seconds"
if len(config['analytics_tracking_code']):