This commit is contained in:
Timothy Jaeryang Baek
2024-12-11 03:38:45 -08:00
parent 4819199650
commit df48eac22b
2 changed files with 204 additions and 186 deletions

View File

@@ -372,6 +372,7 @@ app.state.config.ENABLE_OLLAMA_API = ENABLE_OLLAMA_API
app.state.config.OLLAMA_BASE_URLS = OLLAMA_BASE_URLS
app.state.config.OLLAMA_API_CONFIGS = OLLAMA_API_CONFIGS
app.state.OLLAMA_MODELS = {}
########################################
#
@@ -384,6 +385,7 @@ app.state.config.OPENAI_API_BASE_URLS = OPENAI_API_BASE_URLS
app.state.config.OPENAI_API_KEYS = OPENAI_API_KEYS
app.state.config.OPENAI_API_CONFIGS = OPENAI_API_CONFIGS
app.state.OPENAI_MODELS = {}
########################################
#
@@ -607,6 +609,14 @@ app.state.config.AUTOCOMPLETE_GENERATION_INPUT_MAX_LENGTH = (
)
########################################
#
# WEBUI
#
########################################
app.state.MODELS = {}
##################################
#
# ChatCompletion Middleware
@@ -1437,7 +1447,7 @@ async def get_all_base_models():
openai_models = openai_models["data"]
if app.state.config.ENABLE_OLLAMA_API:
ollama_models = await get_ollama_models()
ollama_models = await ollama.get_all_models()
ollama_models = [
{
"id": model["model"],