diff --git a/config/config.yml b/config/config.yml index 67026da..87c3d50 100644 --- a/config/config.yml +++ b/config/config.yml @@ -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 \ No newline at end of file diff --git a/llm_server/llm/oobabooga/info.py b/llm_server/llm/oobabooga/info.py index 1fd3e67..e27b2fd 100644 --- a/llm_server/llm/oobabooga/info.py +++ b/llm_server/llm/oobabooga/info.py @@ -12,4 +12,4 @@ def get_running_model(): r_json = backend_response.json() return r_json['result'] except Exception as e: - return False + return False \ No newline at end of file diff --git a/llm_server/opts.py b/llm_server/opts.py index 8ec0f7f..2ae99fd 100644 --- a/llm_server/opts.py +++ b/llm_server/opts.py @@ -8,3 +8,4 @@ token_limit = 5555 database_path = './proxy-server.db' auth_required = False log_prompts = False +frontend_api_client = '' diff --git a/llm_server/routes/v1/proxy.py b/llm_server/routes/v1/proxy.py index 4fe8ad2..83a7a70 100644 --- a/llm_server/routes/v1/proxy.py +++ b/llm_server/routes/v1/proxy.py @@ -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 diff --git a/server.py b/server.py index bbb3a10..833d8df 100644 --- a/server.py +++ b/server.py @@ -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)