This commit is contained in:
Timothy Jaeryang Baek
2026-02-13 13:29:22 -06:00
parent b4c3f54f96
commit df6e38039f
11 changed files with 34 additions and 54 deletions
+3 -5
View File
@@ -551,11 +551,9 @@ async def update_knowledge_access_by_id(
)
):
form_data.access_grants = [
g for g in form_data.access_grants
if not (
g.get("principal_type") == "user"
and g.get("principal_id") == "*"
)
grant
for grant in form_data.access_grants
if not (grant.get("principal_type") == "user" and grant.get("principal_id") == "*")
]
AccessGrants.set_access_grants("knowledge", id, form_data.access_grants, db=db)
+3 -5
View File
@@ -545,11 +545,9 @@ async def update_model_access_by_id(
)
):
form_data.access_grants = [
g for g in form_data.access_grants
if not (
g.get("principal_type") == "user"
and g.get("principal_id") == "*"
)
grant
for grant in form_data.access_grants
if not (grant.get("principal_type") == "user" and grant.get("principal_id") == "*")
]
AccessGrants.set_access_grants(
+3 -5
View File
@@ -356,11 +356,9 @@ async def update_note_access_by_id(
)
):
form_data.access_grants = [
g for g in form_data.access_grants
if not (
g.get("principal_type") == "user"
and g.get("principal_id") == "*"
)
grant
for grant in form_data.access_grants
if not (grant.get("principal_type") == "user" and grant.get("principal_id") == "*")
]
AccessGrants.set_access_grants("note", id, form_data.access_grants, db=db)
-19
View File
@@ -653,10 +653,6 @@ async def unload_model(
await get_all_models(request, user=user)
models = request.app.state.OLLAMA_MODELS
# Canonicalize model name (if not supplied with version)
if ":" not in model_name:
model_name = f"{model_name}:latest"
if model_name not in models:
raise HTTPException(
status_code=400, detail=ERROR_MESSAGES.MODEL_NOT_FOUND(model_name)
@@ -1353,9 +1349,6 @@ async def generate_chat_completion(
detail="Model not found",
)
if ":" not in payload["model"]:
payload["model"] = f"{payload['model']}:latest"
url, url_idx = await get_ollama_url(request, payload["model"], url_idx)
api_config = request.app.state.config.OLLAMA_API_CONFIGS.get(
str(url_idx),
@@ -1432,9 +1425,6 @@ async def generate_openai_completion(
del payload["metadata"]
model_id = form_data.model
if ":" not in model_id:
model_id = f"{model_id}:latest"
model_info = Models.get_model_by_id(model_id)
if model_info:
if model_info.base_model_id:
@@ -1466,9 +1456,6 @@ async def generate_openai_completion(
detail="Model not found",
)
if ":" not in payload["model"]:
payload["model"] = f"{payload['model']}:latest"
url, url_idx = await get_ollama_url(request, payload["model"], url_idx)
api_config = request.app.state.config.OLLAMA_API_CONFIGS.get(
str(url_idx),
@@ -1518,9 +1505,6 @@ async def generate_openai_chat_completion(
del payload["metadata"]
model_id = completion_form.model
if ":" not in model_id:
model_id = f"{model_id}:latest"
model_info = Models.get_model_by_id(model_id)
if model_info:
if model_info.base_model_id:
@@ -1556,9 +1540,6 @@ async def generate_openai_chat_completion(
detail="Model not found",
)
if ":" not in payload["model"]:
payload["model"] = f"{payload['model']}:latest"
url, url_idx = await get_ollama_url(request, payload["model"], url_idx)
api_config = request.app.state.config.OLLAMA_API_CONFIGS.get(
str(url_idx),
+3 -5
View File
@@ -476,11 +476,9 @@ async def update_prompt_access_by_id(
)
):
form_data.access_grants = [
g for g in form_data.access_grants
if not (
g.get("principal_type") == "user"
and g.get("principal_id") == "*"
)
grant
for grant in form_data.access_grants
if not (grant.get("principal_type") == "user" and grant.get("principal_id") == "*")
]
AccessGrants.set_access_grants("prompt", prompt_id, form_data.access_grants, db=db)
+3 -5
View File
@@ -352,11 +352,9 @@ async def update_skill_access_by_id(
)
):
form_data.access_grants = [
g for g in form_data.access_grants
if not (
g.get("principal_type") == "user"
and g.get("principal_id") == "*"
)
grant
for grant in form_data.access_grants
if not (grant.get("principal_type") == "user" and grant.get("principal_id") == "*")
]
AccessGrants.set_access_grants("skill", id, form_data.access_grants, db=db)
+3 -5
View File
@@ -566,11 +566,9 @@ async def update_tool_access_by_id(
)
):
form_data.access_grants = [
g for g in form_data.access_grants
if not (
g.get("principal_type") == "user"
and g.get("principal_id") == "*"
)
grant
for grant in form_data.access_grants
if not (grant.get("principal_type") == "user" and grant.get("principal_id") == "*")
]
AccessGrants.set_access_grants("tool", id, form_data.access_grants, db=db)