Skip to content

fix: Clean up some more base templates#8706

Merged
erichare merged 10 commits into
mainfrom
fix-further-templates
Jun 24, 2025
Merged

fix: Clean up some more base templates#8706
erichare merged 10 commits into
mainfrom
fix-further-templates

Conversation

@erichare
Copy link
Copy Markdown
Collaborator

@erichare erichare commented Jun 24, 2025

This pull request makes more changes to base templates to improve their usability and update components used.

Summary by CodeRabbit

  • New Features
    • Enhanced "Document Q&A" starter project with improved file handling, modular parser, and support for multiple language model providers.
  • Improvements
    • Updated prompt creation to allow dynamic document variables.
    • Modernized and modularized components for better flexibility and maintainability.
  • Chores
    • Updated node and edge IDs, metadata versions, and layout for both "Document Q&A" and "Memory Chatbot" starter projects.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 24, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update modifies the JSON configurations for two starter projects: "Document Q&A" and "Memory Chatbot." The "Document Q&A" project receives significant structural changes, including new and replaced component nodes, updated node IDs, and revised edges to reflect a more modular and provider-agnostic design. The "Memory Chatbot" project primarily updates node and edge IDs, metadata, and layout without altering its functional logic.

Changes

File(s) Change Summary
src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json Major update: replaced OpenAI-specific model with generic LanguageModelComponent, added ParserComponent, updated node IDs, redefined File and Prompt components, revised edges, and updated metadata and node positions.
src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json Minor update: changed all node and edge IDs, updated version metadata, adjusted node positions, and layout; no changes to component logic or control flow.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ChatInput
    participant File
    participant Parser
    participant Prompt
    participant LanguageModel
    participant ChatOutput

    User->>ChatInput: Submit query
    ChatInput->>Prompt: Send query
    File->>Parser: Load and process file(s)
    Parser->>Prompt: Send parsed text as Document
    Prompt->>LanguageModel: Build prompt with query and document
    LanguageModel->>ChatOutput: Generate answer
    ChatOutput->>User: Return answer
Loading

Possibly related PRs

Suggested labels

bug, size:L, lgtm

Suggested reviewers

  • ogabrielluiz
  • Yukiyukiyeah
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch fix-further-templates

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Jun 24, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 24, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🔭 Outside diff range comments (2)
src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (1)

1070-1077: Avoid shipping a hard-coded API-key placeholder

"value": "OPENAI_API_KEY" is convenient but dangerous—users may mistakenly commit a real key later.
Set the default to the empty string and rely on runtime env injection:

- "value": "OPENAI_API_KEY"
+ "value": ""

and mark the field as required: true so the UI still prompts.

src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json (1)

1188-1234: Avoid hard-coding provider-specific env-var label

The template always labels the secret as “OpenAI API Key”. When the user switches to Anthropic/Google we mutate the label in update_build_config, but the default value remains "OPENAI_API_KEY" which is misleading.

Diff snippet:

-    value = "OPENAI_API_KEY"
+    value = ""

and optionally populate from os.getenv(...) at runtime.

🧹 Nitpick comments (3)
src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (1)

740-744: dragging: true in saved template bloats diff & can confuse viewport

This flag is only meaningful during live editing; persisting it causes arbitrary diffs on every layout nudge. Consider stripping volatile UI-state keys (dragging, selected, positionAbsolute) during export.

src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json (2)

24-32: Non-ASCII separators in edge-id – confirm React-Flow tolerance

The edge id uses the character œ as a quote substitute:

"id": "reactflow__edge-parser-1O59j{œdataTypeœ:œparserœ, … }"

React-Flow treats the id as both a DOM attribute and a graph key. Non-ASCII characters occasionally surface in CSS selectors and can break things in older browsers or tooling that naïvely assumes ASCII identifiers.

Consider URL-encoding or simply keeping the JSON string ASCII-only.


831-872: Prompt template may receive a Message instead of str

ParserComponent.parse_combined_text returns a Message.
Message.from_template(**self._attributes) will interpolate {Document} with that object, leading to a repr(Message) in the prompt unless from_template explicitly calls .get_text().

Mitigate by:

  1. Changing parser output type to plain str, or
  2. Casting inside PromptComponent.build_prompt:
- prompt = Message.from_template(**self._attributes)
+ attrs = {k: (v.get_text() if isinstance(v, Message) else v)
+          for k, v in self._attributes.items()}
+ prompt = Message.from_template(**attrs)
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3a3e205 and cf44e7a.

📒 Files selected for processing (2)
  • src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json (22 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (24 hunks)
🔇 Additional comments (2)
src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (2)

1835-1838: Viewport negatives look odd but are harmless

New viewport origin is negative; just flagging in case this was accidental zoom/pan before export.


179-180: Version bumps to 1.4.3 LGTM

Consistently updating lf_version across all nodes is good housekeeping.

Also applies to: 485-486, 855-856, 1015-1017, 1395-1396, 1530-1531

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 24, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 24, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 24, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 24, 2025
@github-actions github-actions Bot added the lgtm This PR has been approved by a maintainer label Jun 24, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 24, 2025
@erichare erichare added this pull request to the merge queue Jun 24, 2025
@erichare erichare removed this pull request from the merge queue due to a manual request Jun 24, 2025
@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Jun 24, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 24, 2025
@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Jun 24, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 24, 2025
@erichare erichare enabled auto-merge June 24, 2025 18:00
@erichare erichare added this pull request to the merge queue Jun 24, 2025
Merged via the queue into main with commit 1903f60 Jun 24, 2025
67 of 81 checks passed
@erichare erichare deleted the fix-further-templates branch June 24, 2025 18:24
Khurdhula-Harshavardhan pushed a commit to JigsawStack/langflow that referenced this pull request Jul 1, 2025
* fix: Clean up some more base templates

* Fix icons in Pokedex Agent

* Update Price Deal Finder.json

* Update Social Media Agent.json

* Update Social Media Agent.json

* Update Memory Chatbot.json

* Conflict fix

* Update Memory Chatbot.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants