mirror of
https://github.com/langgenius/dify.git
synced 2026-02-18 22:00:55 -05:00
- Replaced SkillArtifactSet with SkillBundle across various components, enhancing the organization of skill dependencies and references. - Updated SkillManager methods to load and save bundles instead of artifacts, improving clarity in asset management. - Refactored SkillCompiler to compile skills into bundles, streamlining the dependency resolution process. - Adjusted DifyCli and SandboxBashSession to utilize ToolDependencies, ensuring consistent handling of tool references. - Introduced AssetReferences for better management of file dependencies within skill bundles.
34 lines
996 B
Python
34 lines
996 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 | None:
|
|
key = AssetPaths.build_skill_artifact_set(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 None
|
|
|
|
@staticmethod
|
|
def save_bundle(
|
|
tenant_id: str,
|
|
app_id: str,
|
|
assets_id: str,
|
|
bundle: SkillBundle,
|
|
) -> None:
|
|
key = AssetPaths.build_skill_artifact_set(tenant_id, app_id, assets_id)
|
|
storage.save(key, bundle.model_dump_json(indent=2).encode("utf-8"))
|