mirror of
https://github.com/open-webui/open-webui
synced 2024-12-23 20:32:44 +00:00
refac
This commit is contained in:
parent
b4e73c7f19
commit
24885a2e38
@ -144,6 +144,11 @@ async def get_status():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async def get_all_models():
|
||||||
|
pipe_models = await get_pipe_models()
|
||||||
|
return pipe_models
|
||||||
|
|
||||||
|
|
||||||
def get_function_module(pipe_id: str):
|
def get_function_module(pipe_id: str):
|
||||||
# Check if function is already loaded
|
# Check if function is already loaded
|
||||||
if pipe_id not in app.state.FUNCTIONS:
|
if pipe_id not in app.state.FUNCTIONS:
|
||||||
|
@ -57,7 +57,7 @@ from open_webui.apps.webui.internal.db import Session
|
|||||||
from open_webui.apps.webui.main import (
|
from open_webui.apps.webui.main import (
|
||||||
app as webui_app,
|
app as webui_app,
|
||||||
generate_function_chat_completion,
|
generate_function_chat_completion,
|
||||||
get_pipe_models,
|
get_all_models as get_open_webui_models,
|
||||||
)
|
)
|
||||||
from open_webui.apps.webui.models.functions import Functions
|
from open_webui.apps.webui.models.functions import Functions
|
||||||
from open_webui.apps.webui.models.models import Models
|
from open_webui.apps.webui.models.models import Models
|
||||||
@ -904,11 +904,11 @@ webui_app.state.EMBEDDING_FUNCTION = retrieval_app.state.EMBEDDING_FUNCTION
|
|||||||
|
|
||||||
async def get_all_models():
|
async def get_all_models():
|
||||||
# TODO: Optimize this function
|
# TODO: Optimize this function
|
||||||
pipe_models = []
|
open_webui_models = []
|
||||||
openai_models = []
|
openai_models = []
|
||||||
ollama_models = []
|
ollama_models = []
|
||||||
|
|
||||||
pipe_models = await get_pipe_models()
|
open_webui_models = await get_open_webui_models()
|
||||||
|
|
||||||
if app.state.config.ENABLE_OPENAI_API:
|
if app.state.config.ENABLE_OPENAI_API:
|
||||||
openai_models = await get_openai_models()
|
openai_models = await get_openai_models()
|
||||||
@ -928,7 +928,7 @@ async def get_all_models():
|
|||||||
for model in ollama_models["models"]
|
for model in ollama_models["models"]
|
||||||
]
|
]
|
||||||
|
|
||||||
models = pipe_models + openai_models + ollama_models
|
models = open_webui_models + openai_models + ollama_models
|
||||||
|
|
||||||
global_action_ids = [
|
global_action_ids = [
|
||||||
function.id for function in Functions.get_global_action_functions()
|
function.id for function in Functions.get_global_action_functions()
|
||||||
|
Loading…
Reference in New Issue
Block a user