mirror of
https://github.com/langgenius/dify.git
synced 2026-02-26 03:05:12 +00:00
Some checks failed
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Has been cancelled
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Has been cancelled
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Has been cancelled
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Has been cancelled
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Has been cancelled
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Has been cancelled
- Renamed `build_skill_artifact_set` to `build_skill_bundle` for improved clarity in asset management. - Updated references in `SkillManager` to reflect the new method name and ensure consistent handling of skill bundles. - Added `AppAssetsAttrsInitializer` to `SandboxManager` to enhance asset initialization processes. - Implemented output truncation in `SandboxBashTool` to manage long command outputs effectively.
34 lines
1005 B
Python
34 lines
1005 B
Python
import logging
|
|
|
|
from core.app_assets.paths import AssetPaths
|
|
from core.skill.entities.skill_bundle import SkillBundle
|
|
from extensions.ext_storage import storage
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class SkillManager:
|
|
@staticmethod
|
|
def load_bundle(
|
|
tenant_id: str,
|
|
app_id: str,
|
|
assets_id: str,
|
|
) -> SkillBundle:
|
|
key = AssetPaths.build_skill_bundle(tenant_id, app_id, assets_id)
|
|
try:
|
|
data = storage.load_once(key)
|
|
return SkillBundle.model_validate_json(data)
|
|
except Exception:
|
|
logger.info("Skill bundle missing or invalid for assets_id=%s", assets_id)
|
|
return SkillBundle(assets_id=assets_id)
|
|
|
|
@staticmethod
|
|
def save_bundle(
|
|
tenant_id: str,
|
|
app_id: str,
|
|
assets_id: str,
|
|
bundle: SkillBundle,
|
|
) -> None:
|
|
key = AssetPaths.build_skill_bundle(tenant_id, app_id, assets_id)
|
|
storage.save(key, bundle.model_dump_json(indent=2).encode("utf-8"))
|