feat: combine chat history and chat store into a CRUD component#8323
Conversation
WalkthroughThis update introduces a dual-mode ("Store" and "Retrieve") operation to the Memory component and related agent components across backend and starter project configurations. Inputs and outputs are dynamically adjusted based on the selected mode, enabling both storing and retrieval of chat messages. Associated test code and starter project templates are updated to reflect these changes, including conversion of retrieved messages to DataFrame and message formats. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant MemoryComponent
participant Storage
User->>MemoryComponent: Select mode ("Store" or "Retrieve") and provide inputs
alt mode == "Store"
User->>MemoryComponent: Provide message input
MemoryComponent->>Storage: Store message
Storage-->>MemoryComponent: Confirmation / stored message
MemoryComponent-->>User: Return stored message info
else mode == "Retrieve"
User->>MemoryComponent: Provide retrieval parameters
MemoryComponent->>Storage: Retrieve messages
Storage-->>MemoryComponent: Messages DataFrame
MemoryComponent-->>User: Return messages as DataFrame
end
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (11)
🔇 Additional comments (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 18
🔭 Outside diff range comments (4)
src/backend/base/langflow/initial_setup/starter_projects/Research Agent.json (1)
990-995: 🛠️ Refactor suggestion
⚠️ Potential issueMissing
messageinfield_order.
The newly introducedmessageinput isn’t listed in the Agent node’sfield_orderarray, so it won’t appear in the intended UI sequence. Please insert"message"(for example, right after"memory"):"field_order": [ ..., "memory", + "message", "sender", "sender_name", ... ],src/backend/base/langflow/initial_setup/starter_projects/Search agent.json (1)
1024-1049: 🛠️ Refactor suggestionMissing "message" in
field_ordercauses the new input to be invisible.The newly added
"message"template entry won’t show up in the UI unless it’s also listed in the parentfield_order. Please insert"message"at the appropriate position (e.g., right after"memory") so it renders correctly.Example diff:
"field_order": [ "agent_llm", ..., "memory", + "message", "sender", ... "template", "add_current_date_tool" ],src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (1)
96-100: 💡 Verification agent❓ Verification inconclusive
Edge mappings for Memory output need updating
The edges connecting the oldmessages_textoutput handle of the Memory node have emptyoutput_typesand still reference"messages_text". Since the Memory component outputs have been replaced bydataframeandstored_messages, these edges will no longer work. Please update or remove these edges to use the correct output handles (e.g.,"dataframe"or"stored_messages") so that downstream nodes receive the expected data.Also applies to: 114-115
Update Memory node edge mappings in Meeting Summary.json
The edge definitions at lines 96–100 and 114–115 still reference the old"messages_text"handle with emptyoutput_types. Since the Memory component now exposes"dataframe"and"stored_messages"outputs, these mappings must be updated so downstream nodes receive the correct data.• File:
src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json
– Lines 96–100
– Lines 114–115Suggested diff for each occurrence:
- "sourceHandle": { - "dataType": "Memory", - "id": "Memory-9SYWU", - "name": "messages_text", - "output_types": [] + "sourceHandle": { + "dataType": "Memory", + "id": "Memory-9SYWU", + "name": "stored_messages", // or "dataframe" depending on the downstream node + "output_types": ["list"] // adjust to the correct output type(s)Please update both occurrences to use the proper handle (
"stored_messages"or"dataframe") and populateoutput_typesaccordingly.src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (1)
7-12: 🛠️ Refactor suggestionMismatch between Memory output handle and updated component outputs
The edge’s
sourceHandlestill uses"name": "messages_text"with an emptyoutput_types. It should reference the newdataframeoutput and includeDataFrameinoutput_types, otherwise the graph connection will break.Proposed diff:
"sourceHandle": { - "dataType": "Memory", - "id": "Memory-gWJrq", - "name": "messages_text", - "output_types": [] + "dataType": "Memory", + "id": "Memory-gWJrq", + "name": "dataframe", + "output_types": ["DataFrame"] }
♻️ Duplicate comments (2)
src/backend/base/langflow/initial_setup/starter_projects/Travel Planning Agents.json (2)
2713-2735: Duplicate of previous comment: 'message' missing fromfield_order.This Agent node also adds
"message"to its template without updating itsfield_order. Please apply the samefield_orderadjustment here to ensure the input is displayed correctly.
3435-3457: Duplicate of previous comment: 'message' missing fromfield_order.This Agent node likewise needs
"message"included in itsfield_order. Please update as outlined above.
🧹 Nitpick comments (4)
src/backend/base/langflow/components/helpers/store_message.py (1)
15-15: Addlegacy = Trueto mark this component as deprecated
Thelegacy = Trueflag correctly categorizes this component as part of the legacy message store. To improve developer awareness, consider emitting a deprecation warning at instantiation and updating documentation or migration guides so users adopt the new CRUD-based component instead.src/backend/base/langflow/initial_setup/starter_projects/Gmail Agent.json (1)
411-433: Verifymessageinput placement and connectivity
The new"message"field aligns with the MemoryComponent’s signature and is configured correctly (MessageTextInput,tool_mode,trace_as_input,trace_as_metadata, etc.).Please ensure:
- The
"message"key is included in thefield_orderarray so it renders in the UI.- (Optional) If you want incoming chat entries to auto-populate this field, add an edge mapping from
ChatInput→Agentonmessage.src/backend/base/langflow/components/helpers/memory.py (1)
130-137: Tiny nit – drop async call overhead when not needed
retrieve_messages_dataframecalls the entire retrieval stack even whenn_messages == 0. You could short-circuit and return an emptyDataFrameto save one DB/memory round-trip:if self.n_messages == 0: return DataFrame([])src/backend/base/langflow/initial_setup/starter_projects/Custom Component Maker.json (1)
305-327: Newmessageinput lacksdynamic=True& metadata flagsFor parity with other message inputs (e.g.,
ChatInput,Prompt.tool_placeholder) you may want:- "dynamic": false, + "dynamic": true,and possibly
"trace_as_input": trueso the playground correctly records user-provided chat content.Minor, but helps tooling consistency.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (21)
src/backend/base/langflow/components/helpers/memory.py(3 hunks)src/backend/base/langflow/components/helpers/store_message.py(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Custom Component Maker.json(6 hunks)src/backend/base/langflow/initial_setup/starter_projects/Financial Agent.json(2 hunks)src/backend/base/langflow/initial_setup/starter_projects/Gmail Agent.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Instagram Copywriter.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Invoice Summarizer.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Market Research.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json(6 hunks)src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json(6 hunks)src/backend/base/langflow/initial_setup/starter_projects/News Aggregator.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Pokédex Agent.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Price Deal Finder.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Research Agent.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/SaaS Pricing.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Search agent.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Sequential Tasks Agents.json(3 hunks)src/backend/base/langflow/initial_setup/starter_projects/Simple Agent.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Social Media Agent.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Travel Planning Agents.json(3 hunks)src/backend/base/langflow/initial_setup/starter_projects/Youtube Analysis.json(1 hunks)
🧰 Additional context used
🪛 Pylint (3.3.7)
src/backend/base/langflow/components/helpers/memory.py
[convention] 16-16: Line too long (104/100)
(C0301)
[convention] 22-22: Line too long (119/100)
(C0301)
[convention] 14-14: Missing class docstring
(C0115)
[convention] 77-77: Line too long (110/100)
(C0301)
[convention] 79-79: Line too long (117/100)
(C0301)
[convention] 155-155: Line too long (110/100)
(C0301)
[convention] 163-163: Line too long (105/100)
(C0301)
[convention] 169-169: Line too long (107/100)
(C0301)
[convention] 139-139: Missing function or method docstring
(C0116)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Update Starter Projects
- GitHub Check: Optimize new Python code in this PR
🔇 Additional comments (15)
src/backend/base/langflow/initial_setup/starter_projects/Research Agent.json (1)
1257-1279: Newmessageinput block looks correct and consistent.
The addition mirrors otherMessageTextInputinputs in this template:
_input_type,display_name, andinput_typesare aligned with existing fields (e.g.,sender_name).- Flags like
advanced,tool_mode,trace_as_input, andtrace_as_metadatafollow the established pattern.- The default
"value": ""and type"str"are appropriate.src/backend/base/langflow/initial_setup/starter_projects/Simple Agent.json (1)
1536-1558: Newmessageinput aligns with MemoryComponent schema.The
MessageTextInputdefinition (withinput_types: ["Message"],tool_mode: true, and tracing flags) correctly mirrors the corresponding input inMemoryComponent.inputs. This will enable agents to accept and store chat messages as intended.src/backend/base/langflow/initial_setup/starter_projects/Invoice Summarizer.json (1)
1505-1527: Addmessageinput for storing chat messages
The newmessagefield is correctly introduced as aMessageTextInputwithtool_modeenabled and proper tracing flags (trace_as_input,trace_as_metadata). This aligns the Agent component’s input schema with the MemoryComponent enhancements applied across other starter project templates.src/backend/base/langflow/initial_setup/starter_projects/Instagram Copywriter.json (1)
1627-1649: Addmessageinput for chat storage
The new"message"field aligns with otherMessageTextInputdefinitions and enables agents to accept a chat message for persistence. Its properties (advanced, tool_mode, trace flags) mirror existing inputs. Please verify that the AgentComponent’s Python side consumes thismessageinput (e.g., passes it intoMemoryComponent.set(message=...)) so that storing messages works end-to-end.src/backend/base/langflow/initial_setup/starter_projects/Financial Agent.json (2)
2603-2625: Addmessageinput to Agent-cGZsD for chat storageThis block correctly introduces a
MessageTextInputnamedmessageto theAgent-cGZsDcomponent, aligning with the updatedMemoryComponentAPI. The input’s settings (advanced, tool_mode, trace_as_input/metadata) mirror other components and support chat message persistence.
3330-3352: Addmessageinput to Agent-wqbpC for chat storageLikewise, the second agent instance (
Agent-wqbpC) receives the samemessageinput configuration, ensuring both agent nodes can accept and store chat messages consistently.src/backend/base/langflow/components/helpers/memory.py (1)
148-156: Missing capability check for external memory
store_messageusesaadd_messagesandaget_messageswithout verifying they exist on the injectedmemoryobject (onlyaget_messagesis checked inretrieve_messages).Add a defensive guard similar to:
if self.memory and not all(hasattr(self.memory, m) for m in ("aadd_messages", "aget_messages")): raise AttributeError("External Memory object must implement 'aadd_messages' and 'aget_messages'.")🧰 Tools
🪛 Pylint (3.3.7)
[convention] 155-155: Line too long (110/100)
(C0301)
src/backend/base/langflow/initial_setup/starter_projects/Custom Component Maker.json (1)
12-13:output_typeslist cleared – may break type-checking in front-end
"output_types": []was previously["Message"].
Several downstream edges (e.g., edge toPromptexpecting"Message"or"Text") still treat this handle as producing aMessage. An empty list can cause validation errors in the UI and at runtime.Please restore the
"Message"type or confirm that the consumer nodes tolerate an un-typed handle.src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (3)
2460-2460: Memory component description updated to reflect storing + retrieving
The new description clearly communicates the dual functionality of the Memory component. This aligns with the updated inputs and outputs.
2483-2491: Approve DataFrame output configuration
Theretrieve_messages_dataframemethod is correctly exposed as a dynamic DataFrame output named"dataframe"with display name"Messages". This replaces the previous text‐only output and aligns with the component enhancements.
2497-2500: Approve hidden stored‐messages output
The hidden output"stored_messages"invokingstore_messageis properly configured and marked hidden to separate store and retrieve flows.src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (4)
800-800: Updated description correctly reflects storing and retrieving capabilitiesThe component’s description now clearly mentions both storage and retrieval of chat messages, improving clarity.
823-830: Approve new dynamic “Messages” outputThe “Messages” output is correctly configured to call
retrieve_messages_dataframeand return aDataFrame.
834-840: Approve new hidden “Stored Messages” outputThe hidden
Stored Messagesoutput is properly set to invokestore_messageand return aMessage.
851-868: Skipping in-depth review of serialized code blockThe
codestring holds the Python implementation of the component—detailed review should be done in the corresponding helper module (src/backend/base/langflow/components/helpers/memory.py).
| "message": { | ||
| "_input_type": "MessageTextInput", | ||
| "advanced": true, | ||
| "display_name": "Message", | ||
| "dynamic": false, | ||
| "info": "The chat message to be stored.", | ||
| "input_types": [ | ||
| "Message" | ||
| ], | ||
| "list": false, | ||
| "list_add_label": "Add More", | ||
| "load_from_db": false, | ||
| "name": "message", | ||
| "placeholder": "", | ||
| "required": false, | ||
| "show": true, | ||
| "title_case": false, | ||
| "tool_mode": true, | ||
| "trace_as_input": true, | ||
| "trace_as_metadata": true, | ||
| "type": "str", | ||
| "value": "" | ||
| }, |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Missing ‘message’ in field_order
The newly added advanced message input is not included in the component’s field_order, so it may not surface correctly in the UI or be ordered as expected.
Add "message" right after "memory" in the "field_order" array:
--- a/src/backend/base/langflow/initial_setup/starter_projects/Youtube Analysis.json
+++ b/src/backend/base/langflow/initial_setup/starter_projects/Youtube Analysis.json
@@ "field_order": [
- "memory",
+ "memory",
+ "message",
"sender",🤖 Prompt for AI Agents
In src/backend/base/langflow/initial_setup/starter_projects/Youtube
Analysis.json around lines 1442 to 1464, the newly added "message" input field
is missing from the component's "field_order" array. To fix this, locate the
"field_order" array in the same component and insert the string "message"
immediately after "memory" to ensure the field appears correctly and in the
expected order in the UI.
| "message": { | ||
| "_input_type": "MessageTextInput", | ||
| "advanced": true, | ||
| "display_name": "Message", | ||
| "dynamic": false, | ||
| "info": "The chat message to be stored.", | ||
| "input_types": [ | ||
| "Message" | ||
| ], | ||
| "list": false, | ||
| "list_add_label": "Add More", | ||
| "load_from_db": false, | ||
| "name": "message", | ||
| "placeholder": "", | ||
| "required": false, | ||
| "show": true, | ||
| "title_case": false, | ||
| "tool_mode": true, | ||
| "trace_as_input": true, | ||
| "trace_as_metadata": true, | ||
| "type": "str", | ||
| "value": "" | ||
| }, |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Ensure the new message input is included in the UI order
You’ve added the "message" field to the Agent’s template, but the node’s "field_order" list (earlier under "node") doesn’t include "message". Without updating "field_order", this input won’t appear in the UI or flow correctly. Please insert "message" in the "field_order" array at the desired position (for example, immediately after "memory").
🤖 Prompt for AI Agents
In src/backend/base/langflow/initial_setup/starter_projects/Price Deal
Finder.json between lines 1919 and 1941, the newly added "message" input field
is missing from the node's "field_order" array. To fix this, locate the
"field_order" list earlier in the file under the "node" section and insert
"message" at the appropriate position, such as immediately after "memory", to
ensure it appears in the UI and is processed correctly in the flow.
| "message": { | ||
| "_input_type": "MessageTextInput", | ||
| "advanced": true, | ||
| "display_name": "Message", | ||
| "dynamic": false, | ||
| "info": "The chat message to be stored.", | ||
| "input_types": [ | ||
| "Message" | ||
| ], | ||
| "list": false, | ||
| "list_add_label": "Add More", | ||
| "load_from_db": false, | ||
| "name": "message", | ||
| "placeholder": "", | ||
| "required": false, | ||
| "show": true, | ||
| "title_case": false, | ||
| "tool_mode": true, | ||
| "trace_as_input": true, | ||
| "trace_as_metadata": true, | ||
| "type": "str", | ||
| "value": "" | ||
| }, |
There was a problem hiding this comment.
Missing addition to field_order for the new input.
The new "message" field is defined under the Agent template, but it isn't included in the Agent node’s field_order array. Without adding "message" to field_order, the UI won’t render this input. Please update the field_order list in the Agent node metadata to include "message" (e.g., right after "memory").
Proposed diff:
@@ "field_order": [
- "memory",
+ "memory",
+ "message",
"sender",Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/backend/base/langflow/initial_setup/starter_projects/News Aggregator.json
around lines 1237 to 1259, the new "message" input field is defined but not
included in the Agent node's "field_order" array. To fix this, locate the
"field_order" array in the Agent node metadata and add "message" to it,
preferably right after "memory", so the UI will render the new input field
correctly.
There was a problem hiding this comment.
🛠️ Refactor suggestion
Missing message in field ordering and wiring
The new message input is defined in the Agent’s template but:
- It’s not listed in the node’s
"field_order", so it won’t appear in the UI. - There’s no edge mapping a
ChatInputmessage to this new port.
Please apply these essential fixes:
--- a/src/backend/base/langflow/initial_setup/starter_projects/Pokédex Agent.json
@@ "field_order": [
- "memory",
+ "memory",
+ "message",
"sender",
"sender_name",--- a/src/backend/base/langflow/initial_setup/starter_projects/Pokédex Agent.json
@@ "edges": [
{
"data": {
"sourceHandle": {
"dataType": "ChatInput",
"id": "ChatInput-ZNO2E",
"name": "message",
"output_types": ["Message"]
},
"targetHandle": {
- "fieldName": "input_value",
+ "fieldName": "message",
"id": "Agent-iU8sJ",
"inputTypes": ["Message"],
"type": "str"
}
},These changes will surface the new port in the UI and wire it correctly.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "message": { | |
| "_input_type": "MessageTextInput", | |
| "advanced": true, | |
| "display_name": "Message", | |
| "dynamic": false, | |
| "info": "The chat message to be stored.", | |
| "input_types": [ | |
| "Message" | |
| ], | |
| "list": false, | |
| "list_add_label": "Add More", | |
| "load_from_db": false, | |
| "name": "message", | |
| "placeholder": "", | |
| "required": false, | |
| "show": true, | |
| "title_case": false, | |
| "tool_mode": true, | |
| "trace_as_input": true, | |
| "trace_as_metadata": true, | |
| "type": "str", | |
| "value": "" | |
| }, | |
| --- a/src/backend/base/langflow/initial_setup/starter_projects/Pokédex Agent.json | |
| @@ "field_order": [ | |
| - "memory", | |
| + "memory", | |
| + "message", | |
| "sender", | |
| "sender_name", | |
| @@ "edges": [ | |
| { | |
| "data": { | |
| "sourceHandle": { | |
| "dataType": "ChatInput", | |
| "id": "ChatInput-ZNO2E", | |
| "name": "message", | |
| "output_types": ["Message"] | |
| }, | |
| "targetHandle": { | |
| - "fieldName": "input_value", | |
| + "fieldName": "message", | |
| "id": "Agent-iU8sJ", | |
| "inputTypes": ["Message"], | |
| "type": "str" | |
| } | |
| }, |
🤖 Prompt for AI Agents
In src/backend/base/langflow/initial_setup/starter_projects/Pokédex Agent.json
around lines 1612 to 1634, the new "message" input is missing from the node's
"field_order" array and lacks an edge mapping from the ChatInput message to this
port. To fix this, add "message" to the "field_order" list to ensure it appears
in the UI, and create an edge that connects the ChatInput message output to the
"message" input port to properly wire the data flow.
| if message.sender: | ||
| stored_messages = [m for m in stored_messages if m.sender == message.sender] | ||
| else: |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Filtering inconsistency (sender vs type)
retrieve_messages later filters on m.type, but here the post-store filter uses m.sender, yielding mismatched behaviour for LangChain messages converted with Message.from_lc_message, where sender and type are synonyms but only one side is updated.
Consider standardising on a single field (type is the one already used in retrieval) to avoid silent mismatches.
🤖 Prompt for AI Agents
In src/backend/base/langflow/components/helpers/memory.py around lines 157 to
159, the filtering uses m.sender while later retrieval filters on m.type,
causing inconsistent behavior for LangChain messages where sender and type are
synonyms but not always both set. To fix this, standardize the filtering to use
m.type consistently instead of m.sender to avoid silent mismatches.
| MessageTextInput( | ||
| name="message", display_name="Message", info="The chat message to be stored.", tool_mode=True, dynamic=True | ||
| ), | ||
| HandleInput( |
There was a problem hiding this comment.
message input should be marked as required or validated at runtime
store_message unconditionally dereferences self.message.
If the user leaves the field empty (it is currently not required=True), the method will either:
- create an empty
Message(text=""); or - fail with
TypeErrorwhen the value isNone.
Either case yields an unexpected UX and may break downstream flows.
Diff suggestion – either make the field required or add a runtime guard:
MessageTextInput(
name="message", display_name="Message", info="The chat message to be stored.", tool_mode=True, dynamic=True
+ , required=True
)or
if not self.message:
raise ValueError("`message` input cannot be empty when `store_message` is invoked.")🧰 Tools
🪛 Pylint (3.3.7)
[convention] 22-22: Line too long (119/100)
(C0301)
🤖 Prompt for AI Agents
In src/backend/base/langflow/components/helpers/memory.py around lines 21 to 24,
the "message" input is not marked as required, which can lead to empty or None
values causing errors or unexpected behavior in store_message. Fix this by
either setting required=True on the MessageTextInput definition to enforce input
presence or add a runtime check in store_message that raises a ValueError if
self.message is empty or None before proceeding.
| async def store_message(self) -> Message: | ||
| message = Message(text=self.message) if isinstance(self.message, str) else self.message | ||
|
|
||
| message.session_id = self.session_id or message.session_id | ||
| message.sender = self.sender or message.sender or MESSAGE_SENDER_AI | ||
| message.sender_name = self.sender_name or message.sender_name or MESSAGE_SENDER_NAME_AI | ||
|
|
||
| stored_messages: list[Message] = [] |
There was a problem hiding this comment.
Sender normalisation bug – "Machine and User" is written back to the DB
self.sender defaults to "Machine and User" (a retrieval-only meta option).
With the current assignment:
message.sender = self.sender or message.sender or MESSAGE_SENDER_AIthe literal string "Machine and User" is stored, producing an invalid sender value and breaking later filters that expect only "Machine" / "User".
Suggested fix:
-message.sender = self.sender or message.sender or MESSAGE_SENDER_AI
+normalised_sender = None if self.sender == "Machine and User" else self.sender
+message.sender = normalised_sender or message.sender or MESSAGE_SENDER_AI🧰 Tools
🪛 Pylint (3.3.7)
[convention] 139-139: Missing function or method docstring
(C0116)
🤖 Prompt for AI Agents
In src/backend/base/langflow/components/helpers/memory.py around lines 139 to
146, the assignment to message.sender incorrectly allows the meta value "Machine
and User" to be stored in the database, which is invalid. To fix this, add a
check to exclude "Machine and User" from being assigned to message.sender;
instead, fallback to message.sender or MESSAGE_SENDER_AI when self.sender is
"Machine and User" or falsy. This ensures only valid sender values like
"Machine" or "User" are stored.
There was a problem hiding this comment.
Actionable comments posted: 2
🔭 Outside diff range comments (1)
src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (1)
100-115:⚠️ Potential issueOutdated edge mapping for memory output
The edge connectingMemory-9SYWUtoPrompt-7sDZ1still uses the old output"messages_text", which no longer exists after consolidating outputs. This will break the flow. Please update or remove this edge to point to the new"dataframe"output.Suggested diff:
- { - "sourceHandle": { "dataType": "Memory", "id": "Memory-9SYWU", "name": "messages_text", "output_types": [] }, + { + "sourceHandle": { "dataType": "Memory", "id": "Memory-9SYWU", "name": "dataframe", "output_types": ["DataFrame"] }, "targetHandle": { ... } }
♻️ Duplicate comments (2)
src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (1)
2552-2574:⚠️ Potential issueEnable
dynamicfor the newmessageinput
Themessageinput is marked asdynamic: false, but it must be dynamic to accept runtime messages. Please adjust todynamic: true.Apply this diff:
- "message": { - "_input_type": "MessageTextInput", - "advanced": false, - "display_name": "Message", - "dynamic": false, + "message": { + "_input_type": "MessageTextInput", + "advanced": false, + "display_name": "Message", + "dynamic": true, "info": "The chat message to be stored.", ...src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (1)
890-912: Enable Dynamic Flag formessageInput
The newmessageinput is currently:"dynamic": false,It should be dynamic to accept runtime message values, and you must add
"message"to thefield_orderarray so it appears in the UI.Proposed diff:
--- a/src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json +++ b/src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json @@ "field_order": [ - "memory", + "message", + "memory", "sender", "sender_name", // ... @@ "message": { - "dynamic": false, + "dynamic": true,
🧹 Nitpick comments (1)
src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (1)
800-800: Minor Grammar Suggestion in Node DescriptionThe updated description reads:
"Stores or retrieves stored chat messages from Langflow tables or an external memory."
For clarity and consistency, consider changing “or” to “and”:
"Stores and retrieves chat messages from Langflow tables or an external memory."
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/backend/base/langflow/initial_setup/starter_projects/Custom Component Maker.json(6 hunks)src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json(6 hunks)src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json(6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Ruff Style Check (3.13)
- GitHub Check: Optimize new Python code in this PR
- GitHub Check: Run Ruff Check and Format
- GitHub Check: Update Starter Projects
🔇 Additional comments (10)
src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (4)
2457-2461: Update component description to reflect storing capability
The description now correctly mentions both storing and retrieving chat messages, aligning with the new feature set.
2484-2492: Rename retrieval output toretrieve_messages_dataframe
The retrieval output has been updated to useretrieve_messages_dataframeand returns a DataFrame. This is consistent with the helper implementation.
2498-2503: Add hiddenstored_messagesoutput
Introducing a hiddenstored_messagesoutput viastore_messageproperly surfaces stored messages for downstream components while keeping it hidden by default.
2530-2536: Template code updated for MemoryComponent
The JSON template now imports and usesaget_messagesandastore_message, and the methodsretrieve_messages_dataframeandstore_messagealign with the updated component API.src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (3)
11-12: Verify Dynamic Edge Types for Memory OutputThe
messages_textsource handle has had itsoutput_typescleared (set to an empty array) to support dynamic typing. However, edge definitions rely onoutput_typesfor type inference. Please verify in the Playground that the Memory Chatbot’smessages_textoutput still connects correctly to the Prompt’smemoryinput without type mismatches.Also applies to: 26-27
823-831: DataFrame Output Configuration Looks GoodThe
retrieve_messages_dataframeoutput is correctly defined as a dynamic DataFrame:
display_name: "Messages"method:retrieve_messages_dataframetypes:["DataFrame"]This aligns with the new DataFrame-based output requirement.
837-846: Stored Messages Output Configuration ApprovedThe hidden, dynamic
Stored Messagesoutput forstore_messageis correctly declared:
hidden: truemethod:store_messagetypes:["Message"]This matches the intended CRUD flow for storing chat messages.
src/backend/base/langflow/initial_setup/starter_projects/Custom Component Maker.json (3)
217-217: Description update is accurate
The node description now correctly reflects that the component can store and retrieve messages.
240-247: First output updated correctly to return a DataFrame of messages
The display name, method, name, and types now align withretrieve_messages_dataframe, producing a DataFrame output.
254-258: Second output correctly configured forstore_message
The hidden “Stored Messages” output is properly set to use thestore_messagemethod and returns aMessage.
| "name": "messages_text", | ||
| "output_types": [ | ||
| "Message" | ||
| ] | ||
| "output_types": [] | ||
| }, |
There was a problem hiding this comment.
Mismatch in output_types for Memory sourceHandle – likely breaking type compatibility
The data.sourceHandle.output_types is set to an empty list, but the edge id string and the Memory component output actually produce Message types. This inconsistency can prevent the flow from correctly recognizing the output type of the Memory node.
Suggested fix: update output_types to ["Message"] in both the data.sourceHandle object and the encoded sourceHandle string.
- "output_types": []
+ "output_types": ["Message"]And ensure the sourceHandle string at line 27 is updated accordingly.
Also applies to: 27-27
🤖 Prompt for AI Agents
In src/backend/base/langflow/initial_setup/starter_projects/Custom Component
Maker.json at lines 11 to 13 and line 27, the output_types for data.sourceHandle
is incorrectly set to an empty list, causing a type mismatch with the Memory
component's actual Message output. Update the output_types array to ["Message"]
in the data.sourceHandle object at lines 11-13 and also modify the encoded
sourceHandle string at line 27 to reflect this change, ensuring consistent type
compatibility across the flow.
edwinjosechittilappilly
left a comment
There was a problem hiding this comment.
We would need to add modes like Local DB
|
Build successful! ✅ |
|
Build successful! ✅ |
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (1)
2756-2776: Set default mode to Retrieve
ThemodeTabInput now defaults to"Retrieve", ensuring retrieval behavior is the primary view per design.src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (1)
853-853: Emptynameproperty in Prompt node configuration
The Prompt node’s"name"is set to an empty string, which will break instantiation and binding. It should match the component’s name"Prompt".Proposed fix:
- "name": "", + "name": "Prompt",
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
src/frontend/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (3)
src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json(48 hunks)src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json(13 hunks)src/backend/tests/unit/graph/test_graph.py(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- src/backend/tests/unit/graph/test_graph.py
🔇 Additional comments (22)
src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (7)
265-291: Add Memory-to-TypeConverterComponent edge
The new edge correctly maps the Memory component's dynamicdataframeoutput (DataFrame) to the TypeConverterComponent'sinput_dataaccepting Message, Data, and DataFrame.
292-317: Add TypeConverterComponent-to-Prompt edge
This edge properly connects the converter'smessage_output(Message) to the Prompt component'shistoryinput. TheinputTypesinclude Message and Text, matching the Prompt definition.
2656-2658: Rename and clarify Memory component
The componentdisplay_nameis now "Message History" and itsdescriptionreflects both storing and retrieving chat messages, improving clarity.
2679-2684: Consolidate output to DataFrame
The Memory component now exposes a single dynamic outputdataframeviaretrieve_messages_dataframe, returning messages as a DataFrame. This aligns with the dual-mode design.
2733-2755: Enable dynamic message input
Themessageinput is correctly markeddynamic: trueand hidden (show: false) by default, appearing only in "Store" mode as intended.
3875-3892: Add TypeConverterComponent node
The newTypeConverterComponentenables converting between Message, Data, and DataFrame types within flows, supporting the combined chat history CRUD functionality.
3937-3981: Validate TypeConverterComponent inputs/outputs
Theinput_dataHandleInput andoutput_typeTabInput correctly define accepted types, and theupdate_outputslogic toggles outputs via.to_dict()as expected.src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (15)
5-31: Edges mapping from ChatInput to OpenAIModel look correct
The new edge correctly propagates aMessageoutput from theChatInputnode into theinput_valueof theOpenAIModel. All metadata fields (dataType,id,name,output_types,inputTypes, etc.) are consistent.
25-25: Verify JSON escaping in edgeidproperty
Theidfield embedsœcharacters rather than conventional escaped quotes, e.g.:"reactflow__edge-ChatInput-Mqzss{œdataTypeœ:œChatInputœ,...}"Confirm if this serialization is intentional; otherwise, switch to valid JSON-escaped quotes (e.g.,
\").
33-59: Edges mapping from Prompt to OpenAIModel look correct
ThePromptoutput is now correctly typed asMessageand wired into thesystem_messageinput of theOpenAIModel. Metadata is consistent.
61-89: Edges mapping from OpenAIModel to ChatOutput look correct
The LLM’stext_output(Message) is being passed intoChatOutputwith the full set of acceptable input types (Data,DataFrame,Message). Good consolidation.
91-118: Edges mapping from TypeConverterComponent to Prompt look correct
The new type-conversion step (message_output) feeding into thememoryfield ofPromptis properly registered withMessageandTexttypes.
119-145: Edges mapping from Memory to TypeConverterComponent look correct
TheDataFrameproduced byMemoryis routed into the converter’sinput_dataport that acceptsMessage,Data, orDataFrame. All types align.
434-434: ID update forChatInput-Mqzssis a trivial serialization change; no action needed.
455-455: ID update forChatOutput-Er0pPis a trivial serialization change; no action needed.
757-759: Note node metadata change only affects measured dimensions; no functional impact.
805-809: Note node metadata change only affects measured dimensions; no functional impact.
823-831: Prompt node’scustom_fieldsand description updates reflect new template logic; looks good.
979-984: OpenAIModel node metadata updates (base_classes, category, etc.) align with component API changes; no concerns.
1373-1378: TypeConverterComponent ID and basic metadata update only; behavior is governed by component code.
1497-1501: Memory component ID change is a serialization artifact; no issues detected.
1511-1520: Memory node’sfield_orderrearrangement aligns with new dual-mode logic; looks correct.
| "field_order": [ | ||
| "memory", | ||
| "sender", | ||
| "sender_name", | ||
| "n_messages", | ||
| "session_id", | ||
| "order", | ||
| "template" | ||
| ], | ||
| "frozen": false, |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Include tool_placeholder in field_order of Prompt node
The Prompt component defines two inputs (template and tool_placeholder), but the field_order array only lists "template". Add "tool_placeholder" to ensure it’s surfaced in the UI.
Proposed diff:
"field_order": [
- "template"
+ "template",
+ "tool_placeholder"
],📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "field_order": [ | |
| "memory", | |
| "sender", | |
| "sender_name", | |
| "n_messages", | |
| "session_id", | |
| "order", | |
| "template" | |
| ], | |
| "frozen": false, | |
| "field_order": [ | |
| "template", | |
| "tool_placeholder" | |
| ], | |
| "frozen": false, |
🤖 Prompt for AI Agents
In src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json
around lines 841 to 844, the field_order array for the Prompt node only includes
"template" but should also include "tool_placeholder" since the Prompt component
defines both inputs. Add "tool_placeholder" to the field_order array to ensure
it appears in the UI alongside "template".
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (1)
853-853:⚠️ Potential issueCritical: Empty
namein Prompt Node Configuration
The Prompt node’s"name"property is set to an empty string, which likely breaks component instantiation or UI binding. It should match the component name ("Prompt").Apply this fix:
- "name": "", + "name": "Prompt",
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
src/frontend/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (3)
src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json(48 hunks)src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json(13 hunks)src/backend/tests/unit/graph/test_graph.py(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- src/backend/tests/unit/graph/test_graph.py
🔇 Additional comments (38)
src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (14)
8-31: Edge mapping from Prompt to OpenAIModel is correct
The newly added edge connectingPrompt-Vzk5ztoOpenAIModel-adSHwhas consistentoutput_typesandinputTypes, and the serializedsourceHandle/targetHandlestrings align with the actual component definitions.
32-61: Edge mapping from OpenAIModel to ChatOutput is valid
The edge linkingOpenAIModel-adSHwtoChatOutput-NbY9bcorrectly propagates aMessageoutput to acceptable input types (Data,DataFrame,Message).
62-91: Second LLM edge correctly configured
The duplicate connection from anotherOpenAIModel-A8LqGnode toChatOutput-paHngmirrors the first and maintains type alignment.
93-120: ChatInput→Prompt edge looks good
The newChatInput-xfgsqtoPrompt-iKEvNedge properly routes themessageoutput type to the prompt’sinputfield.
121-148: Prompt→OpenAIModel link validated
The edge fromPrompt-iKEvNtoOpenAIModel-A8LqGaccurately conveysMessagepayloads to the model’sinput_value.
149-176: AssemblyAI start→poll edge is correct
TheAssemblyAITranscriptionJobCreator-hXp0StoAssemblyAITranscriptionJobPoller-VCkreedge maintainsDatatyping for the transcript ID.
177-205: Poller→Parser edge is consistent
The transcription poller’stranscription_result(Data) is fed to the parser’sinput_datawhich acceptsData/DataFrame.
206-234: Parser→Prompt edge correct
The parser’sparsed_text(Message) now flows into the summary prompt’stranscriptfield.
235-264: Parser→ChatOutput edge validated
Parsed messages are routed appropriately toChatOutput-5pvPLfor display.
265-291: Memory→TypeConverter edge configured properly
The new dynamic outputdataframefromMemory-YN8aNis correctly passed to theTypeConverterComponent’sinput_data.
292-317: TypeConverter→Prompt edge is accurate
Convertedmessage_outputflows into the summary prompt’shistoryinput, closing the loop for retrieval mode.
2733-2755: Dynamic visibility ofmessageinput in MemoryComponent
Markingdynamic: trueand defaultingshow: falseon themessageinput aligns with the mode-config strategy to reveal it only in Store mode.
2756-2776: Correct default formodeTabInput
The default value“Retrieve”matches the PR objective to expose retrieval behavior initially.
2795-2817:orderinput marked required in Retrieve mode
Enforcingrequired: truefor theorderdropdown is appropriate given that retrieval must specify ascending/descending.src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (24)
5-31: Approve edge addition from ChatInput to OpenAIModel
The new edge mapping the ChatInputmessageoutput to the OpenAIModelinput_valueis correctly defined, with consistentdataType,output_types,inputTypes, and handle metadata.
33-58: Approve edge update from Prompt to OpenAIModel system_message
The Promptpromptoutput is properly connected to the OpenAIModelsystem_messageinput, with matchingoutput_typesandinputTypesmetadata.
61-89: Approve edge mapping from OpenAIModel to ChatOutput
The OpenAIModeltext_outputis accurately routed to ChatOutputinput_value, supportingData,DataFrame, andMessagetypes, with consistent metadata.
91-118: Approve edge for type conversion from DataFrame to Message for Prompt memory
The TypeConverterComponentmessage_outputis correctly routed to the Promptmemoryinput, with aligned metadata.
119-145: Approve edge wiring from Memory dataframe to TypeConverterComponent input_data
The Memorydataframeoutput is properly connected to the TypeConverterComponentinput_data, coveringMessage,Data, andDataFrametypes, with handles aligned.
434-434: Approve adding top-levelidfor ChatInput node
Theidfield at the node level is now explicitly defined forChatInput, ensuring consistent node identification in the flow.
455-455: Approve adding top-levelidfor ChatOutput node
The explicit node-levelidensures unique identification forChatOutputin the flow graph.
757-771: Approve note-bo9zi node updates
The note node now definesid,height, andwidthfor consistency in layout rendering.
792-808: Approve note-yHt6k node updates
The note node now includes explicitid,height, andwidthfor proper layout rendering.
824-824: Approve adding top-levelidfor Prompt node
Defining the node-levelidPrompt-mtnlMensures consistent identification in the flow.
831-835: Approvecustom_fieldsaddition for Prompt template
Adding"template": ["memory"]undercustom_fieldscorrectly ensures the memory field is recognized as a template variable in the UI.
836-840: Approve description and error metadata for Prompt node
The updateddescriptionprovides clearer context, and the inclusion oferror: nullsupports future error reporting.
859-863: Approve Prompt output mapping
The output configuration (display_name: "Prompt",name: "prompt",method: "build_prompt") aligns with the updated component logic.
894-914: Verifydynamicflag for memory input
Thememoryinput for Prompt is currently set to"dynamic": false. Confirm that this input should not accept runtime values, or consider setting it totrueif dynamic memory injection is required.
961-965: Approve measured dimensions for Prompt node
Explicitmeasuredheights and widths maintain consistent layout in the UI.
980-980: Approve adding top-levelidfor OpenAIModel node
TheidfieldOpenAIModel-gXjiPis now explicit, improving node identifiability.
983-985: Approve updatedbase_classesfor OpenAIModel
Adding"LanguageModel"alongside"Message"reflects the dual behavior of this component.
987-987: Approvecategoryfield addition for OpenAIModel
Categorizing the component under"models"aids in UI filtering.
1068-1074: Approve removal of default OpenAI API key placeholder
Clearing the defaultapi_keyfield to an empty string prevents unintentional use or exposure of credentials.
1361-1361: Approve measured dimensions update for OpenAIModel node
Height and width metrics are now included for consistent rendering.
1373-1373: Approve adding top-levelidfor TypeConverterComponent node
ExplicitidTypeConverterComponent-6PlBGsupports proper node referencing.
1497-1497: Approve adding top-levelidfor Memory node
HavingidMemory-OBr5Wat the node root ensures unique identification for the Memory component.
1777-1778: Approve measured dimensions for Memory node
Includingmeasuredheight and width ensures the Memory node lays out correctly.
1789-1790: Approve viewport position update
Adjustedxandycoordinates improve initial centering of the Memory Chatbot starter flow.
| "position": { | ||
| "x": 977.2392682107122, | ||
| "y": 1192.6380449385947 | ||
| }, | ||
| "selected": true, | ||
| "type": "genericNode" |
There was a problem hiding this comment.
Unexpected selected state on TypeConverterComponent
The TypeConverterComponent node is set to selected: true, while all other nodes default to false. To avoid highlighting it by default in the UI, please set "selected": false.
🤖 Prompt for AI Agents
In src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json
around lines 3993 to 3998, the TypeConverterComponent node has its "selected"
property set to true, unlike other nodes which default to false. Change the
"selected" value from true to false to prevent it from being highlighted by
default in the UI.
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (1)
1586-1601: Dynamic flag set onmessageinput in Memory node
Themessageinput is nowdynamic: true, addressing the previous missing flag and enabling runtime message storage.
🧹 Nitpick comments (2)
src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (2)
265-290: Standardize custom edge ID prefixes
The new edges between Memory → TypeConverterComponent and TypeConverterComponent → Prompt use the"xy-edge__..."prefix, whereas existing edges use"reactflow__edge-...". For consistency and to avoid potential parsing or tooling mismatches, consider renaming these IDs to follow the established"reactflow__edge-..."convention.Also applies to: 292-317
2653-2657: Refine component description wording
The description"Stores or retrieves stored chat messages..."repeats "store/stored". For clarity, consider rephrasing, for example:Manages chat messages by storing new entries or retrieving existing ones from Langflow tables or external memory.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
src/frontend/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (3)
src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json(48 hunks)src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json(13 hunks)src/backend/tests/unit/graph/test_graph.py(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- src/backend/tests/unit/graph/test_graph.py
🔇 Additional comments (18)
src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (4)
2677-2683: Verify the consolidated output for Message History
Theoutputsarray on the Memory node has been consolidated to a single dynamicdataframeoutput viaretrieve_messages_dataframe. Ensure downstream components and the UI have been updated to consume this new output name, replacing any references to the old"Messages"or"messages_text"outputs.
2713-2776: Validate dynamic input visibility formodeandmessage
Themessageinput is nowdynamic: trueand hidden by default, and theorderinput is markedrequired: true. Confirm that theupdate_build_configimplementation properly toggles visibility and requirements ofmessage,n_messages,order, andtemplatebased on the selected"Store"vs"Retrieve"mode, so the form behaves as intended.
3875-3899: ReviewTypeConverterComponentintegration
The new TypeConverterComponent handles dynamic conversion betweenMessage,Data, andDataFrametypes. Verify that theoutput_typeTabInput correctly updates theoutputsarray at runtime and that the conversion methods (convert_to_message,convert_to_data,convert_to_dataframe) handle all expected input variations without data loss or errors.Also applies to: 3938-3987
4000-4006: LGTM
The starter project graph has been updated accurately to support dual-mode memory operations and seamless type conversion.src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (14)
5-28: Correctly configured edge from ChatInput to OpenAIModel
The new edge definesdataType: "ChatInput"with matchingoutput_typesand consistent stringifiedsourceHandle. The target handle also correctly expectsMessageon the model input.
33-58: Correctly configured edge from Prompt to OpenAIModel
The Prompt → OpenAIModel connection is consistent:dataType,output_types, andinputTypesalign in both structured and serialized handles.
61-89: Correctly configured edge from OpenAIModel to ChatOutput
The edge mapping the model’stext_outputto ChatOutput’sinput_valueproperly listsMessageas the output type and acceptsData,DataFrame, andMessage.
91-117: Correctly configured edge from TypeConverterComponent to Prompt
The TypeConverter’smessage_outputedge to the Prompt’smemoryinput uses a consistentMessagetype in both handles.
831-835: Addedcustom_fieldsfor Prompt node to include memory
The inclusion of"custom_fields": {"template": ["memory"]}enables dynamic binding of the memory variable into the prompt template.
1511-1521: Updated field order in Memory node
Thefield_ordernow listsmode,message,memory, etc., reflecting the dual-mode logic. This aligns with the newmode_configin the component.
1531-1545: Consolidated Memory outputs to DataFrame
The Memory node now only exposes a singleMessagesoutput viaretrieve_messages_dataframe, matching the component’s dynamic output behavior.
1609-1629: ConfiguredmodeTabInput for Memory node
Themodeinput correctly usesTabInputwith real-time refresh, defaulting toRetrieve. This drives dynamic input/output updates.
1630-1647: Configuredn_messagesinput for Retrieve mode
TheNumber of Messagesfield is properly defined and will be shown only whenmode == Retrieve.
1648-1671: Configuredorderinput for Retrieve mode
TheOrderdropdown is required and hidden by default, reflecting its inclusion only under Retrieve.
1672-1696: Configuredsenderinput for Store/Retrieve filtering
TheSender Typedropdown is advanced and hidden by default; it aligns with the component filtering logic.
1697-1719: Configuredsender_nameinput visibility
TheSender Namefield is correctly markedshow: falseby default and will be toggled based on the selected mode.
1720-1742: Configuredsession_idinput visibility
TheSession IDinput remains advanced and hidden until needed, matching the component’smode_config.
1743-1767: Configuredtemplateinput for Retrieve mode
The template field is a multiline input, hidden by default and surfaced under Retrieve to format messages.
| "legacy": false, | ||
| "lf_version": "1.0.19.post2", | ||
| "metadata": {}, | ||
| "name": "", |
There was a problem hiding this comment.
Empty name property in Prompt node
The Prompt node’s "name" is blank, which can prevent proper component instantiation or UI binding. It should be set to "Prompt".
🤖 Prompt for AI Agents
In src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json
at line 853, the "name" property of the Prompt node is currently empty. Update
this property to "Prompt" to ensure proper component instantiation and UI
binding.
| "dataType": "Memory", | ||
| "id": "Memory-OBr5W", | ||
| "name": "dataframe", | ||
| "output_types": [ | ||
| "DataFrame" | ||
| ] | ||
| }, | ||
| "targetHandle": { | ||
| "fieldName": "input_data", | ||
| "id": "TypeConverterComponent-6PlBG", | ||
| "inputTypes": [ | ||
| "Message", | ||
| "Data", | ||
| "DataFrame" | ||
| ], | ||
| "type": "other" | ||
| } | ||
| }, | ||
| "id": "xy-edge__Memory-OBr5W{œdataTypeœ:œMemoryœ,œidœ:œMemory-OBr5Wœ,œnameœ:œdataframeœ,œoutput_typesœ:[œDataFrameœ]}-TypeConverterComponent-6PlBG{œfieldNameœ:œinput_dataœ,œidœ:œTypeConverterComponent-6PlBGœ,œinputTypesœ:[œMessageœ,œDataœ,œDataFrameœ],œtypeœ:œotherœ}", | ||
| "source": "Memory-OBr5W", | ||
| "sourceHandle": "{œdataTypeœ: œMemoryœ, œidœ: œMemory-OBr5Wœ, œnameœ: œdataframeœ, œoutput_typesœ: [œDataFrameœ]}", | ||
| "target": "TypeConverterComponent-6PlBG", | ||
| "targetHandle": "{œfieldNameœ: œinput_dataœ, œidœ: œTypeConverterComponent-6PlBGœ, œinputTypesœ: [œMessageœ, œDataœ, œDataFrameœ], œtypeœ: œotherœ}" |
There was a problem hiding this comment.
Inconsistent edge ID prefix for Memory → TypeConverterComponent
All other edges use the reactflow__edge- prefix, but this one uses xy-edge__. This discrepancy can break the graph renderer.
Please rename the id to start with reactflow__edge- to match the rest of the edges.
🤖 Prompt for AI Agents
In src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json
around lines 122 to 144, the edge ID prefix for the edge connecting Memory to
TypeConverterComponent is incorrectly set to "xy-edge__" instead of the
consistent "reactflow__edge-". Rename the "id" field of this edge to start with
"reactflow__edge-" to ensure consistency with other edges and prevent issues
with the graph renderer.
|
Build successful! ✅ |
|
Build successful! ✅ |
|
Build successful! ✅ |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/backend/tests/unit/build_utils.py(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: build-and-deploy
- GitHub Check: Optimize new Python code in this PR
- GitHub Check: Ruff Style Check (3.13)
- GitHub Check: Run Ruff Check and Format
- GitHub Check: Update Starter Projects
🔇 Additional comments (1)
src/backend/tests/unit/build_utils.py (1)
81-88:Details
✅ Verification successful
The set comparison change is appropriate but verify component dependencies.
The change from list equality to set equality removes the execution order requirement, which is likely correct since the
to_runlist represents components that can be executed, not necessarily their execution order. The addition ofTypeConverterComponent-koSIzaligns with the dual-mode Memory component functionality described in the PR objectives.
🏁 Script executed:
#!/bin/bash # Description: Verify the TypeConverterComponent integration and dependencies # Expected: Find component definitions and their relationships # Look for TypeConverterComponent definition ast-grep --pattern $'class TypeConverterComponent { $$$ }' # Search for component registration or usage rg -A 5 -B 5 "TypeConverterComponent" --type py # Check if the component IDs match actual component definitions rg -A 3 -B 3 "Memory-8X8Cq|Prompt-VSSGR|ChatOutput-NAw0P" --type pyLength of output: 14108
Confirm set comparison and TypeConverterComponent integration
All component IDs in the
expected_to_runset match existing definitions, andTypeConverterComponentis properly defined and imported:
TypeConverterComponentis declared insrc/backend/base/langflow/components/processing/converter.pyand exposed via its__init__.py.- All tests and starter-project files import and use
TypeConverterComponentcorrectly.- Switching from list to set comparison in
src/backend/tests/unit/build_utils.pyno longer enforces ordering, which aligns with the intended behavior.No further changes required.
| assert ids == ["ChatInput-vsgM1"], "Invalid ids in first event. Full event stream:\n" + "\n".join( | ||
| lines | ||
| ) |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Verify the hardcoded component ID is stable.
The test uses a hardcoded component ID "ChatInput-vsgM1" which could make the test brittle if ID generation changes. Consider if this ID is deterministic or if the test should be more flexible.
🏁 Script executed:
#!/bin/bash
# Description: Check if component IDs are deterministic across the codebase
# Expected: Find patterns of ID generation or usage that indicate whether IDs are stable
# Search for ID generation patterns
rg -A 3 -B 3 "ChatInput-.*" --type py
# Look for ID generation logic
rg -A 5 "generate.*id|create.*id" --type py
# Check for other hardcoded IDs in tests
rg -A 2 -B 2 '"[A-Za-z]+-[A-Za-z0-9]{5}"' src/backend/tests/Length of output: 66192
🏁 Script executed:
#!/bin/bash
# Display the beginning of the build_utils test to understand ID sourcing
sed -n '1,200p' src/backend/tests/unit/build_utils.py
echo
echo "---- Checking for seed or mocking of UUID generation ----"
rg -n "seed" src/backend/tests/unit/build_utils.py || echo "No seed usage found"
rg -n "uuid4" src/backend/tests/unit/build_utils.py || echo "No uuid4 usage found"
rg -n "patch" src/backend/tests/unit/build_utils.py || echo "No patch/mock usage found"Length of output: 6168
Ensure deterministic component IDs in tests
The assertion
assert ids == ["ChatInput-vsgM1"], "Invalid ids in first event…"is brittle because suffixes are generated via uuid.uuid4() with no seeding or mocking. IDs will vary across runs.
Locations to address:
- File:
src/backend/tests/unit/build_utils.py - Function:
consume_and_assert_stream - Lines around the first-event ID assertion (
ids == [...])
Suggested fix:
Replace exact-match on a random ID with either a prefix/regex check or mock UUID generation. For example:
- assert ids == ["ChatInput-vsgM1"], "Invalid ids in first event. Full event stream:\n" + "\n".join(lines)
+ # Ensure ChatInput component ID has the correct prefix
+ assert ids and ids[0].startswith("ChatInput-"), (
+ f"Unexpected first component ID '{ids[0]}'. Expected prefix 'ChatInput-'.\nFull event stream:\n"
+ + "\n".join(lines)
+ )Alternative approaches:
- Mock
uuid.uuid4()(or the internal ID generator) to return a fixed value in tests. - Use a regex match:
re.match(r"^ChatInput-[A-Za-z0-9]{5}$", ids[0]).
🤖 Prompt for AI Agents
In src/backend/tests/unit/build_utils.py around lines 76 to 78, the test asserts
an exact match on a component ID that includes a random UUID suffix, making the
test brittle. To fix this, modify the assertion to either mock the UUID
generation function to return a fixed value during the test or replace the exact
string comparison with a regex pattern check that verifies the ID prefix and
format without relying on a fixed suffix. This ensures the test remains stable
despite random ID generation.
|
Build successful! ✅ |
|
Build successful! ✅ |
|
Build successful! ✅ |
|
Build successful! ✅ |
|
Build successful! ✅ |
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Tests