fix relative paths for db path
This commit is contained in:
parent
e04d6a8a13
commit
6e3ddab42e
|
@ -4,3 +4,4 @@ pyyaml
|
|||
flask_caching
|
||||
requests
|
||||
tiktoken
|
||||
gunicorn
|
|
@ -14,11 +14,13 @@ from llm_server.routes.cache import cache
|
|||
from llm_server.routes.helpers.http import cache_control
|
||||
from llm_server.routes.v1 import bp
|
||||
|
||||
script_path = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
config_path_environ = os.getenv("CONFIG_PATH")
|
||||
if config_path_environ:
|
||||
config_path = config_path_environ
|
||||
else:
|
||||
config_path = Path(os.path.dirname(os.path.realpath(__file__)), 'config', 'config.yml')
|
||||
config_path = Path(script_path, 'config', 'config.yml')
|
||||
|
||||
default_vars = {'mode': 'oobabooga', 'log_prompts': False, 'database_path': './proxy-server.db', 'auth_required': False}
|
||||
required_vars = []
|
||||
|
@ -30,6 +32,10 @@ if not success:
|
|||
|
||||
opts.backend_url = config['backend_url'].strip('/')
|
||||
|
||||
# Resolve relative directory to the directory of the script
|
||||
if config['database_path'].startswith('./'):
|
||||
config['database_path'] = resolve_path(script_path, config['database_path'].strip('./'))
|
||||
|
||||
opts.database_path = resolve_path(config['database_path'])
|
||||
init_db(opts.database_path)
|
||||
|
||||
|
|
Reference in New Issue