refac: pipeline valves -> filters

This commit is contained in:
Timothy J. Baek 2024-05-27 19:34:05 -07:00
parent 4fac99c5b3
commit 966f10e715

View File

@ -253,7 +253,7 @@ class PipelineMiddleware(BaseHTTPMiddleware):
model model
for model in app.state.MODELS.values() for model in app.state.MODELS.values()
if "pipeline" in model if "pipeline" in model
and model["pipeline"]["type"] == "valve" and model["pipeline"]["type"] == "filter"
and model_id and model_id
in [ in [
target_model["id"] target_model["id"]
@ -285,7 +285,7 @@ class PipelineMiddleware(BaseHTTPMiddleware):
if key != "": if key != "":
headers = {"Authorization": f"Bearer {key}"} headers = {"Authorization": f"Bearer {key}"}
r = requests.post( r = requests.post(
f"{url}/valve", f"{url}/filter",
headers=headers, headers=headers,
json={ json={
"user": user, "user": user,
@ -428,11 +428,11 @@ async def get_all_models():
async def get_models(user=Depends(get_verified_user)): async def get_models(user=Depends(get_verified_user)):
models = await get_all_models() models = await get_all_models()
# Filter out valve models # Filter out filter pipelines
models = [ models = [
model model
for model in models for model in models
if "pipeline" not in model or model["pipeline"]["type"] != "valve" if "pipeline" not in model or model["pipeline"]["type"] != "filter"
] ]
if app.state.config.ENABLE_MODEL_FILTER: if app.state.config.ENABLE_MODEL_FILTER: