Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions backend/app/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
dify,
executors,
models,
shells,
tasks,
teams,
)
Expand All @@ -21,6 +22,7 @@
api_router.include_router(admin.router, prefix="/admin", tags=["admin"])
api_router.include_router(bots.router, prefix="/bots", tags=["bots"])
api_router.include_router(models.router, prefix="/models", tags=["public-models"])
api_router.include_router(shells.router, prefix="/shells", tags=["shells"])
api_router.include_router(agents.router, prefix="/agents", tags=["public-shell"])
api_router.include_router(teams.router, prefix="/teams", tags=["teams"])
api_router.include_router(tasks.router, prefix="/tasks", tags=["tasks"])
Expand Down
22 changes: 11 additions & 11 deletions backend/app/api/endpoints/adapter/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def list_models(

@router.get("/names")
def list_model_names(
agent_name: str = Query(..., description="Agent name (AgnoClaudeCode)"),
shell_type: str = Query(..., description="Shell type (Agno, ClaudeCode)"),
db: Session = Depends(get_db),
current_user: User = Depends(security.get_current_user),
):
Expand All @@ -63,15 +63,15 @@ def list_model_names(
}
"""
data = public_model_service.list_model_names(
db=db, current_user=current_user, agent_name=agent_name
db=db, current_user=current_user, shell_type=shell_type
)
return {"data": data}


@router.get("/unified")
def list_unified_models(
agent_name: Optional[str] = Query(
None, description="Agent name to filter compatible models (Agno, ClaudeCode)"
shell_type: Optional[str] = Query(
None, description="Shell type to filter compatible models (Agno, ClaudeCode)"
),
include_config: bool = Query(
False, description="Whether to include full config in response"
Expand All @@ -90,7 +90,7 @@ def list_unified_models(
important for avoiding naming conflicts when binding models.

Parameters:
- agent_name: Optional agent name to filter compatible models
- shell_type: Optional shell type to filter compatible models
- include_config: Whether to include full model config in response

Response:
Expand All @@ -109,7 +109,7 @@ def list_unified_models(
data = model_aggregation_service.list_available_models(
db=db,
current_user=current_user,
agent_name=agent_name,
shell_type=shell_type,
include_config=include_config,
)
return {"data": data}
Expand Down Expand Up @@ -354,15 +354,15 @@ def test_model_connection(

@router.get("/compatible")
def get_compatible_models(
agent_name: str = Query(..., description="Agent name (Agno or ClaudeCode)"),
shell_type: str = Query(..., description="Shell type (Agno or ClaudeCode)"),
current_user: User = Depends(security.get_current_user),
db: Session = Depends(get_db),
):
"""
Get models compatible with a specific agent type
Get models compatible with a specific shell type

Parameters:
- agent_name: "Agno" or "ClaudeCode"
- shell_type: "Agno" or "ClaudeCode"

Response:
{
Expand Down Expand Up @@ -399,9 +399,9 @@ def get_compatible_models(
model_type = env.get("model", "")

# Filter compatible models
if agent_name == "Agno" and model_type == "openai":
if shell_type == "Agno" and model_type == "openai":
compatible_models.append({"name": model_kind.name})
elif agent_name == "ClaudeCode" and model_type == "claude":
elif shell_type == "ClaudeCode" and model_type == "claude":
compatible_models.append({"name": model_kind.name})
except Exception as e:
logger.warning(f"Failed to parse model {model_kind.name}: {e}")
Expand Down
Loading