Skip to content

Conversation

@LemonNekoGH
Copy link
Owner

Adds file upload functionality to enable multimodal AI interactions and richer conversations.


Open in Cursor Open in Web

This commit introduces file upload functionality, allowing users to attach images and other files to their messages. It includes database schema changes, UI components for file selection and display, and logic for handling multimodal message content.

Co-authored-by: self <[email protected]>
@cursor
Copy link

cursor bot commented Jan 8, 2026

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

@netlify
Copy link

netlify bot commented Jan 8, 2026

Deploy Preview for flow-chat ready!

Name Link
🔨 Latest commit 839006f
🔍 Latest deploy log https://app.netlify.com/projects/flow-chat/deploys/695f2c76042da50007e8086f
😎 Deploy Preview https://deploy-preview-104--flow-chat.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@gemini-code-assist
Copy link

Summary of Changes

Hello @LemonNekoGH, 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 significantly enhances the application's messaging capabilities by introducing robust file upload functionality. It allows users to attach files, primarily images, to their messages, paving the way for more dynamic and multimodal interactions with AI. The changes span across the database, UI components, and core messaging logic, ensuring that attachments are seamlessly handled from creation to display and integration with AI models.

Highlights

  • Database Schema Update: The messages table in the database has been updated to include a new attachments column of type jsonb, allowing for the storage of file attachment metadata.
  • File Upload and Display Components: New Vue components, FileUpload.vue and AttachmentDisplay.vue, have been introduced to handle the uploading, previewing, and displaying of file attachments within the application's UI.
  • Multimodal AI Integration: The chat functionality now supports multimodal AI interactions by converting attached images into a format suitable for AI models, enabling richer conversations.
  • Chat Interface Enhancements: The chat input area has been enhanced with a file upload toggle button, allowing users to easily add attachments to their messages, and messages in the conversation view now display their associated attachments.
  • Localization Support: New localization keys have been added for English and Chinese to support various messages related to file upload, such as drop hints, size limits, and invalid file types.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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

@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 introduces file upload functionality, which is a great step towards enabling richer, multimodal conversations. The changes are comprehensive, including database schema updates, new Vue components for handling uploads and displaying attachments, and integration with the AI model interaction logic. The code is well-structured. I have a couple of suggestions to improve type safety and robustness. Specifically, I've pointed out a place where using as any can be avoided by refining type definitions, and I've recommended a more robust method for generating unique client-side IDs.

// If message has image attachments, build multimodal content
if (attachments && attachments.some(a => a.type === 'image')) {
return {
content: buildMultimodalContent(content, attachments) as any,

Choose a reason for hiding this comment

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

high

The use of as any here indicates a type mismatch and bypasses TypeScript's type safety. The BaseMessage interface defines content as a string, but for multimodal messages, you're correctly passing an array of objects. To resolve this and restore type safety, the BaseMessage type definition should be updated to support multimodal content.

For example, in src/types/messages.ts, you could define a type for multimodal content parts and use a union type for BaseMessage.content:

// In src/types/messages.ts

export type MultimodalContentPart = 
  | { type: 'text'; text: string }
  | { type: 'image'; image: string; mimeType?: string };

export type MultimodalContent = MultimodalContentPart[];

export interface BaseMessage {
  content: string | MultimodalContent;
  role: string;
  attachments?: Attachment[];
}

With this change, you can remove the as any cast, making the code more robust and maintainable.

            content: buildMultimodalContent(content, attachments),

Comment on lines +29 to +31
function generateId(): string {
return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`
}

Choose a reason for hiding this comment

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

medium

While Date.now() + Math.random() is often sufficient for generating unique IDs on the client-side, it's not guaranteed to be unique, especially if files are processed very quickly. A more robust and modern approach is to use crypto.randomUUID(), which is specifically designed for generating cryptographically secure unique identifiers. It's widely supported in modern browsers and would be a better fit here.

function generateId(): string {
  return crypto.randomUUID();
}

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.

3 participants