mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac
This commit is contained in:
@@ -70,7 +70,7 @@ def migrate_modelfile_to_model(migrator: Migrator, database: pw.Database):
|
||||
|
||||
# Insert the processed data into the 'model' table
|
||||
Model.create(
|
||||
id=modelfile.tag_name,
|
||||
id=f"ollama-{modelfile.tag_name}",
|
||||
user_id=modelfile.user_id,
|
||||
base_model_id=info.get("base_model_id"),
|
||||
name=modelfile.modelfile.get("title"),
|
||||
|
||||
@@ -314,10 +314,12 @@ async def get_all_models():
|
||||
model["name"] = custom_model.name
|
||||
model["info"] = custom_model.model_dump()
|
||||
else:
|
||||
|
||||
owned_by = "openai"
|
||||
for model in models:
|
||||
if custom_model.base_model_id == model["id"]:
|
||||
if (
|
||||
custom_model.base_model_id == model["id"]
|
||||
or custom_model.base_model_id == model["id"].split(":")[0]
|
||||
):
|
||||
owned_by = model["owned_by"]
|
||||
break
|
||||
|
||||
@@ -329,6 +331,7 @@ async def get_all_models():
|
||||
"created": custom_model.created_at,
|
||||
"owned_by": owned_by,
|
||||
"info": custom_model.model_dump(),
|
||||
"preset": True,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user