Skip to content

Commit d0c0d0d

Browse files
committed
fix: litellm config issue
1 parent 366679f commit d0c0d0d

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

backend/.dockerignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,11 @@ _old
44
uploads
55
.ipynb_checkpoints
66
*.db
7-
_test
7+
_test
8+
!/data
9+
/data/*
10+
!/data/litellm
11+
/data/litellm/*
12+
!data/litellm/config.yaml
13+
14+
!data/config.json

backend/config.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
from pathlib import Path
88
import json
9+
import yaml
10+
911
import markdown
1012
import requests
1113
import shutil
@@ -163,6 +165,40 @@ def parse_section(section):
163165
DOCS_DIR = f"{DATA_DIR}/docs"
164166
Path(DOCS_DIR).mkdir(parents=True, exist_ok=True)
165167

168+
169+
####################################
170+
# LITELLM_CONFIG
171+
####################################
172+
173+
174+
def create_config_file(file_path):
175+
directory = os.path.dirname(file_path)
176+
177+
# Check if directory exists, if not, create it
178+
if not os.path.exists(directory):
179+
os.makedirs(directory)
180+
181+
# Data to write into the YAML file
182+
config_data = {
183+
"general_settings": {},
184+
"litellm_settings": {},
185+
"model_list": [],
186+
"router_settings": {},
187+
}
188+
189+
# Write data to YAML file
190+
with open(file_path, "w") as file:
191+
yaml.dump(config_data, file)
192+
193+
194+
LITELLM_CONFIG_PATH = f"{DATA_DIR}/litellm/config.yaml"
195+
196+
if not os.path.exists(LITELLM_CONFIG_PATH):
197+
print("Config file doesn't exist. Creating...")
198+
create_config_file(LITELLM_CONFIG_PATH)
199+
print("Config file created successfully.")
200+
201+
166202
####################################
167203
# OLLAMA_API_BASE_URL
168204
####################################

0 commit comments

Comments
 (0)