Skip to content

Conversation

@emir-karabeg
Copy link
Collaborator

Summary

This PR transforms the Router block from an LLM-based routing mechanism into a conditional logic block, mirroring the functionality of the Conditional block. It introduces if/else if/else conditions for explicit path selection, enhancing control and predictability. Existing router blocks will default to the first output port, ensuring backward compatibility.

Fixes #

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

The changes were verified by:

  • Running unit tests for router handler and edge construction.
  • Manual testing of the new router block in the UI, ensuring conditions can be set, connections made, and routes are correctly evaluated.
  • Ensuring existing router blocks (pre-change) default to the first output port.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos


Open in Cursor Open in Web

@cursor
Copy link

cursor bot commented Dec 20, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel
Copy link

vercel bot commented Dec 20, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Dec 20, 2025 10:09pm

export { MessagesInput } from './messages-input/messages-input'
export { ProjectSelectorInput } from './project-selector/project-selector-input'
export { ResponseFormat } from './response/response-format'
export { RouterInput } from './router-input/router-input'

Choose a reason for hiding this comment

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

Đây là một re‑export (named export). Nó cho phép các phần khác của project import RouterInput trực tiếp từ thư mục components (ví dụ: import { RouterInput } from '.../components') thay vì phải trỏ thẳng vào './router-input/router-input'.

blockId={blockId}
subBlockId={config.id}
isPreview={isPreview}
previewValue={previewValue as any}

Choose a reason for hiding this comment

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

Đã thêm import mới: RouterInput (vào phần import ở đầu file).

Họ đã thêm một nhánh mới trong switch (case 'router-input') — khi type là 'router-input' sẽ trả về component .

Component được render với các props: blockId, subBlockId (lấy từ config.id), isPreview, previewValue (được ép kiểu sang any) và disabled (isDisabled).

Tóm lại: không có hàm (function) mới được thêm — chỉ thêm import và một case mới để render component RouterInput với các props như trên.

@waleedlatif1 waleedlatif1 deleted the cursor/router-conditional-port-logic-5767 branch December 24, 2025 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants