Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
d0c0d0d2
Commit
d0c0d0d2
authored
Feb 24, 2024
by
Timothy J. Baek
Browse files
fix: litellm config issue
parent
366679ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletion
+44
-1
backend/.dockerignore
backend/.dockerignore
+8
-1
backend/config.py
backend/config.py
+36
-0
No files found.
backend/.dockerignore
View file @
d0c0d0d2
...
@@ -4,4 +4,11 @@ _old
...
@@ -4,4 +4,11 @@ _old
uploads
uploads
.ipynb_checkpoints
.ipynb_checkpoints
*.db
*.db
_test
_test
\ No newline at end of file
!/data
/data/*
!/data/litellm
/data/litellm/*
!data/litellm/config.yaml
!data/config.json
\ No newline at end of file
backend/config.py
View file @
d0c0d0d2
...
@@ -6,6 +6,8 @@ from bs4 import BeautifulSoup
...
@@ -6,6 +6,8 @@ from bs4 import BeautifulSoup
from
pathlib
import
Path
from
pathlib
import
Path
import
json
import
json
import
yaml
import
markdown
import
markdown
import
requests
import
requests
import
shutil
import
shutil
...
@@ -163,6 +165,40 @@ Path(CACHE_DIR).mkdir(parents=True, exist_ok=True)
...
@@ -163,6 +165,40 @@ Path(CACHE_DIR).mkdir(parents=True, exist_ok=True)
DOCS_DIR
=
f
"
{
DATA_DIR
}
/docs"
DOCS_DIR
=
f
"
{
DATA_DIR
}
/docs"
Path
(
DOCS_DIR
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
Path
(
DOCS_DIR
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
####################################
# LITELLM_CONFIG
####################################
def
create_config_file
(
file_path
):
directory
=
os
.
path
.
dirname
(
file_path
)
# Check if directory exists, if not, create it
if
not
os
.
path
.
exists
(
directory
):
os
.
makedirs
(
directory
)
# Data to write into the YAML file
config_data
=
{
"general_settings"
:
{},
"litellm_settings"
:
{},
"model_list"
:
[],
"router_settings"
:
{},
}
# Write data to YAML file
with
open
(
file_path
,
"w"
)
as
file
:
yaml
.
dump
(
config_data
,
file
)
LITELLM_CONFIG_PATH
=
f
"
{
DATA_DIR
}
/litellm/config.yaml"
if
not
os
.
path
.
exists
(
LITELLM_CONFIG_PATH
):
print
(
"Config file doesn't exist. Creating..."
)
create_config_file
(
LITELLM_CONFIG_PATH
)
print
(
"Config file created successfully."
)
####################################
####################################
# OLLAMA_API_BASE_URL
# OLLAMA_API_BASE_URL
####################################
####################################
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment