feat: unified models integration

This commit is contained in:
Timothy J. Baek
2024-05-24 03:02:56 -07:00
parent e80e4c304a
commit 468c6398cd
9 changed files with 94 additions and 92 deletions

View File

@@ -207,7 +207,7 @@ def merge_models_lists(model_lists):
[
{
**model,
"name": model["id"],
"name": model.get("name", model["id"]),
"owned_by": "openai",
"openai": model,
"urlIdx": idx,
@@ -319,6 +319,8 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
body = body.decode("utf-8")
body = json.loads(body)
print(app.state.MODELS)
model = app.state.MODELS[body.get("model")]
idx = model["urlIdx"]

View File

@@ -276,13 +276,11 @@ async def get_models(user=Depends(get_verified_user)):
if app.state.config.ENABLE_OPENAI_API:
openai_models = await get_openai_models()
openai_app.state.MODELS = openai_models
openai_models = openai_models["data"]
if app.state.config.ENABLE_OLLAMA_API:
ollama_models = await get_ollama_models()
ollama_app.state.MODELS = ollama_models
print(ollama_models)