mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 01:48:04 +08:00
feat: introduce attribute management system for sandbox
- Added AttrMap and AttrKey classes for type-safe attribute storage. - Implemented AppAssetsAttrs and SkillAttrs for managing application and skill attributes. - Refactored Sandbox and initializers to utilize the new attribute management system, enhancing modularity and clarity in asset handling.
This commit is contained in:
@ -58,6 +58,22 @@ class AppAssetService:
|
||||
session.commit()
|
||||
return assets
|
||||
|
||||
@staticmethod
|
||||
def get_tenant_app_assets(tenant_id: str, assets_id: str) -> AppAssets:
|
||||
with Session(db.engine, expire_on_commit=False) as session:
|
||||
app_assets = (
|
||||
session.query(AppAssets)
|
||||
.filter(
|
||||
AppAssets.tenant_id == tenant_id,
|
||||
AppAssets.id == assets_id,
|
||||
)
|
||||
.first()
|
||||
)
|
||||
if not app_assets:
|
||||
raise ValueError(f"App assets not found for tenant_id={tenant_id}, assets_id={assets_id}")
|
||||
|
||||
return app_assets
|
||||
|
||||
@staticmethod
|
||||
def get_assets(tenant_id: str, app_id: str, user_id: str, *, is_draft: bool) -> AppAssets | None:
|
||||
with Session(db.engine, expire_on_commit=False) as session:
|
||||
|
||||
Reference in New Issue
Block a user