Skip to content

Conversation

@aibysid
Copy link

@aibysid aibysid commented Nov 13, 2025

  • Create FlowiseChatOpenRouter wrapper class implementing IVisionChatModal
  • Add allowImageUploads and imageResolution input fields
  • Support multimodal image inputs for OpenRouter models
  • Follows same pattern as ChatOpenAI implementation

Resolves #5143

Screenshot 2025-11-13 at 17 01 14

- Create FlowiseChatOpenRouter wrapper class implementing IVisionChatModal
- Add allowImageUploads and imageResolution input fields
- Support multimodal image inputs for OpenRouter models
- Follows same pattern as ChatOpenAI implementation

Resolves FlowiseAI#5143
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @aibysid, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the ChatOpenRouter node by integrating multimodal capabilities, specifically allowing users to provide image inputs to OpenRouter models. It introduces new configuration options for image handling and leverages a dedicated wrapper class to manage this functionality, aligning with existing multimodal implementations within the system.

Highlights

  • Image Upload Support: The ChatOpenRouter node now supports image uploads, enabling multimodal input for OpenRouter models.
  • New Input Fields: Added 'Allow Image Uploads' (boolean) and 'Image Resolution' (options: Low, High, Auto) to the node's configuration, displayed conditionally.
  • Wrapper Class Implementation: Introduced FlowiseChatOpenRouter as a wrapper around LangchainChatOpenAI, implementing the IVisionChatModal interface to manage multimodal options.
  • Consistent Pattern: The implementation follows the established pattern used for the ChatOpenAI node, ensuring consistency across chat models.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds image upload support to the ChatOpenRouter node, following a similar pattern to the existing ChatOpenAI implementation. The changes are well-structured and introduce new UI fields for enabling image uploads and setting resolution. My review includes a couple of suggestions to enhance error message clarity and improve TypeScript type safety for better robustness. Overall, this is a solid contribution.

parsedBaseOptions = typeof baseOptions === 'object' ? baseOptions : JSON.parse(baseOptions)
} catch (exception) {
throw new Error("Invalid JSON in the ChatCerebras's BaseOptions: " + exception)
throw new Error("Invalid JSON in the ChatOpenRouter's BaseOptions: " + exception)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Concatenating the exception object directly with a string can lead to unhelpful error messages like [object Object]. It's better to use the exception's message property if it's an Error instance, or convert it to a string otherwise, to provide more informative error details.

Suggested change
throw new Error("Invalid JSON in the ChatOpenRouter's BaseOptions: " + exception)
throw new Error("Invalid JSON in the ChatOpenRouter's BaseOptions: " + (exception instanceof Error ? exception.message : String(exception)))

export class ChatOpenRouter extends LangchainChatOpenAI implements IVisionChatModal {
configuredModel: string
configuredMaxToken?: number
multiModalOption: IMultiModalOption
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The multiModalOption property is declared but not initialized in the constructor. It's set later via setMultiModalOption. This can lead to runtime errors if other methods access it before it's set. Using a definite assignment assertion (!) makes it clear that this property will be initialized elsewhere, improving type safety and code clarity.

Suggested change
multiModalOption: IMultiModalOption
multiModalOption!: IMultiModalOption

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.

[Feature] Add image upload to ChatOpenRouter models.

1 participant