Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor: split changes for api/controllers/console/explore/installed… (#29891)
Asuka Minato4cf65f0137d4
diff --git a/api/controllers/console/explore/installed_app.py b/api/controllers/console/explore/installed_app.pyindex 3c95779475d..e42db10ba6f 100644--- a/api/controllers/console/explore/installed_app.py+++ b/api/controllers/console/explore/installed_app.py@@ -2,7 +2,8 @@ import loggingfrom typing import Anyfrom flask import request-from flask_restx import Resource, inputs, marshal_with, reqparse+from flask_restx import Resource, marshal_with+from pydantic import BaseModelfrom sqlalchemy import and_, selectfrom werkzeug.exceptions import BadRequest, Forbidden, NotFound@@ -18,6 +19,15 @@ from services.account_service import TenantServicefrom services.enterprise.enterprise_service import EnterpriseServicefrom services.feature_service import FeatureService++class InstalledAppCreatePayload(BaseModel):+ app_id: str+++class InstalledAppUpdatePayload(BaseModel):+ is_pinned: bool | None = None++logger = logging.getLogger(__name__)@@ -105,26 +115,25 @@ class InstalledAppsListApi(Resource):@account_initialization_required@cloud_edition_billing_resource_check("apps")def post(self):- parser = reqparse.RequestParser().add_argument("app_id", type=str, required=True, help="Invalid app_id")- args = parser.parse_args()+ payload = InstalledAppCreatePayload.model_validate(console_ns.payload or {})- recommended_app = db.session.query(RecommendedApp).where(RecommendedApp.app_id == args["app_id"]).first()+ recommended_app = db.session.query(RecommendedApp).where(RecommendedApp.app_id == payload.app_id).first()if recommended_app is None:- raise NotFound("App not found")+ raise NotFound("Recommended app not found")_, current_tenant_id = current_account_with_tenant()- app = db.session.query(App).where(App.id == args["app_id"]).first()+ app = db.session.query(App).where(App.id == payload.app_id).first()if app is None:- raise NotFound("App not found")+ raise NotFound("App entity not found")if not app.is_public:raise Forbidden("You can't install a non-public app")installed_app = (db.session.query(InstalledApp)- .where(and_(InstalledApp.app_id == args["app_id"], InstalledApp.tenant_id == current_tenant_id))+ .where(and_(InstalledApp.app_id == payload.app_id, InstalledApp.tenant_id == current_tenant_id)).first())@@ -133,7 +142,7 @@ class InstalledAppsListApi(Resource):recommended_app.install_count += 1new_installed_app = InstalledApp(- app_id=args["app_id"],+ app_id=payload.app_id,tenant_id=current_tenant_id,app_owner_tenant_id=app.tenant_id,is_pinned=False,@@ -163,12 +172,11 @@ class InstalledAppApi(InstalledAppResource):return {"result": "success", "message": "App uninstalled successfully"}, 204def patch(self, installed_app):- parser = reqparse.RequestParser().add_argument("is_pinned", type=inputs.boolean)- args = parser.parse_args()+ payload = InstalledAppUpdatePayload.model_validate(console_ns.payload or {})commit_args = False- if "is_pinned" in args:- installed_app.is_pinned = args["is_pinned"]+ if payload.is_pinned is not None:+ installed_app.is_pinned = payload.is_pinnedcommit_args = Trueif commit_args: