Spaces:
Runtime error
Runtime error
import os.path | |
from pages.main_page import init_pages | |
from vector_db.vector_db_client import VectorDB | |
import configparser | |
CONFIG_MAP = {} | |
CONFIG_FILE = "conf/config.ini" | |
def init_config(): | |
print(f"init configs {CONFIG_FILE}") | |
if not os.path.exists(CONFIG_FILE): | |
raise FileNotFoundError(f'The config file {CONFIG_FILE} not found.') | |
conf = configparser.ConfigParser() | |
conf.read(CONFIG_FILE, encoding="UTF-8") | |
for selection in conf.sections(): | |
for k, v in conf.items(selection): | |
CONFIG_MAP[f'{selection}.{k}'] = v | |
if __name__ == "__main__": | |
init_config() | |
vdb = VectorDB(CONFIG_MAP) | |
server_name = CONFIG_MAP.get('server.name') | |
server_port = int(CONFIG_MAP.get('server.port')) | |
init_pages(vdb, server_name, server_port,CONFIG_MAP) | |