27 lines
799 B
Python
27 lines
799 B
Python
import sys
|
|
|
|
if "/app/langflow" not in sys.path:
|
|
sys.path.insert(0, "/app/langflow")
|
|
|
|
import json
|
|
|
|
from langflow.custom import Component
|
|
from langflow.io import MessageTextInput, Output
|
|
from langflow.schema import Data
|
|
|
|
from projektmatch import stages
|
|
|
|
|
|
class PMFetch(Component):
|
|
display_name = "PM 1 Fetch"
|
|
description = "Projektseite abrufen (canonical URL -> Seitentext)"
|
|
inputs = [MessageTextInput(name="payload", display_name="Payload JSON")]
|
|
outputs = [Output(name="out", display_name="Context", method="build_out")]
|
|
|
|
def build_out(self) -> Data:
|
|
ctx = json.loads(self.payload)
|
|
ctx.setdefault("status", "ok")
|
|
ctx = stages.run_stage("fetch", stages.stage_fetch, ctx, None)
|
|
self.status = ctx.get("status", "")
|
|
return Data(data=ctx)
|