feat(projekt-matching): seven Langflow wrapper components
This commit is contained in:
26
projekt-matching/components/pm_fetch.py
Normal file
26
projekt-matching/components/pm_fetch.py
Normal file
@@ -0,0 +1,26 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user