mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-07-02 15:31:17 -03:00
Introduce an agent skill framework for LLM-driven metadata enrichment: - AgentCLI (py/agent_cli/): in-process wrappers around internal services using standard relative imports, eliminating the need for sys.path hacks - LLMService: centralized BYOK (bring-your-own-key) LLM client supporting OpenAI, Ollama, and custom OpenAI-compatible endpoints - PostProcessor: deterministic engine that applies LLM output via AgentCLI (replaces old handler.py + _BASE_MODEL_ALIASES approach) - SkillRegistry: filesystem-based skill discovery (skill.yaml + prompt.md) - AgentService: orchestrates skill execution with WebSocket progress - Frontend AgentManager: WebSocket listeners, skill execution, config UI - Context menu entries (single + bulk) for "Enrich Metadata (Agent)" - Settings UI for AI Provider configuration (BYOK) - Full i18n support across 9 locales Bug fixes found during review: - aiohttp.web.json_response: status_code= -> status= - settings_modal cancelEditApiKey: wrong argument position - AgentManager.isLlmConfigured: allow Ollama without API key - PostProcessor._merge_tags: lowercase all tags to match TagUpdateService
46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
"""Skill definition data structures.
|
|
|
|
Each skill is described by a :class:`SkillDefinition` that declares its
|
|
input/output schemas, whether it needs an LLM call, and what permissions
|
|
its post-processor has.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
from typing import Any, Dict, List, Optional, Tuple
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class SkillPermissions:
|
|
"""Declarative permission scope for a skill's post-processor.
|
|
|
|
These are auditable constraints — the :class:`AgentService` checks them
|
|
before invoking the handler. They are defense-in-depth, not a sandbox.
|
|
"""
|
|
|
|
write_metadata: bool = True
|
|
write_previews: bool = True
|
|
network_domains: Tuple[str, ...] = ()
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class SkillDefinition:
|
|
"""Immutable description of an agent skill."""
|
|
|
|
name: str
|
|
title: str
|
|
description: str
|
|
llm_required: bool
|
|
input_schema: Dict[str, Any] = field(default_factory=dict)
|
|
output_schema: Dict[str, Any] = field(default_factory=dict)
|
|
model_type_filter: Optional[List[str]] = None
|
|
permissions: SkillPermissions = field(default_factory=SkillPermissions)
|
|
|
|
def applies_to_model_type(self, model_type: str) -> bool:
|
|
"""Return ``True`` if this skill can run on the given model type."""
|
|
|
|
if self.model_type_filter is None:
|
|
return True
|
|
return model_type in self.model_type_filter
|