Add Dify integration and enhance workflow node specifications
- Introduce new fields `dify_api_url` and `dify_api_key` in `AssistantConfig` for Dify API integration. - Update `requirements.txt` to include `dify-client-python` for Dify SDK support. - Modify `config_resolver` to handle Dify connection information. - Add a new `globalNode` type in workflow specifications to provide unified settings across workflows. - Enhance node specifications with additional constraints and default values for better configuration management. - Update frontend components to support the new `globalNode` type and its properties, improving workflow editor functionality.
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
"""内部 LLM 大脑:prompt 与 workflow。
|
||||
|
||||
二者都用本地维护的 LLMContext + OpenAI 兼容 LLM,支持 cascade 与 realtime。
|
||||
workflow 的图编排(切提示/转移工具/node-active)阶段 1 仍内联在 pipeline.py,
|
||||
这里只负责提供 LLM 槽位与元数据,行为与改造前完全一致。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from models import AssistantConfig
|
||||
from pipecat.processors.aggregators.llm_context import LLMContext
|
||||
from pipecat.processors.frame_processor import FrameProcessor
|
||||
|
||||
from services.brains.base import BrainSpec
|
||||
|
||||
_CASCADE_AND_REALTIME = frozenset({"pipeline", "realtime"})
|
||||
|
||||
|
||||
class InternalBrain:
|
||||
"""prompt / workflow 共用。"""
|
||||
|
||||
def __init__(self, brain_type: str):
|
||||
self.spec = BrainSpec(
|
||||
type=brain_type,
|
||||
supported_runtime_modes=_CASCADE_AND_REALTIME,
|
||||
owns_context=True,
|
||||
)
|
||||
|
||||
async def greeting(self, cfg: AssistantConfig) -> str:
|
||||
# 内部类型的开场白由 pipeline.py 现有逻辑(workflow 起始节点 / cfg.greeting)决定,
|
||||
# 该方法仅为满足 Brain 协议,实际不在内部路径上被调用。
|
||||
return cfg.greeting
|
||||
|
||||
def build_llm(self, cfg: AssistantConfig, context: LLMContext) -> FrameProcessor:
|
||||
from services.pipecat.service_factory import create_llm
|
||||
|
||||
return create_llm(cfg)
|
||||
Reference in New Issue
Block a user