Skip to content

Conversation

@LemonNekoGH
Copy link
Owner

Implement a data export feature to allow users to download all application data, excluding embedding models.


Open in Cursor Open in Web

@cursor
Copy link

cursor bot commented Jan 6, 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 6, 2026

Deploy Preview for flow-chat ready!

Name Link
🔨 Latest commit 8a7ea7c
🔍 Latest deploy log https://app.netlify.com/projects/flow-chat/deploys/695e1173a192b10008e18166
😎 Deploy Preview https://deploy-preview-101--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 introduces a new feature that enables users to export all their application data, such as chat rooms, messages, and templates, into a downloadable JSON file. This provides users with greater control over their data, allowing for backups or migration, while intentionally excluding sensitive embedding models.

Highlights

  • New Data Export Module: A new module, src/models/export.ts, has been introduced to encapsulate all data export logic, including data fetching from the database and client-side file downloading.
  • Comprehensive Data Export: The export feature now allows users to download all application data, specifically templates, rooms, messages (excluding embedding models), memories, and tool calls, into a single JSON file.
  • User Interface Integration: An 'Export All Data' button has been added to the settings page, providing a direct way for users to initiate the data export process. A loading spinner indicates when the export is in progress.

🧠 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 a data export feature, allowing users to download their application data as a JSON file. The core logic is well-encapsulated within a new useExportModel composable. The settings page is updated with a new button to trigger this export, including a loading state. My review focuses on improving code consistency, ensuring data integrity in the exported file's name, and adding crucial error handling to enhance the user experience.

Comment on lines 68 to 98
const [templates, rooms, messages, memories, toolCalls] = await Promise.all([
db.select().from(schema.templates),
db.select().from(schema.rooms),
db.select({
id: schema.messages.id,
content: schema.messages.content,
model: schema.messages.model,
provider: schema.messages.provider,
role: schema.messages.role,
room_id: schema.messages.room_id,
parent_id: schema.messages.parent_id,
summary: schema.messages.summary,
show_summary: schema.messages.show_summary,
memory: schema.messages.memory,
created_at: schema.messages.created_at,
updated_at: schema.messages.updated_at,
// embedding is excluded from export
}).from(schema.messages),
db.select().from(schema.memories),
db.select().from(schema.tool_calls),
])

return {
version: '1.0.0',
exportedAt: new Date().toISOString(),
templates,
rooms,
messages,
memories,
tool_calls: toolCalls,
}

Choose a reason for hiding this comment

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

medium

For consistency with other destructured variables and property names, it's better to name the variable tool_calls instead of toolCalls. This allows you to use the shorthand property syntax in the return object, making the code slightly cleaner and more consistent.

    const [templates, rooms, messages, memories, tool_calls] = await Promise.all([
      db.select().from(schema.templates),
      db.select().from(schema.rooms),
      db.select({
        id: schema.messages.id,
        content: schema.messages.content,
        model: schema.messages.model,
        provider: schema.messages.provider,
        role: schema.messages.role,
        room_id: schema.messages.room_id,
        parent_id: schema.messages.parent_id,
        summary: schema.messages.summary,
        show_summary: schema.messages.show_summary,
        memory: schema.messages.memory,
        created_at: schema.messages.created_at,
        updated_at: schema.messages.updated_at,
        // embedding is excluded from export
      }).from(schema.messages),
      db.select().from(schema.memories),
      db.select().from(schema.tool_calls),
    ])

    return {
      version: '1.0.0',
      exportedAt: new Date().toISOString(),
      templates,
      rooms,
      messages,
      memories,
      tool_calls,
    }


const link = document.createElement('a')
link.href = url
link.download = `flow-chat-export-${new Date().toISOString().slice(0, 10)}.json`

Choose a reason for hiding this comment

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

medium

The date for the filename is generated here using new Date(), while the exportedAt field in the JSON data is generated earlier in exportAllData. If the export process happens to cross midnight, the date in the filename could be different from the date in exportedAt. To ensure consistency, you should use the exportedAt value from the data object for the filename.

Suggested change
link.download = `flow-chat-export-${new Date().toISOString().slice(0, 10)}.json`
link.download = `flow-chat-export-${data.exportedAt.slice(0, 10)}.json`

Comment on lines 93 to 101
async function exportAllData() {
isExporting.value = true
try {
await exportModel.exportAndDownload()
}
finally {
isExporting.value = false
}
}

Choose a reason for hiding this comment

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

medium

The current implementation will correctly reset the isExporting state if an error occurs, but it won't inform the user that the export failed. It's good practice to add a catch block to handle potential errors from the export process, log them, and provide feedback to the user (e.g., via an alert or a toast notification).

async function exportAllData() {
  isExporting.value = true
  try {
    await exportModel.exportAndDownload()
  }
  catch (error) {
    console.error('Failed to export data:', error)
    // Consider using a toast notification for a better user experience
    alert('Failed to export data. Please check the console for more details.')
  }
  finally {
    isExporting.value = false
  }
}

cursoragent and others added 2 commits January 6, 2026 09:20
This commit introduces the ability to import data from JSON files and database dumps. It includes new functions in the export model for handling these imports, updates the settings page to provide UI elements for triggering imports, and modifies the database store to manage pending imports and load data from dumps.

Co-authored-by: self <[email protected]>
@LemonNekoGH LemonNekoGH changed the title All data export feat: export and import data Jan 6, 2026
cursoragent and others added 3 commits January 6, 2026 10:17
The database dump import functionality has been removed as it was complex and not widely used.

Co-authored-by: self <[email protected]>
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