Files
bin/projekt-matching/components/pm_notify.py
tlg e1be3ff17e fix(projekt-matching): rename component input ctx -> ctx_in (Langflow reserves Component.ctx)
Langflow 1.10's Component base class defines ctx as a @property returning
the flow-level graph.context store; a DataInput named ctx is silently
shadowed at attribute access, so the edge-delivered payload never reaches
build_out(). Renamed the field in the five downstream Flow-2 wrappers;
build_flows.py edges target ctx_in.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 13:00:06 +02:00

35 lines
1.4 KiB
Python

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_in", 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_in.data), cfg)
self.status = ctx.get("status", "")
return Message(text=stages.summary(ctx))