refactor: llm decouple code executor module (#33400)

Co-authored-by: Byron.wang <byron@dify.ai>
This commit is contained in:
wangxiaolei
2026-03-16 10:06:14 +08:00
committed by GitHub
parent a6163f80d1
commit 6ef69ff880
11 changed files with 603 additions and 414 deletions

View File

@ -1,5 +1,6 @@
from __future__ import annotations
from collections.abc import Mapping
from typing import Any, Protocol
from core.model_manager import ModelInstance
@ -19,3 +20,11 @@ class ModelFactory(Protocol):
def init_model_instance(self, provider_name: str, model_name: str) -> ModelInstance:
"""Create a model instance that is ready for schema lookup and invocation."""
...
class TemplateRenderer(Protocol):
"""Port for rendering prompt templates used by LLM-compatible nodes."""
def render_jinja2(self, *, template: str, inputs: Mapping[str, Any]) -> str:
"""Render the given Jinja2 template into plain text."""
...