mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-23 23:13:58 +08:00
feat: mark Text Input and Text Output components as legacy (#13420)
* feat: mark Text Input and Text Output components as legacy Chat Input already handles text input natively, and the current API paradigm forwards all terminal node outputs automatically, making the Text Input and Text Output components redundant. Mark both as legacy and point users to their modern replacements: - TextInput -> ChatInput (replacement = ["input_output.ChatInput"]) - TextOutput -> ChatOutput (replacement = ["input_output.ChatOutput"]) Migrate starter templates off the Text Input component: - Knowledge Retrieval: convert the search-query Text Input to Chat Input - Blog Writer, Instagram Copywriter, Portfolio Website Code Generator, Twitter Thread Generator: inline preset Text Input values directly into their target Prompt/LLM fields and remove the now-redundant input nodes Also drop stale root-level width/height from non-note nodes in Basic Prompting, fixing a pre-existing test_width_height_at_node_level failure. Update .secrets.baseline line numbers for the edited starter templates (component code_hash false positives shifted by the node changes). * [autofix.ci] apply automated fixes * test: enable legacy toggle in Playwright specs that drag Text Input/Output Text Input and Text Output are now legacy, so they are hidden from the component sidebar by default (showLegacy=false). Specs that drag them from the sidebar must first enable the legacy toggle via the existing addLegacyComponents() helper (as freeze.spec.ts already does). Add the helper call to the 8 specs that added Text Input/Output without it, fixing the Playwright shard failures on this PR. * test: fix Blog Writer starter spec for inlined instructions field Blog Writer no longer has a separate "Instructions" Text Input node; the value is now an inlined field on the Prompt component (Text Input is legacy). Fill the Prompt's instructions field (textarea_str_instructions) instead of the removed node's textarea_str_input_value. * test: force clicks past legacy banner overlap in similarity & fileUpload specs Marking Text Input/Output legacy adds a "Legacy" warning bar that increases node height. In these two tightly-packed layouts the bar/body now overlaps an adjacent node's handle/button and intercepts the click. Force the affected clicks past the overlay (consistent with existing force-click usage in fileUploadComponent). Fixes the Shard 34 (similarity) and Shard 43 (fileUpload "use text input for file paths") failures introduced by the legacy marking. * test: dismiss legacy warning bars instead of force-clicking through them The previous force-click fix was wrong: Playwright's force click still dispatches the event at the target's coordinates, which the browser routes to the topmost element there (the overlapping "Legacy" warning bar), so the real click never reached the covered handle/button (similarity's inspection modal never opened). Add a dismissLegacyWarnings() helper and call it before the affected interactions in similarity and fileUpload. Dismissing the bars removes the extra node height, restoring the compact pre-legacy layout so the normal click lands on its intended target. * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -1944,14 +1944,14 @@
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Basic Prompting.json",
|
||||
"hashed_secret": "d6e6d7b4b115cd3b9d172623199f8c403055fecc",
|
||||
"is_verified": false,
|
||||
"line_number": 622
|
||||
"line_number": 620
|
||||
},
|
||||
{
|
||||
"type": "Hex High Entropy String",
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Basic Prompting.json",
|
||||
"hashed_secret": "2317af15ade380e78be36f9ffdc6415d596a8715",
|
||||
"is_verified": false,
|
||||
"line_number": 906,
|
||||
"line_number": 902,
|
||||
"is_secret": false
|
||||
}
|
||||
],
|
||||
@ -1961,22 +1961,14 @@
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Blog Writer.json",
|
||||
"hashed_secret": "d6e6d7b4b115cd3b9d172623199f8c403055fecc",
|
||||
"is_verified": false,
|
||||
"line_number": 536
|
||||
},
|
||||
{
|
||||
"type": "Hex High Entropy String",
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Blog Writer.json",
|
||||
"hashed_secret": "b87e1fbb6e7bc22eafe7983b42d1b2bb7e4a60c2",
|
||||
"is_verified": false,
|
||||
"line_number": 1035,
|
||||
"is_secret": false
|
||||
"line_number": 367
|
||||
},
|
||||
{
|
||||
"type": "Hex High Entropy String",
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Blog Writer.json",
|
||||
"hashed_secret": "2317af15ade380e78be36f9ffdc6415d596a8715",
|
||||
"is_verified": false,
|
||||
"line_number": 1435,
|
||||
"line_number": 1266,
|
||||
"is_secret": false
|
||||
}
|
||||
],
|
||||
@ -2139,7 +2131,7 @@
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Instagram Copywriter.json",
|
||||
"hashed_secret": "54ed260e3bc31bc77ee06754dff850981d39a66c",
|
||||
"is_verified": false,
|
||||
"line_number": 320,
|
||||
"line_number": 291,
|
||||
"is_secret": false
|
||||
},
|
||||
{
|
||||
@ -2147,14 +2139,21 @@
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Instagram Copywriter.json",
|
||||
"hashed_secret": "d6e6d7b4b115cd3b9d172623199f8c403055fecc",
|
||||
"is_verified": false,
|
||||
"line_number": 1122
|
||||
"line_number": 955
|
||||
},
|
||||
{
|
||||
"type": "Hex High Entropy String",
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Instagram Copywriter.json",
|
||||
"hashed_secret": "2098350316c1e9de52d2630f82eba3a35e04a8cc",
|
||||
"is_verified": false,
|
||||
"line_number": 1908
|
||||
},
|
||||
{
|
||||
"type": "Hex High Entropy String",
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Instagram Copywriter.json",
|
||||
"hashed_secret": "2317af15ade380e78be36f9ffdc6415d596a8715",
|
||||
"is_verified": false,
|
||||
"line_number": 2685,
|
||||
"line_number": 2492,
|
||||
"is_secret": false
|
||||
}
|
||||
],
|
||||
@ -2184,12 +2183,19 @@
|
||||
}
|
||||
],
|
||||
"src/backend/base/langflow/initial_setup/starter_projects/Knowledge Retrieval.json": [
|
||||
{
|
||||
"type": "Hex High Entropy String",
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Knowledge Retrieval.json",
|
||||
"hashed_secret": "54ed260e3bc31bc77ee06754dff850981d39a66c",
|
||||
"is_verified": false,
|
||||
"line_number": 153
|
||||
},
|
||||
{
|
||||
"type": "Hex High Entropy String",
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Knowledge Retrieval.json",
|
||||
"hashed_secret": "d6e6d7b4b115cd3b9d172623199f8c403055fecc",
|
||||
"is_verified": false,
|
||||
"line_number": 291
|
||||
"line_number": 408
|
||||
}
|
||||
],
|
||||
"src/backend/base/langflow/initial_setup/starter_projects/Market Research.json": [
|
||||
@ -2352,14 +2358,14 @@
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json",
|
||||
"hashed_secret": "d6e6d7b4b115cd3b9d172623199f8c403055fecc",
|
||||
"is_verified": false,
|
||||
"line_number": 326
|
||||
"line_number": 156
|
||||
},
|
||||
{
|
||||
"type": "Hex High Entropy String",
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json",
|
||||
"hashed_secret": "2317af15ade380e78be36f9ffdc6415d596a8715",
|
||||
"is_verified": false,
|
||||
"line_number": 1616,
|
||||
"line_number": 1446,
|
||||
"is_secret": false
|
||||
},
|
||||
{
|
||||
@ -2367,7 +2373,7 @@
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json",
|
||||
"hashed_secret": "13f728be4fd927580a98667bcd624f511f459de0",
|
||||
"is_verified": false,
|
||||
"line_number": 2022
|
||||
"line_number": 1852
|
||||
}
|
||||
],
|
||||
"src/backend/base/langflow/initial_setup/starter_projects/Price Deal Finder.json": [
|
||||
@ -2681,7 +2687,7 @@
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Twitter Thread Generator.json",
|
||||
"hashed_secret": "54ed260e3bc31bc77ee06754dff850981d39a66c",
|
||||
"is_verified": false,
|
||||
"line_number": 286,
|
||||
"line_number": 118,
|
||||
"is_secret": false
|
||||
},
|
||||
{
|
||||
@ -2689,14 +2695,14 @@
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Twitter Thread Generator.json",
|
||||
"hashed_secret": "d6e6d7b4b115cd3b9d172623199f8c403055fecc",
|
||||
"is_verified": false,
|
||||
"line_number": 704
|
||||
"line_number": 399
|
||||
},
|
||||
{
|
||||
"type": "Hex High Entropy String",
|
||||
"filename": "src/backend/base/langflow/initial_setup/starter_projects/Twitter Thread Generator.json",
|
||||
"hashed_secret": "2317af15ade380e78be36f9ffdc6415d596a8715",
|
||||
"is_verified": false,
|
||||
"line_number": 2020,
|
||||
"line_number": 1030,
|
||||
"is_secret": false
|
||||
}
|
||||
],
|
||||
|
||||
@ -335,7 +335,6 @@
|
||||
"type": "ChatInput"
|
||||
},
|
||||
"dragging": false,
|
||||
"height": 234,
|
||||
"id": "ChatInput-b6UCc",
|
||||
"measured": {
|
||||
"height": 234,
|
||||
@ -498,7 +497,6 @@
|
||||
"type": "Prompt"
|
||||
},
|
||||
"dragging": false,
|
||||
"height": 260,
|
||||
"id": "Prompt-t2oaK",
|
||||
"measured": {
|
||||
"height": 260,
|
||||
@ -852,7 +850,6 @@
|
||||
"type": "ChatOutput"
|
||||
},
|
||||
"dragging": false,
|
||||
"height": 234,
|
||||
"id": "ChatOutput-yK0AU",
|
||||
"measured": {
|
||||
"height": 234,
|
||||
@ -867,8 +864,7 @@
|
||||
"y": 872.7273956769025
|
||||
},
|
||||
"selected": false,
|
||||
"type": "genericNode",
|
||||
"width": 320
|
||||
"type": "genericNode"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
|
||||
@ -1,35 +1,6 @@
|
||||
{
|
||||
"data": {
|
||||
"edges": [
|
||||
{
|
||||
"animated": false,
|
||||
"className": "",
|
||||
"data": {
|
||||
"sourceHandle": {
|
||||
"dataType": "TextInput",
|
||||
"id": "TextInput-mM5Wa",
|
||||
"name": "text",
|
||||
"output_types": [
|
||||
"Message"
|
||||
]
|
||||
},
|
||||
"targetHandle": {
|
||||
"fieldName": "instructions",
|
||||
"id": "Prompt-BlL2w",
|
||||
"inputTypes": [
|
||||
"Message",
|
||||
"Text"
|
||||
],
|
||||
"type": "str"
|
||||
}
|
||||
},
|
||||
"id": "reactflow__edge-TextInput-mM5Wa{œdataTypeœ:œTextInputœ,œidœ:œTextInput-mM5Waœ,œnameœ:œtextœ,œoutput_typesœ:[œMessageœ]}-Prompt-BlL2w{œfieldNameœ:œinstructionsœ,œidœ:œPrompt-BlL2wœ,œinputTypesœ:[œMessageœ,œTextœ],œtypeœ:œstrœ}",
|
||||
"selected": false,
|
||||
"source": "TextInput-mM5Wa",
|
||||
"sourceHandle": "{œdataTypeœ: œTextInputœ, œidœ: œTextInput-mM5Waœ, œnameœ: œtextœ, œoutput_typesœ: [œMessageœ]}",
|
||||
"target": "Prompt-BlL2w",
|
||||
"targetHandle": "{œfieldNameœ: œinstructionsœ, œidœ: œPrompt-BlL2wœ, œinputTypesœ: [œMessageœ, œTextœ], œtypeœ: œstrœ}"
|
||||
},
|
||||
{
|
||||
"animated": false,
|
||||
"className": "",
|
||||
@ -255,7 +226,7 @@
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"type": "str",
|
||||
"value": ""
|
||||
"value": "Use the references above for style to write a new blog/tutorial about Langflow and AI. Suggest non-covered topics."
|
||||
},
|
||||
"references": {
|
||||
"advanced": false,
|
||||
@ -362,146 +333,6 @@
|
||||
"selected": false,
|
||||
"type": "genericNode"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"description": "Get text inputs from the Playground.",
|
||||
"display_name": "Instructions",
|
||||
"id": "TextInput-mM5Wa",
|
||||
"node": {
|
||||
"base_classes": [
|
||||
"Message"
|
||||
],
|
||||
"beta": false,
|
||||
"conditional_paths": [],
|
||||
"custom_fields": {},
|
||||
"description": "Get user text inputs.",
|
||||
"display_name": "Instructions",
|
||||
"documentation": "",
|
||||
"edited": false,
|
||||
"field_order": [
|
||||
"input_value",
|
||||
"use_global_variable"
|
||||
],
|
||||
"frozen": false,
|
||||
"icon": "type",
|
||||
"legacy": false,
|
||||
"lf_version": "1.4.2",
|
||||
"metadata": {
|
||||
"code_hash": "518f16485886",
|
||||
"dependencies": {
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "lfx",
|
||||
"version": null
|
||||
}
|
||||
],
|
||||
"total_dependencies": 1
|
||||
},
|
||||
"module": "lfx.components.input_output.text.TextInputComponent"
|
||||
},
|
||||
"output_types": [],
|
||||
"outputs": [
|
||||
{
|
||||
"allows_loop": false,
|
||||
"cache": true,
|
||||
"display_name": "Output Text",
|
||||
"group_outputs": false,
|
||||
"method": "text_response",
|
||||
"name": "text",
|
||||
"selected": "Message",
|
||||
"tool_mode": true,
|
||||
"types": [
|
||||
"Message"
|
||||
],
|
||||
"value": "__UNDEFINED__"
|
||||
}
|
||||
],
|
||||
"pinned": false,
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"code": {
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
"fileTypes": [],
|
||||
"file_path": "",
|
||||
"info": "",
|
||||
"list": false,
|
||||
"load_from_db": false,
|
||||
"multiline": true,
|
||||
"name": "code",
|
||||
"password": false,
|
||||
"placeholder": "",
|
||||
"required": true,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"type": "code",
|
||||
"value": "from typing import Any\n\nfrom lfx.base.io.text import TextComponent\nfrom lfx.io import BoolInput, MultilineInput, Output\nfrom lfx.schema.message import Message\n\n\nclass TextInputComponent(TextComponent):\n display_name = \"Text Input\"\n description = \"Get user text inputs.\"\n documentation: str = \"https://docs.langflow.org/text-input-and-output\"\n icon = \"type\"\n name = \"TextInput\"\n\n inputs = [\n MultilineInput(\n name=\"input_value\",\n display_name=\"Text\",\n info=\"Text to be passed as input.\",\n ),\n BoolInput(\n name=\"use_global_variable\",\n display_name=\"Use Global Variable\",\n info=\"Enable to select from global variables (shows globe icon). Disables multiline editing.\",\n value=False,\n advanced=True,\n real_time_refresh=True,\n ),\n ]\n outputs = [\n Output(display_name=\"Output Text\", name=\"text\", method=\"text_response\"),\n ]\n\n def update_build_config(self, build_config: dict, field_value: Any, field_name: str | None = None) -> dict:\n if field_name == \"use_global_variable\":\n if field_value:\n # Enable global variable mode: single-line with password masking and globe dropdown\n build_config[\"input_value\"][\"multiline\"] = False\n build_config[\"input_value\"][\"password\"] = True\n else:\n # Default mode: multiline text editing\n build_config[\"input_value\"][\"multiline\"] = True\n build_config[\"input_value\"][\"password\"] = False\n return build_config\n\n def text_response(self) -> Message:\n return Message(\n text=self.input_value,\n )\n"
|
||||
},
|
||||
"input_value": {
|
||||
"_input_type": "MultilineInput",
|
||||
"advanced": false,
|
||||
"display_name": "Text",
|
||||
"dynamic": false,
|
||||
"info": "Text to be passed as input.",
|
||||
"input_types": [
|
||||
"Message"
|
||||
],
|
||||
"list": false,
|
||||
"load_from_db": false,
|
||||
"multiline": true,
|
||||
"name": "input_value",
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": "Use the references above for style to write a new blog/tutorial about Langflow and AI. Suggest non-covered topics."
|
||||
},
|
||||
"use_global_variable": {
|
||||
"_input_type": "BoolInput",
|
||||
"advanced": true,
|
||||
"display_name": "Use Global Variable",
|
||||
"dynamic": false,
|
||||
"info": "Enable to select from global variables (shows globe icon). Disables multiline editing.",
|
||||
"list": false,
|
||||
"list_add_label": "Add More",
|
||||
"name": "use_global_variable",
|
||||
"override_skip": false,
|
||||
"placeholder": "",
|
||||
"real_time_refresh": true,
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"tool_mode": false,
|
||||
"trace_as_metadata": true,
|
||||
"track_in_telemetry": true,
|
||||
"type": "bool",
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"selected_output": "text",
|
||||
"type": "TextInput"
|
||||
},
|
||||
"dragging": false,
|
||||
"id": "TextInput-mM5Wa",
|
||||
"measured": {
|
||||
"height": 234,
|
||||
"width": 320
|
||||
},
|
||||
"position": {
|
||||
"x": 955.8314364398983,
|
||||
"y": 402.24423846638155
|
||||
},
|
||||
"positionAbsolute": {
|
||||
"x": 955.8314364398983,
|
||||
"y": 402.24423846638155
|
||||
},
|
||||
"selected": false,
|
||||
"type": "genericNode"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"description": "Display a chat message in the Playground.",
|
||||
|
||||
@ -1,35 +1,6 @@
|
||||
{
|
||||
"data": {
|
||||
"edges": [
|
||||
{
|
||||
"animated": false,
|
||||
"className": "",
|
||||
"data": {
|
||||
"sourceHandle": {
|
||||
"dataType": "TextInput",
|
||||
"id": "TextInput-4RTs6",
|
||||
"name": "text",
|
||||
"output_types": [
|
||||
"Message"
|
||||
]
|
||||
},
|
||||
"targetHandle": {
|
||||
"fieldName": "guidelines",
|
||||
"id": "Prompt-irBTi",
|
||||
"inputTypes": [
|
||||
"Message",
|
||||
"Text"
|
||||
],
|
||||
"type": "str"
|
||||
}
|
||||
},
|
||||
"id": "reactflow__edge-TextInput-4RTs6{œdataTypeœ:œTextInputœ,œidœ:œTextInput-4RTs6œ,œnameœ:œtextœ,œoutput_typesœ:[œMessageœ]}-Prompt-irBTi{œfieldNameœ:œguidelinesœ,œidœ:œPrompt-irBTiœ,œinputTypesœ:[œMessageœ,œTextœ],œtypeœ:œstrœ}",
|
||||
"selected": false,
|
||||
"source": "TextInput-4RTs6",
|
||||
"sourceHandle": "{œdataTypeœ: œTextInputœ, œidœ: œTextInput-4RTs6œ, œnameœ: œtextœ, œoutput_typesœ: [œMessageœ]}",
|
||||
"target": "Prompt-irBTi",
|
||||
"targetHandle": "{œfieldNameœ: œguidelinesœ, œidœ: œPrompt-irBTiœ, œinputTypesœ: [œMessageœ, œTextœ], œtypeœ: œstrœ}"
|
||||
},
|
||||
{
|
||||
"animated": false,
|
||||
"className": "",
|
||||
@ -678,7 +649,7 @@
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"type": "str",
|
||||
"value": ""
|
||||
"value": "Build a post for Instagram:\n\n1. **Opening Line**: Start with a powerful, intriguing question or statement to grab attention. Example: \"Ever wondered what it feels like to fly?\"\n\n2. **Main Content**: \n - Briefly share a personal story or insight related to the opening line. Keep it engaging and relatable.\n - Include valuable information or a lesson learned that your audience can benefit from.\n\n3. **Emojis**: Integrate emojis naturally within your text to emphasize key points and add a playful tone.\n\n4. **Call to Action (CTA)**: End with a clear CTA. Encourage your audience to share their thoughts, experiences, or to take a specific action. Example: \"Share your dream adventure in the comments! 🌍✈️\"\n\n5. **Hashtags**: Conclude with a selection of relevant hashtags. Place them at the end of your post to maintain focus on your message."
|
||||
},
|
||||
"template": {
|
||||
"_input_type": "PromptInput",
|
||||
@ -764,144 +735,6 @@
|
||||
"selected": false,
|
||||
"type": "genericNode"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"id": "TextInput-4RTs6",
|
||||
"node": {
|
||||
"base_classes": [
|
||||
"Message"
|
||||
],
|
||||
"beta": false,
|
||||
"conditional_paths": [],
|
||||
"custom_fields": {},
|
||||
"description": "Get user text inputs.",
|
||||
"display_name": "Text Input",
|
||||
"documentation": "",
|
||||
"edited": false,
|
||||
"field_order": [
|
||||
"input_value",
|
||||
"use_global_variable"
|
||||
],
|
||||
"frozen": false,
|
||||
"icon": "type",
|
||||
"legacy": false,
|
||||
"lf_version": "1.0.19.post2",
|
||||
"metadata": {
|
||||
"code_hash": "518f16485886",
|
||||
"dependencies": {
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "lfx",
|
||||
"version": null
|
||||
}
|
||||
],
|
||||
"total_dependencies": 1
|
||||
},
|
||||
"module": "lfx.components.input_output.text.TextInputComponent"
|
||||
},
|
||||
"output_types": [],
|
||||
"outputs": [
|
||||
{
|
||||
"allows_loop": false,
|
||||
"cache": true,
|
||||
"display_name": "Output Text",
|
||||
"group_outputs": false,
|
||||
"method": "text_response",
|
||||
"name": "text",
|
||||
"selected": "Message",
|
||||
"tool_mode": true,
|
||||
"types": [
|
||||
"Message"
|
||||
],
|
||||
"value": "__UNDEFINED__"
|
||||
}
|
||||
],
|
||||
"pinned": false,
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"code": {
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
"fileTypes": [],
|
||||
"file_path": "",
|
||||
"info": "",
|
||||
"list": false,
|
||||
"load_from_db": false,
|
||||
"multiline": true,
|
||||
"name": "code",
|
||||
"password": false,
|
||||
"placeholder": "",
|
||||
"required": true,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"type": "code",
|
||||
"value": "from typing import Any\n\nfrom lfx.base.io.text import TextComponent\nfrom lfx.io import BoolInput, MultilineInput, Output\nfrom lfx.schema.message import Message\n\n\nclass TextInputComponent(TextComponent):\n display_name = \"Text Input\"\n description = \"Get user text inputs.\"\n documentation: str = \"https://docs.langflow.org/text-input-and-output\"\n icon = \"type\"\n name = \"TextInput\"\n\n inputs = [\n MultilineInput(\n name=\"input_value\",\n display_name=\"Text\",\n info=\"Text to be passed as input.\",\n ),\n BoolInput(\n name=\"use_global_variable\",\n display_name=\"Use Global Variable\",\n info=\"Enable to select from global variables (shows globe icon). Disables multiline editing.\",\n value=False,\n advanced=True,\n real_time_refresh=True,\n ),\n ]\n outputs = [\n Output(display_name=\"Output Text\", name=\"text\", method=\"text_response\"),\n ]\n\n def update_build_config(self, build_config: dict, field_value: Any, field_name: str | None = None) -> dict:\n if field_name == \"use_global_variable\":\n if field_value:\n # Enable global variable mode: single-line with password masking and globe dropdown\n build_config[\"input_value\"][\"multiline\"] = False\n build_config[\"input_value\"][\"password\"] = True\n else:\n # Default mode: multiline text editing\n build_config[\"input_value\"][\"multiline\"] = True\n build_config[\"input_value\"][\"password\"] = False\n return build_config\n\n def text_response(self) -> Message:\n return Message(\n text=self.input_value,\n )\n"
|
||||
},
|
||||
"input_value": {
|
||||
"_input_type": "MultilineInput",
|
||||
"advanced": false,
|
||||
"display_name": "Text",
|
||||
"dynamic": false,
|
||||
"info": "Text to be passed as input.",
|
||||
"input_types": [
|
||||
"Message"
|
||||
],
|
||||
"list": false,
|
||||
"load_from_db": false,
|
||||
"multiline": true,
|
||||
"name": "input_value",
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": "Build a post for Instagram:\n\n1. **Opening Line**: Start with a powerful, intriguing question or statement to grab attention. Example: \"Ever wondered what it feels like to fly?\"\n\n2. **Main Content**: \n - Briefly share a personal story or insight related to the opening line. Keep it engaging and relatable.\n - Include valuable information or a lesson learned that your audience can benefit from.\n\n3. **Emojis**: Integrate emojis naturally within your text to emphasize key points and add a playful tone.\n\n4. **Call to Action (CTA)**: End with a clear CTA. Encourage your audience to share their thoughts, experiences, or to take a specific action. Example: \"Share your dream adventure in the comments! 🌍✈️\"\n\n5. **Hashtags**: Conclude with a selection of relevant hashtags. Place them at the end of your post to maintain focus on your message."
|
||||
},
|
||||
"use_global_variable": {
|
||||
"_input_type": "BoolInput",
|
||||
"advanced": true,
|
||||
"display_name": "Use Global Variable",
|
||||
"dynamic": false,
|
||||
"info": "Enable to select from global variables (shows globe icon). Disables multiline editing.",
|
||||
"list": false,
|
||||
"list_add_label": "Add More",
|
||||
"name": "use_global_variable",
|
||||
"override_skip": false,
|
||||
"placeholder": "",
|
||||
"real_time_refresh": true,
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"tool_mode": false,
|
||||
"trace_as_metadata": true,
|
||||
"track_in_telemetry": true,
|
||||
"type": "bool",
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"selected_output": "text",
|
||||
"type": "TextInput"
|
||||
},
|
||||
"dragging": false,
|
||||
"id": "TextInput-4RTs6",
|
||||
"measured": {
|
||||
"height": 234,
|
||||
"width": 320
|
||||
},
|
||||
"position": {
|
||||
"x": 5672.768365094557,
|
||||
"y": 3457.8151629350077
|
||||
},
|
||||
"positionAbsolute": {
|
||||
"x": 5671.190001393486,
|
||||
"y": 3422.371192525402
|
||||
},
|
||||
"selected": false,
|
||||
"type": "genericNode"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"description": "Create a prompt template with dynamic variables.",
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
"className": "",
|
||||
"data": {
|
||||
"sourceHandle": {
|
||||
"dataType": "TextInput",
|
||||
"id": "TextInput-k48NL",
|
||||
"name": "text",
|
||||
"dataType": "ChatInput",
|
||||
"id": "ChatInput-k48NL",
|
||||
"name": "message",
|
||||
"output_types": [
|
||||
"Message"
|
||||
]
|
||||
@ -21,9 +21,9 @@
|
||||
"type": "str"
|
||||
}
|
||||
},
|
||||
"id": "xy-edge__TextInput-k48NL{œdataTypeœ:œTextInputœ,œidœ:œTextInput-k48NLœ,œnameœ:œtextœ,œoutput_typesœ:[œMessageœ]}-Knowledge-kgwih{œfieldNameœ:œsearch_queryœ,œidœ:œKnowledge-kgwihœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
|
||||
"source": "TextInput-k48NL",
|
||||
"sourceHandle": "{œdataTypeœ: œTextInputœ, œidœ: œTextInput-k48NLœ, œnameœ: œtextœ, œoutput_typesœ: [œMessageœ]}",
|
||||
"id": "xy-edge__ChatInput-k48NL{œdataTypeœ:œChatInputœ,œidœ:œChatInput-k48NLœ,œnameœ:œmessageœ,œoutput_typesœ:[œMessageœ]}-Knowledge-kgwih{œfieldNameœ:œsearch_queryœ,œidœ:œKnowledge-kgwihœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
|
||||
"source": "ChatInput-k48NL",
|
||||
"sourceHandle": "{œdataTypeœ: œChatInputœ, œidœ: œChatInput-k48NLœ, œnameœ: œmessageœ, œoutput_typesœ: [œMessageœ]}",
|
||||
"target": "Knowledge-kgwih",
|
||||
"targetHandle": "{œfieldNameœ: œsearch_queryœ, œidœ: œKnowledge-kgwihœ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}"
|
||||
},
|
||||
@ -122,7 +122,9 @@
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"id": "TextInput-k48NL",
|
||||
"description": "Get chat inputs from the Playground.",
|
||||
"display_name": "Chat Input",
|
||||
"id": "ChatInput-k48NL",
|
||||
"node": {
|
||||
"base_classes": [
|
||||
"Message"
|
||||
@ -130,20 +132,25 @@
|
||||
"beta": false,
|
||||
"conditional_paths": [],
|
||||
"custom_fields": {},
|
||||
"description": "Get user text inputs.",
|
||||
"display_name": "Text Input",
|
||||
"documentation": "https://docs.langflow.org/components-io#text-input",
|
||||
"description": "Get chat inputs from the Playground.",
|
||||
"display_name": "Chat Input",
|
||||
"documentation": "",
|
||||
"edited": false,
|
||||
"field_order": [
|
||||
"input_value",
|
||||
"use_global_variable"
|
||||
"should_store_message",
|
||||
"sender",
|
||||
"sender_name",
|
||||
"session_id",
|
||||
"context_id",
|
||||
"files"
|
||||
],
|
||||
"frozen": false,
|
||||
"icon": "type",
|
||||
"icon": "MessagesSquare",
|
||||
"legacy": false,
|
||||
"lf_version": "1.5.0.post1",
|
||||
"lf_version": "1.7.0",
|
||||
"metadata": {
|
||||
"code_hash": "518f16485886",
|
||||
"code_hash": "7a26c54d89ed",
|
||||
"dependencies": {
|
||||
"dependencies": [
|
||||
{
|
||||
@ -153,18 +160,17 @@
|
||||
],
|
||||
"total_dependencies": 1
|
||||
},
|
||||
"module": "lfx.components.input_output.text.TextInputComponent"
|
||||
"module": "lfx.components.input_output.chat.ChatInput"
|
||||
},
|
||||
"minimized": false,
|
||||
"output_types": [],
|
||||
"outputs": [
|
||||
{
|
||||
"allows_loop": false,
|
||||
"cache": true,
|
||||
"display_name": "Output Text",
|
||||
"display_name": "Chat Message",
|
||||
"group_outputs": false,
|
||||
"method": "text_response",
|
||||
"name": "text",
|
||||
"method": "message_response",
|
||||
"name": "message",
|
||||
"selected": "Message",
|
||||
"tool_mode": true,
|
||||
"types": [
|
||||
@ -192,23 +198,21 @@
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"type": "code",
|
||||
"value": "from typing import Any\n\nfrom lfx.base.io.text import TextComponent\nfrom lfx.io import BoolInput, MultilineInput, Output\nfrom lfx.schema.message import Message\n\n\nclass TextInputComponent(TextComponent):\n display_name = \"Text Input\"\n description = \"Get user text inputs.\"\n documentation: str = \"https://docs.langflow.org/text-input-and-output\"\n icon = \"type\"\n name = \"TextInput\"\n\n inputs = [\n MultilineInput(\n name=\"input_value\",\n display_name=\"Text\",\n info=\"Text to be passed as input.\",\n ),\n BoolInput(\n name=\"use_global_variable\",\n display_name=\"Use Global Variable\",\n info=\"Enable to select from global variables (shows globe icon). Disables multiline editing.\",\n value=False,\n advanced=True,\n real_time_refresh=True,\n ),\n ]\n outputs = [\n Output(display_name=\"Output Text\", name=\"text\", method=\"text_response\"),\n ]\n\n def update_build_config(self, build_config: dict, field_value: Any, field_name: str | None = None) -> dict:\n if field_name == \"use_global_variable\":\n if field_value:\n # Enable global variable mode: single-line with password masking and globe dropdown\n build_config[\"input_value\"][\"multiline\"] = False\n build_config[\"input_value\"][\"password\"] = True\n else:\n # Default mode: multiline text editing\n build_config[\"input_value\"][\"multiline\"] = True\n build_config[\"input_value\"][\"password\"] = False\n return build_config\n\n def text_response(self) -> Message:\n return Message(\n text=self.input_value,\n )\n"
|
||||
"value": "from lfx.base.data.utils import IMG_FILE_TYPES, TEXT_FILE_TYPES\nfrom lfx.base.io.chat import ChatComponent\nfrom lfx.inputs.inputs import BoolInput\nfrom lfx.io import (\n DropdownInput,\n FileInput,\n MessageTextInput,\n MultilineInput,\n Output,\n)\nfrom lfx.schema.message import Message\nfrom lfx.utils.constants import (\n MESSAGE_SENDER_AI,\n MESSAGE_SENDER_NAME_USER,\n MESSAGE_SENDER_USER,\n)\n\n\nclass ChatInput(ChatComponent):\n display_name = \"Chat Input\"\n description = \"Get chat inputs from the Playground.\"\n documentation: str = \"https://docs.langflow.org/chat-input-and-output\"\n icon = \"MessagesSquare\"\n name = \"ChatInput\"\n minimized = True\n\n inputs = [\n MultilineInput(\n name=\"input_value\",\n display_name=\"Input Text\",\n value=\"\",\n info=\"Message to be passed as input.\",\n input_types=[],\n ),\n BoolInput(\n name=\"should_store_message\",\n display_name=\"Store Messages\",\n info=\"Store the message in the history.\",\n value=True,\n advanced=True,\n ),\n DropdownInput(\n name=\"sender\",\n display_name=\"Sender Type\",\n options=[MESSAGE_SENDER_AI, MESSAGE_SENDER_USER],\n value=MESSAGE_SENDER_USER,\n info=\"Type of sender.\",\n advanced=True,\n ),\n MessageTextInput(\n name=\"sender_name\",\n display_name=\"Sender Name\",\n info=\"Name of the sender.\",\n value=MESSAGE_SENDER_NAME_USER,\n advanced=True,\n ),\n MessageTextInput(\n name=\"session_id\",\n display_name=\"Session ID\",\n info=\"The session ID of the chat. If empty, the current session ID parameter will be used.\",\n advanced=True,\n ),\n MessageTextInput(\n name=\"context_id\",\n display_name=\"Context ID\",\n info=\"The context ID of the chat. Adds an extra layer to the local memory.\",\n value=\"\",\n advanced=True,\n ),\n FileInput(\n name=\"files\",\n display_name=\"Files\",\n file_types=TEXT_FILE_TYPES + IMG_FILE_TYPES,\n info=\"Files to be sent with the message.\",\n advanced=True,\n is_list=True,\n temp_file=True,\n ),\n ]\n outputs = [\n Output(display_name=\"Chat Message\", name=\"message\", method=\"message_response\"),\n ]\n\n async def message_response(self) -> Message:\n # Ensure files is a list and filter out empty/None values\n files = self.files if self.files else []\n if files and not isinstance(files, list):\n files = [files]\n # Filter out None/empty values\n files = [f for f in files if f is not None and f != \"\"]\n\n session_id = self.session_id or self.graph.session_id or \"\"\n message = await Message.create(\n text=self.input_value,\n sender=self.sender,\n sender_name=self.sender_name,\n session_id=session_id,\n context_id=self.context_id,\n files=files,\n )\n if session_id and isinstance(message, Message) and self.should_store_message:\n stored_message = await self.send_message(\n message,\n )\n self.message.value = stored_message\n message = stored_message\n\n self.status = message\n return message\n"
|
||||
},
|
||||
"input_value": {
|
||||
"_input_type": "MultilineInput",
|
||||
"advanced": false,
|
||||
"copy_field": false,
|
||||
"display_name": "Text",
|
||||
"context_id": {
|
||||
"_input_type": "MessageTextInput",
|
||||
"advanced": true,
|
||||
"display_name": "Context ID",
|
||||
"dynamic": false,
|
||||
"info": "Text to be passed as input.",
|
||||
"info": "The context ID of the chat. Adds an extra layer to the local memory.",
|
||||
"input_types": [
|
||||
"Message"
|
||||
],
|
||||
"list": false,
|
||||
"list_add_label": "Add More",
|
||||
"load_from_db": false,
|
||||
"multiline": true,
|
||||
"name": "input_value",
|
||||
"name": "context_id",
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
@ -217,37 +221,150 @@
|
||||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": "IBM Acquires DataStax"
|
||||
"value": ""
|
||||
},
|
||||
"use_global_variable": {
|
||||
"_input_type": "BoolInput",
|
||||
"files": {
|
||||
"advanced": true,
|
||||
"display_name": "Use Global Variable",
|
||||
"display_name": "Files",
|
||||
"dynamic": false,
|
||||
"info": "Enable to select from global variables (shows globe icon). Disables multiline editing.",
|
||||
"list": false,
|
||||
"list_add_label": "Add More",
|
||||
"name": "use_global_variable",
|
||||
"override_skip": false,
|
||||
"fileTypes": [
|
||||
"csv",
|
||||
"json",
|
||||
"pdf",
|
||||
"txt",
|
||||
"md",
|
||||
"mdx",
|
||||
"yaml",
|
||||
"yml",
|
||||
"xml",
|
||||
"html",
|
||||
"htm",
|
||||
"docx",
|
||||
"py",
|
||||
"sh",
|
||||
"sql",
|
||||
"js",
|
||||
"ts",
|
||||
"tsx",
|
||||
"jpg",
|
||||
"jpeg",
|
||||
"png",
|
||||
"bmp",
|
||||
"image"
|
||||
],
|
||||
"file_path": "",
|
||||
"info": "Files to be sent with the message.",
|
||||
"list": true,
|
||||
"name": "files",
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"temp_file": true,
|
||||
"title_case": false,
|
||||
"trace_as_metadata": true,
|
||||
"type": "file",
|
||||
"value": ""
|
||||
},
|
||||
"input_value": {
|
||||
"advanced": false,
|
||||
"display_name": "Input Text",
|
||||
"dynamic": false,
|
||||
"info": "Message to be passed as input.",
|
||||
"input_types": [],
|
||||
"list": false,
|
||||
"load_from_db": false,
|
||||
"multiline": true,
|
||||
"name": "input_value",
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": "IBM Acquires DataStax"
|
||||
},
|
||||
"sender": {
|
||||
"advanced": true,
|
||||
"display_name": "Sender Type",
|
||||
"dynamic": false,
|
||||
"info": "Type of sender.",
|
||||
"name": "sender",
|
||||
"options": [
|
||||
"Machine",
|
||||
"User"
|
||||
],
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": "User"
|
||||
},
|
||||
"sender_name": {
|
||||
"advanced": true,
|
||||
"display_name": "Sender Name",
|
||||
"dynamic": false,
|
||||
"info": "Name of the sender.",
|
||||
"input_types": [
|
||||
"Message"
|
||||
],
|
||||
"list": false,
|
||||
"load_from_db": false,
|
||||
"name": "sender_name",
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": "User"
|
||||
},
|
||||
"session_id": {
|
||||
"advanced": true,
|
||||
"display_name": "Session ID",
|
||||
"dynamic": false,
|
||||
"info": "The session ID of the chat. If empty, the current session ID parameter will be used.",
|
||||
"input_types": [
|
||||
"Message"
|
||||
],
|
||||
"list": false,
|
||||
"load_from_db": false,
|
||||
"name": "session_id",
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": ""
|
||||
},
|
||||
"should_store_message": {
|
||||
"_input_type": "BoolInput",
|
||||
"advanced": true,
|
||||
"display_name": "Store Messages",
|
||||
"dynamic": false,
|
||||
"info": "Store the message in the history.",
|
||||
"list": false,
|
||||
"name": "should_store_message",
|
||||
"placeholder": "",
|
||||
"real_time_refresh": true,
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"tool_mode": false,
|
||||
"trace_as_metadata": true,
|
||||
"track_in_telemetry": true,
|
||||
"type": "bool",
|
||||
"value": false
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"tool_mode": false
|
||||
}
|
||||
},
|
||||
"showNode": true,
|
||||
"type": "TextInput"
|
||||
"selected_output": "message",
|
||||
"type": "ChatInput"
|
||||
},
|
||||
"dragging": false,
|
||||
"id": "TextInput-k48NL",
|
||||
"id": "ChatInput-k48NL",
|
||||
"measured": {
|
||||
"height": 204,
|
||||
"width": 320
|
||||
|
||||
@ -29,34 +29,6 @@
|
||||
"target": "LanguageModelComponent-FtHFF",
|
||||
"targetHandle": "{œfieldNameœ: œinput_valueœ, œidœ: œLanguageModelComponent-FtHFFœ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}"
|
||||
},
|
||||
{
|
||||
"animated": false,
|
||||
"className": "",
|
||||
"data": {
|
||||
"sourceHandle": {
|
||||
"dataType": "TextInput",
|
||||
"id": "TextInput-385NK",
|
||||
"name": "text",
|
||||
"output_types": [
|
||||
"Message"
|
||||
]
|
||||
},
|
||||
"targetHandle": {
|
||||
"fieldName": "system_message",
|
||||
"id": "LanguageModelComponent-FtHFF",
|
||||
"inputTypes": [
|
||||
"Message"
|
||||
],
|
||||
"type": "str"
|
||||
}
|
||||
},
|
||||
"id": "reactflow__edge-TextInput-385NK{œdataTypeœ:œTextInputœ,œidœ:œTextInput-385NKœ,œnameœ:œtextœ,œoutput_typesœ:[œMessageœ]}-LanguageModelComponent-FtHFF{œfieldNameœ:œsystem_messageœ,œidœ:œLanguageModelComponent-FtHFFœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
|
||||
"selected": false,
|
||||
"source": "TextInput-385NK",
|
||||
"sourceHandle": "{œdataTypeœ: œTextInputœ, œidœ: œTextInput-385NKœ, œnameœ: œtextœ, œoutput_typesœ: [œMessageœ]}",
|
||||
"target": "LanguageModelComponent-FtHFF",
|
||||
"targetHandle": "{œfieldNameœ: œsystem_messageœ, œidœ: œLanguageModelComponent-FtHFFœ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}"
|
||||
},
|
||||
{
|
||||
"animated": false,
|
||||
"className": "",
|
||||
@ -150,148 +122,6 @@
|
||||
}
|
||||
],
|
||||
"nodes": [
|
||||
{
|
||||
"data": {
|
||||
"id": "TextInput-385NK",
|
||||
"node": {
|
||||
"base_classes": [
|
||||
"Message"
|
||||
],
|
||||
"beta": false,
|
||||
"category": "inputs",
|
||||
"conditional_paths": [],
|
||||
"custom_fields": {},
|
||||
"description": "Get user text inputs.",
|
||||
"display_name": "Text Input",
|
||||
"documentation": "",
|
||||
"edited": false,
|
||||
"field_order": [
|
||||
"input_value",
|
||||
"use_global_variable"
|
||||
],
|
||||
"frozen": false,
|
||||
"icon": "type",
|
||||
"key": "TextInput",
|
||||
"legacy": false,
|
||||
"lf_version": "1.6.0",
|
||||
"metadata": {
|
||||
"code_hash": "518f16485886",
|
||||
"dependencies": {
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "lfx",
|
||||
"version": null
|
||||
}
|
||||
],
|
||||
"total_dependencies": 1
|
||||
},
|
||||
"module": "lfx.components.input_output.text.TextInputComponent"
|
||||
},
|
||||
"minimized": false,
|
||||
"output_types": [],
|
||||
"outputs": [
|
||||
{
|
||||
"allows_loop": false,
|
||||
"cache": true,
|
||||
"display_name": "Output Text",
|
||||
"group_outputs": false,
|
||||
"method": "text_response",
|
||||
"name": "text",
|
||||
"selected": "Message",
|
||||
"tool_mode": true,
|
||||
"types": [
|
||||
"Message"
|
||||
],
|
||||
"value": "__UNDEFINED__"
|
||||
}
|
||||
],
|
||||
"pinned": false,
|
||||
"score": 0.0020353564437605998,
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"code": {
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
"fileTypes": [],
|
||||
"file_path": "",
|
||||
"info": "",
|
||||
"list": false,
|
||||
"load_from_db": false,
|
||||
"multiline": true,
|
||||
"name": "code",
|
||||
"password": false,
|
||||
"placeholder": "",
|
||||
"required": true,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"type": "code",
|
||||
"value": "from typing import Any\n\nfrom lfx.base.io.text import TextComponent\nfrom lfx.io import BoolInput, MultilineInput, Output\nfrom lfx.schema.message import Message\n\n\nclass TextInputComponent(TextComponent):\n display_name = \"Text Input\"\n description = \"Get user text inputs.\"\n documentation: str = \"https://docs.langflow.org/text-input-and-output\"\n icon = \"type\"\n name = \"TextInput\"\n\n inputs = [\n MultilineInput(\n name=\"input_value\",\n display_name=\"Text\",\n info=\"Text to be passed as input.\",\n ),\n BoolInput(\n name=\"use_global_variable\",\n display_name=\"Use Global Variable\",\n info=\"Enable to select from global variables (shows globe icon). Disables multiline editing.\",\n value=False,\n advanced=True,\n real_time_refresh=True,\n ),\n ]\n outputs = [\n Output(display_name=\"Output Text\", name=\"text\", method=\"text_response\"),\n ]\n\n def update_build_config(self, build_config: dict, field_value: Any, field_name: str | None = None) -> dict:\n if field_name == \"use_global_variable\":\n if field_value:\n # Enable global variable mode: single-line with password masking and globe dropdown\n build_config[\"input_value\"][\"multiline\"] = False\n build_config[\"input_value\"][\"password\"] = True\n else:\n # Default mode: multiline text editing\n build_config[\"input_value\"][\"multiline\"] = True\n build_config[\"input_value\"][\"password\"] = False\n return build_config\n\n def text_response(self) -> Message:\n return Message(\n text=self.input_value,\n )\n"
|
||||
},
|
||||
"input_value": {
|
||||
"_input_type": "MultilineInput",
|
||||
"advanced": false,
|
||||
"display_name": "Text",
|
||||
"dynamic": false,
|
||||
"info": "Text to be passed as input.",
|
||||
"input_types": [
|
||||
"Message"
|
||||
],
|
||||
"list": false,
|
||||
"list_add_label": "Add More",
|
||||
"load_from_db": false,
|
||||
"multiline": true,
|
||||
"name": "input_value",
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"tool_mode": false,
|
||||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": "Generate a single-page portfolio website using HTML and CSS that takes a resume in JSON format as input and dynamically renders the following sections with a well-structured and aesthetic layout:\n\n📌 Sections & Content Requirements:\n\t1.\tHeader:\n\t•\tDisplay the person’s name, job title, and a professional tagline prominently.\n\t•\tEnsure the name is bold and eye-catching, with subtle emphasis on the job title.\n\t2.\tAbout Me:\n\t•\tExtract and enhance the personal summary from the resume, making it engaging, concise, and readable.\n\t•\tUse short, well-structured sentences to improve clarity.\n\t3.\tExperience:\n\t•\tList past job roles with company names, durations, and a refined description of responsibilities.\n\t•\tEnsure descriptions are professionally formatted, with key contributions highlighted.\n\t4.\tProjects:\n\t•\tDisplay projects as a neatly styled list.\n\t•\tEach project includes a title, refined description, technologies used, and rounded buttons linking to GitHub or live demo (if available).\n\t5.\tSkills:\n\t•\tDisplay skills as aesthetic pill-style badges below the Skills section title. Display all skills mentioned\n\t•\tArrange in a well-balanced, ensuring readability and consistent spacing.\n\t6.\tEducation:\n\t•\tList degrees, institutions, and years attended in a clean and professional format.\n\t•\tMaintain uniformity in typography and spacing.\n\t7.\tAwards & Publications (if any):\n\t•\tIf the resume contains awards or publications, display them in a separate section.\n\t•\tEach entry includes the title, organization, and year, ensuring clean alignment.\n\t8.\tContact:\n\t•\tDisplay email, social media links, and an optional contact button.\n\t•\tEnsure social media links are clearly visible, with modern and accessible icon buttons.\n\n🎨 Styling & Aesthetic Requirements:\n\n✅ Minimalist & Elegant:\n\t•\tClean layout with ample whitespace for breathing room.\n\t•\tConsistent spacing across all sections.\n\n✅ Fast & Lightweight:\n\t•\tUse only HTML & CSS (no JavaScript required).\n\t•\tEnsure a smooth, fast-loading experience.\n\n✅ Beautiful Typography:\n\t•\tUse a modern, professional Google Font that complements the design.\n\t•\tEnsure text readability with proper size, weight, and contrast.\n\n✅ Visually Harmonious Colors & Themes:\n\t•\tFollow a cohesive color palette that ensures a modern, professional feel.\n\t•\tEnsure background colors, text colors, and section dividers are consistent and complementary.\n\t•\tAvoid hard-to-read combinations (e.g., light text on a light background).\n\n✅ Responsive & Readable Design:\n\t•\tMobile-first approach, adapting to desktop, tablet, and mobile views.\n\t•\tMaintain consistency in padding, margins, and alignment.\n\n✅ Dark Mode Support:\n\t•\tAuto-detect system settings and adjust the theme accordingly.\n\t•\tEnsure clear contrasts and readability in both light and dark modes.\n\n✅ Embedded CSS:\n\t•\tEnsure CSS is written directly in the HTML file within <style> tags for easy integration.\n\n🚀 Key Enhancements for a Superior First Impression:\n\t•\tEnsure the color scheme is visually cohesive and all text is legible against the background.\n\t•\tMaintain uniform padding and spacing for a professional, structured appearance.\n\t•\tImprove text formatting, ensuring sections are balanced and visually engaging.\n\t•\tFollow aesthetically pleasing, simple yet modern design principles.\n\n🌟 End Goal:\n\nThe final output should be a well-balanced, visually stunning, and highly readable portfolio website that immediately impresses viewers. The design must be polished, with an intuitive layout, ensuring consistency, clarity, and elegance.\nEnsuring all details in resume are well displayed in portfolio website.\nInclude all experiences, projects and education details from resume in the html code generated.\n"
|
||||
},
|
||||
"use_global_variable": {
|
||||
"_input_type": "BoolInput",
|
||||
"advanced": true,
|
||||
"display_name": "Use Global Variable",
|
||||
"dynamic": false,
|
||||
"info": "Enable to select from global variables (shows globe icon). Disables multiline editing.",
|
||||
"list": false,
|
||||
"list_add_label": "Add More",
|
||||
"name": "use_global_variable",
|
||||
"override_skip": false,
|
||||
"placeholder": "",
|
||||
"real_time_refresh": true,
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"tool_mode": false,
|
||||
"trace_as_metadata": true,
|
||||
"track_in_telemetry": true,
|
||||
"type": "bool",
|
||||
"value": false
|
||||
}
|
||||
},
|
||||
"tool_mode": false
|
||||
},
|
||||
"selected_output": "text",
|
||||
"showNode": true,
|
||||
"type": "TextInput"
|
||||
},
|
||||
"dragging": false,
|
||||
"id": "TextInput-385NK",
|
||||
"measured": {
|
||||
"height": 179,
|
||||
"width": 320
|
||||
},
|
||||
"position": {
|
||||
"x": 1750.5165749650018,
|
||||
"y": 1018.4979290286542
|
||||
},
|
||||
"selected": false,
|
||||
"type": "genericNode"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"id": "ChatOutput-ZuZUq",
|
||||
@ -1906,7 +1736,7 @@
|
||||
"trace_as_metadata": true,
|
||||
"track_in_telemetry": false,
|
||||
"type": "str",
|
||||
"value": ""
|
||||
"value": "Generate a single-page portfolio website using HTML and CSS that takes a resume in JSON format as input and dynamically renders the following sections with a well-structured and aesthetic layout:\n\n📌 Sections & Content Requirements:\n\t1.\tHeader:\n\t•\tDisplay the person’s name, job title, and a professional tagline prominently.\n\t•\tEnsure the name is bold and eye-catching, with subtle emphasis on the job title.\n\t2.\tAbout Me:\n\t•\tExtract and enhance the personal summary from the resume, making it engaging, concise, and readable.\n\t•\tUse short, well-structured sentences to improve clarity.\n\t3.\tExperience:\n\t•\tList past job roles with company names, durations, and a refined description of responsibilities.\n\t•\tEnsure descriptions are professionally formatted, with key contributions highlighted.\n\t4.\tProjects:\n\t•\tDisplay projects as a neatly styled list.\n\t•\tEach project includes a title, refined description, technologies used, and rounded buttons linking to GitHub or live demo (if available).\n\t5.\tSkills:\n\t•\tDisplay skills as aesthetic pill-style badges below the Skills section title. Display all skills mentioned\n\t•\tArrange in a well-balanced, ensuring readability and consistent spacing.\n\t6.\tEducation:\n\t•\tList degrees, institutions, and years attended in a clean and professional format.\n\t•\tMaintain uniformity in typography and spacing.\n\t7.\tAwards & Publications (if any):\n\t•\tIf the resume contains awards or publications, display them in a separate section.\n\t•\tEach entry includes the title, organization, and year, ensuring clean alignment.\n\t8.\tContact:\n\t•\tDisplay email, social media links, and an optional contact button.\n\t•\tEnsure social media links are clearly visible, with modern and accessible icon buttons.\n\n🎨 Styling & Aesthetic Requirements:\n\n✅ Minimalist & Elegant:\n\t•\tClean layout with ample whitespace for breathing room.\n\t•\tConsistent spacing across all sections.\n\n✅ Fast & Lightweight:\n\t•\tUse only HTML & CSS (no JavaScript required).\n\t•\tEnsure a smooth, fast-loading experience.\n\n✅ Beautiful Typography:\n\t•\tUse a modern, professional Google Font that complements the design.\n\t•\tEnsure text readability with proper size, weight, and contrast.\n\n✅ Visually Harmonious Colors & Themes:\n\t•\tFollow a cohesive color palette that ensures a modern, professional feel.\n\t•\tEnsure background colors, text colors, and section dividers are consistent and complementary.\n\t•\tAvoid hard-to-read combinations (e.g., light text on a light background).\n\n✅ Responsive & Readable Design:\n\t•\tMobile-first approach, adapting to desktop, tablet, and mobile views.\n\t•\tMaintain consistency in padding, margins, and alignment.\n\n✅ Dark Mode Support:\n\t•\tAuto-detect system settings and adjust the theme accordingly.\n\t•\tEnsure clear contrasts and readability in both light and dark modes.\n\n✅ Embedded CSS:\n\t•\tEnsure CSS is written directly in the HTML file within <style> tags for easy integration.\n\n🚀 Key Enhancements for a Superior First Impression:\n\t•\tEnsure the color scheme is visually cohesive and all text is legible against the background.\n\t•\tMaintain uniform padding and spacing for a professional, structured appearance.\n\t•\tImprove text formatting, ensuring sections are balanced and visually engaging.\n\t•\tFollow aesthetically pleasing, simple yet modern design principles.\n\n🌟 End Goal:\n\nThe final output should be a well-balanced, visually stunning, and highly readable portfolio website that immediately impresses viewers. The design must be polished, with an intuitive layout, ensuring consistency, clarity, and elegance.\nEnsuring all details in resume are well displayed in portfolio website.\nInclude all experiences, projects and education details from resume in the html code generated.\n"
|
||||
},
|
||||
"temperature": {
|
||||
"_input_type": "SliderInput",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,5 @@
|
||||
import { expect, test } from "../../fixtures";
|
||||
import { addLegacyComponents } from "../../utils/add-legacy-components";
|
||||
import { adjustScreenView } from "../../utils/adjust-screen-view";
|
||||
import { TID } from "../../utils/constants/testIds";
|
||||
import { TEXTS } from "../../utils/constants/texts";
|
||||
@ -18,6 +19,8 @@ test(
|
||||
|
||||
await openBlankFlow(page);
|
||||
|
||||
await addLegacyComponents(page);
|
||||
|
||||
await disableInspectPanel(page);
|
||||
|
||||
await addComponentFromSidebar(page, {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import * as dotenv from "dotenv";
|
||||
import path from "path";
|
||||
import { expect, test } from "../../fixtures";
|
||||
import { addLegacyComponents } from "../../utils/add-legacy-components";
|
||||
import { adjustScreenView } from "../../utils/adjust-screen-view";
|
||||
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
|
||||
import { TID } from "../../utils/constants/testIds";
|
||||
@ -24,6 +25,8 @@ test(
|
||||
|
||||
await page.getByTestId("blank-flow").click();
|
||||
|
||||
await addLegacyComponents(page);
|
||||
|
||||
await page.getByTestId("sidebar-search-input").click();
|
||||
await page.getByTestId("sidebar-search-input").fill(TEXTS.searchChatOutput);
|
||||
await page.waitForSelector('[data-testid="input_outputChat Output"]', {
|
||||
|
||||
@ -32,10 +32,10 @@ withEventDeliveryModes(
|
||||
.nth(0)
|
||||
.fill("https://www.originaldiving.com/blog/top-ten-turtle-facts");
|
||||
|
||||
await page.getByText("Instructions", { exact: true }).last().click();
|
||||
|
||||
// "Instructions" was a separate Text Input node; it is now an inlined
|
||||
// field on the Prompt component (Text Input is legacy).
|
||||
await page
|
||||
.getByTestId("textarea_str_input_value")
|
||||
.getByTestId("textarea_str_instructions")
|
||||
.fill(
|
||||
"Use the references above for style to write a new blog/tutorial about turtles. Suggest non-covered topics.",
|
||||
);
|
||||
|
||||
@ -3,6 +3,7 @@ import { addLegacyComponents } from "../../utils/add-legacy-components";
|
||||
import { adjustScreenView } from "../../utils/adjust-screen-view";
|
||||
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
|
||||
import { TEXTS } from "../../utils/constants/texts";
|
||||
import { dismissLegacyWarnings } from "../../utils/dismiss-legacy-warnings";
|
||||
import { unselectNodes } from "../../utils/unselect-nodes";
|
||||
import { updateOldComponents } from "../../utils/update-old-components";
|
||||
import { zoomOut } from "../../utils/zoom-out";
|
||||
@ -255,6 +256,11 @@ test(
|
||||
|
||||
await unselectNodes(page);
|
||||
|
||||
// Data to Message, Filter Data, and Text Output are legacy components; their
|
||||
// "Legacy" warning bars increase node height and can overlap the Text Output
|
||||
// inspection button. Dismiss the bars so the button is clickable.
|
||||
await dismissLegacyWarnings(page);
|
||||
|
||||
await page
|
||||
.getByTestId(/rf__node-TextOutput-[a-zA-Z0-9]{5}/)
|
||||
.getByTestId("output-inspection-output text-textoutput")
|
||||
|
||||
@ -5,6 +5,7 @@ import { addLegacyComponents } from "../../utils/add-legacy-components";
|
||||
import { adjustScreenView } from "../../utils/adjust-screen-view";
|
||||
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
|
||||
import { TEXTS } from "../../utils/constants/texts";
|
||||
import { dismissLegacyWarnings } from "../../utils/dismiss-legacy-warnings";
|
||||
import { ensureFileSelected } from "../../utils/ensure-checkbox-checked";
|
||||
import { openBlankFlow } from "../../utils/flow/open-blank-flow";
|
||||
import { generateRandomFilename } from "../../utils/generate-filename";
|
||||
@ -925,6 +926,11 @@ test(
|
||||
await page.mouse.down();
|
||||
await adjustScreenView(page);
|
||||
|
||||
// Text Input is legacy; its "Legacy" warning bar increases node height and
|
||||
// can overlap the Read File handle. Dismiss the bars so the layout stays
|
||||
// compact and the handles are clickable.
|
||||
await dismissLegacyWarnings(page);
|
||||
|
||||
// Connect first Text Input to Read File
|
||||
const targetHandle = page.getByTestId(
|
||||
"handle-file-shownode-server file path-left",
|
||||
@ -955,6 +961,9 @@ test(
|
||||
await page.mouse.down();
|
||||
await adjustScreenView(page);
|
||||
|
||||
// Dismiss the second Text Input's legacy bar before connecting it.
|
||||
await dismissLegacyWarnings(page);
|
||||
|
||||
// Connect second Text Input to Read File
|
||||
const sourceHandle2 = page
|
||||
.getByTestId("handle-textinput-shownode-output text-right")
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { expect, test } from "../../fixtures";
|
||||
import { addLegacyComponents } from "../../utils/add-legacy-components";
|
||||
import { adjustScreenView } from "../../utils/adjust-screen-view";
|
||||
import { TEXTS } from "../../utils/constants/texts";
|
||||
import { openBlankFlow } from "../../utils/flow/open-blank-flow";
|
||||
@ -10,6 +11,8 @@ test(
|
||||
async ({ page }) => {
|
||||
await openBlankFlow(page);
|
||||
|
||||
await addLegacyComponents(page);
|
||||
|
||||
await page.getByTestId("sidebar-search-input").click();
|
||||
await page.getByTestId("sidebar-search-input").fill(TEXTS.searchTextInput);
|
||||
await page.waitForSelector('[data-testid="input_outputText Input"]', {
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { expect, test } from "../../fixtures";
|
||||
import { addLegacyComponents } from "../../utils/add-legacy-components";
|
||||
import { TEXTS } from "../../utils/constants/texts";
|
||||
import { openBlankFlow } from "../../utils/flow/open-blank-flow";
|
||||
|
||||
@ -7,6 +8,9 @@ test(
|
||||
{ tag: ["@release"] },
|
||||
async ({ page }) => {
|
||||
await openBlankFlow(page);
|
||||
|
||||
await addLegacyComponents(page);
|
||||
|
||||
await page.waitForSelector('[data-testid="disclosure-input & output"]', {
|
||||
timeout: 30000,
|
||||
state: "visible",
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { expect, test } from "../../fixtures";
|
||||
import { addLegacyComponents } from "../../utils/add-legacy-components";
|
||||
import { TEXTS } from "../../utils/constants/texts";
|
||||
import { openBlankFlow } from "../../utils/flow/open-blank-flow";
|
||||
|
||||
@ -9,6 +10,8 @@ test.describe("Output Modal Copy Button", () => {
|
||||
async ({ page }) => {
|
||||
await openBlankFlow(page);
|
||||
|
||||
await addLegacyComponents(page);
|
||||
|
||||
await page.waitForSelector('[data-testid="sidebar-search-input"]', {
|
||||
timeout: 3000,
|
||||
state: "visible",
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { expect, test } from "../../fixtures";
|
||||
import { addLegacyComponents } from "../../utils/add-legacy-components";
|
||||
import { adjustScreenView } from "../../utils/adjust-screen-view";
|
||||
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
|
||||
import { TEXTS } from "../../utils/constants/texts";
|
||||
@ -17,6 +18,8 @@ test(
|
||||
|
||||
await page.getByTestId("blank-flow").click();
|
||||
|
||||
await addLegacyComponents(page);
|
||||
|
||||
await page.waitForSelector('[data-testid="canvas_controls_dropdown"]', {
|
||||
timeout: 100000,
|
||||
});
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { type Page } from "@playwright/test";
|
||||
import { expect, test } from "../../fixtures";
|
||||
import { addLegacyComponents } from "../../utils/add-legacy-components";
|
||||
import { adjustScreenView } from "../../utils/adjust-screen-view";
|
||||
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
|
||||
|
||||
@ -21,6 +22,8 @@ test(
|
||||
await awaitBootstrapTest(page);
|
||||
await page.getByTestId("blank-flow").click();
|
||||
|
||||
await addLegacyComponents(page);
|
||||
|
||||
await page.getByTestId("sidebar-search-input").click();
|
||||
await page.getByTestId("sidebar-search-input").fill(TEXTS.searchTextOutput);
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { type Page } from "@playwright/test";
|
||||
import { expect, test } from "../../fixtures";
|
||||
import { addLegacyComponents } from "../../utils/add-legacy-components";
|
||||
import { adjustScreenView } from "../../utils/adjust-screen-view";
|
||||
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
|
||||
import { TEXTS } from "../../utils/constants/texts";
|
||||
@ -53,6 +54,9 @@ test(
|
||||
|
||||
await awaitBootstrapTest(page);
|
||||
await page.getByTestId("blank-flow").click();
|
||||
|
||||
await addLegacyComponents(page);
|
||||
|
||||
await adjustScreenView(page);
|
||||
|
||||
await renameFlow(page, { flowName: randomFlowName });
|
||||
|
||||
23
src/frontend/tests/utils/dismiss-legacy-warnings.ts
Normal file
23
src/frontend/tests/utils/dismiss-legacy-warnings.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { type Page } from "@playwright/test";
|
||||
|
||||
/**
|
||||
* Dismiss every visible "Legacy" warning bar on the canvas.
|
||||
*
|
||||
* Legacy components render a warning bar at the top of their node, which
|
||||
* increases the node's height. In tightly-packed test layouts that extra
|
||||
* height can push a node's bar/body over an adjacent node's handle or button
|
||||
* and intercept clicks. Dismissing the bars restores the compact, pre-legacy
|
||||
* layout the tests were written against so the real click lands on its target.
|
||||
*/
|
||||
export async function dismissLegacyWarnings(page: Page): Promise<void> {
|
||||
const bars = page.getByTestId("dismiss-warning-bar");
|
||||
// There are only ever a handful of legacy nodes; cap iterations as a guard.
|
||||
for (let i = 0; i < 12; i++) {
|
||||
if ((await bars.count()) === 0) {
|
||||
break;
|
||||
}
|
||||
await bars.first().click();
|
||||
// Allow the dismissal to remove the bar before re-counting.
|
||||
await page.waitForTimeout(200);
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@ -11,6 +11,8 @@ class TextInputComponent(TextComponent):
|
||||
documentation: str = "https://docs.langflow.org/text-input-and-output"
|
||||
icon = "type"
|
||||
name = "TextInput"
|
||||
legacy = True
|
||||
replacement = ["input_output.ChatInput"]
|
||||
|
||||
inputs = [
|
||||
MultilineInput(
|
||||
|
||||
@ -9,6 +9,8 @@ class TextOutputComponent(TextComponent):
|
||||
documentation: str = "https://docs.langflow.org/text-input-and-output"
|
||||
icon = "type"
|
||||
name = "TextOutput"
|
||||
legacy = True
|
||||
replacement = ["input_output.ChatOutput"]
|
||||
|
||||
inputs = [
|
||||
MultilineInput(
|
||||
|
||||
Reference in New Issue
Block a user