feat(projekt-matching): seven Langflow wrapper components
This commit is contained in:
34
projekt-matching/components/pm_notify.py
Normal file
34
projekt-matching/components/pm_notify.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import sys
|
||||
|
||||
if "/app/langflow" not in sys.path:
|
||||
sys.path.insert(0, "/app/langflow")
|
||||
|
||||
from langflow.custom import Component
|
||||
from langflow.io import DataInput, MessageTextInput, Output, SecretStrInput
|
||||
from langflow.schema.message import Message
|
||||
|
||||
from projektmatch import stages
|
||||
from projektmatch.config import Cfg
|
||||
|
||||
|
||||
class PMNotify(Component):
|
||||
display_name = "PM 6 Notify"
|
||||
description = "Benachrichtigungs-Mail bei created + Langfuse-Trace"
|
||||
inputs = [
|
||||
DataInput(name="ctx", display_name="Context"),
|
||||
SecretStrInput(name="imap_password", display_name="Mail Password",
|
||||
value="PM_IMAP_PASSWORD", load_from_db=True,
|
||||
advanced=True),
|
||||
MessageTextInput(name="notify_to", display_name="Notify To",
|
||||
value="PM_NOTIFY_TO", load_from_db=True,
|
||||
advanced=True),
|
||||
]
|
||||
outputs = [Output(name="out", display_name="Result", method="build_out")]
|
||||
|
||||
def build_out(self) -> Message:
|
||||
cfg = Cfg(imap_password=self.imap_password, notify_to=self.notify_to)
|
||||
# stage_notify is called DIRECTLY (not via run_stage): it must run for
|
||||
# every terminal status so failed runs still post their Langfuse trace.
|
||||
ctx = stages.stage_notify(dict(self.ctx.data), cfg)
|
||||
self.status = ctx.get("status", "")
|
||||
return Message(text=stages.summary(ctx))
|
||||
Reference in New Issue
Block a user