mirror of
https://github.com/langgenius/dify.git
synced 2026-02-13 07:01:23 -05:00
- 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.
37 lines
857 B
Python
37 lines
857 B
Python
from __future__ import annotations
|
|
|
|
import logging
|
|
|
|
from core.sandbox.sandbox import Sandbox
|
|
from core.skill import SkillAttrs
|
|
from core.skill.skill_manager import SkillManager
|
|
|
|
from .base import SyncSandboxInitializer
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class SkillInitializer(SyncSandboxInitializer):
|
|
def __init__(
|
|
self,
|
|
tenant_id: str,
|
|
user_id: str,
|
|
app_id: str,
|
|
assets_id: str,
|
|
) -> None:
|
|
self._tenant_id = tenant_id
|
|
self._app_id = app_id
|
|
self._user_id = user_id
|
|
self._assets_id = assets_id
|
|
|
|
def initialize(self, sandbox: Sandbox) -> None:
|
|
bundle = SkillManager.load_bundle(
|
|
self._tenant_id,
|
|
self._app_id,
|
|
self._assets_id,
|
|
)
|
|
sandbox.attrs.set(
|
|
SkillAttrs.BUNDLE,
|
|
bundle,
|
|
)
|