more proxy stats

This commit is contained in:
Cyberes 2023-08-22 16:50:49 -06:00
parent d8d5514aea
commit a59dcea2da
5 changed files with 10 additions and 3 deletions

View File

@ -8,4 +8,7 @@ concurrent_gens: 3
backend_url: http://172.0.0.2:9104
# Path that is shown to users for them to connect to
frontend_api_client: /api
database_path: ./proxy-server.db

View File

@ -8,3 +8,4 @@ token_limit = 5555
database_path = './proxy-server.db'
auth_required = False
log_prompts = False
frontend_api_client = ''

View File

@ -1,7 +1,7 @@
import time
from datetime import datetime
from flask import jsonify
from flask import jsonify, request
from llm_server import opts
from llm_server.routes.v1.generate import concurrent_semaphore
@ -31,5 +31,7 @@ def get_stats():
'uptime': int((datetime.now() - stats.start_time).total_seconds()),
'online': online,
'mode': opts.mode,
'model': get_running_model(),
'client': f'https://{request.headers.get("Host")}/{opts.frontend_api_client.strip("/")}',
'timestamp': int(time.time())
}), 200

View File

@ -22,7 +22,7 @@ if config_path_environ:
else:
config_path = Path(script_path, 'config', 'config.yml')
default_vars = {'mode': 'oobabooga', 'log_prompts': False, 'database_path': './proxy-server.db', 'auth_required': False, 'concurrent_gens': 3}
default_vars = {'mode': 'oobabooga', 'log_prompts': False, 'database_path': './proxy-server.db', 'auth_required': False, 'concurrent_gens': 3, 'frontend_api_client': ''}
required_vars = []
config_loader = ConfigLoader(config_path, default_vars, required_vars)
success, config, msg = config_loader.load_config()
@ -45,6 +45,7 @@ opts.mode = config['mode']
opts.auth_required = config['auth_required']
opts.log_prompts = config['log_prompts']
opts.concurrent_gens = config['concurrent_gens']
opts.frontend_api_client = config['frontend_api_client']
app = Flask(__name__)
cache.init_app(app)