fix relative paths for db path
This commit is contained in:
parent
e04d6a8a13
commit
6e3ddab42e
|
@ -3,4 +3,5 @@ flask_cors
|
||||||
pyyaml
|
pyyaml
|
||||||
flask_caching
|
flask_caching
|
||||||
requests
|
requests
|
||||||
tiktoken
|
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.helpers.http import cache_control
|
||||||
from llm_server.routes.v1 import bp
|
from llm_server.routes.v1 import bp
|
||||||
|
|
||||||
|
script_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
config_path_environ = os.getenv("CONFIG_PATH")
|
config_path_environ = os.getenv("CONFIG_PATH")
|
||||||
if config_path_environ:
|
if config_path_environ:
|
||||||
config_path = config_path_environ
|
config_path = config_path_environ
|
||||||
else:
|
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}
|
default_vars = {'mode': 'oobabooga', 'log_prompts': False, 'database_path': './proxy-server.db', 'auth_required': False}
|
||||||
required_vars = []
|
required_vars = []
|
||||||
|
@ -30,6 +32,10 @@ if not success:
|
||||||
|
|
||||||
opts.backend_url = config['backend_url'].strip('/')
|
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'])
|
opts.database_path = resolve_path(config['database_path'])
|
||||||
init_db(opts.database_path)
|
init_db(opts.database_path)
|
||||||
|
|
||||||
|
|
Reference in New Issue