Skip to content

AirOne-dev/dbgate-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DbGate AI Chat Plugin

AI-powered SQL assistant injected directly into DbGate as a side panel.

The plugin patches DbGate's Electron main process to add a WebContentsView with an AI chat interface. It connects to your databases through DbGate's saved connections and uses the OpenAI API to answer questions, write and execute SQL queries.

Prerequisites

  • DbGate installed at /Applications/DbGate.app (macOS)
  • Node.js >= 18
  • pnpm
  • An OpenAI API key

Installation

pnpm install

Usage

pnpm dbgate

This command builds the Vue frontend, extracts DbGate's app.asar, patches it to inject the AI panel, and launches a modified copy of DbGate.

A robot icon appears at the bottom of DbGate's left icon bar. Click it to toggle the AI chat panel.

First launch on macOS

macOS will block the modified app because its code signature is no longer valid. To allow it:

  1. When the error appears, open System Settings > Privacy & Security
  2. Scroll down — you'll see a message about "DbGate" being blocked
  3. Click Open Anyway

Alternatively, run this before launching:

xattr -cr /tmp/DbGate-AI.app

This only needs to be done once (or again after DbGate updates).

Configuration

On first use, click the gear icon in the chat panel to configure:

  • API Key — your OpenAI API key
  • Model — the model to use (defaults to gpt-4o)

How it works

  1. launcher/launch-dbgate.js extracts DbGate's app.asar to /tmp/dbgate-ai-patched/
  2. It patches src/electron.js to load ai-panel.js on startup
  3. A temporary .app bundle is created at /tmp/DbGate-AI.app (cached between runs)
  4. The AI panel loads the Vue frontend from dist/index.html in a WebContentsView
  5. IPC handlers (prefixed aichat:) handle database connections, queries, and AI chat

Project structure

launcher/           Injection into DbGate (CommonJS, runs in DbGate's main process)
src/                Backend logic (config, AI agent, database drivers)
renderer/           Vue 3 frontend (Pinia, Tailwind CSS v4)
dist/               Build output
data/               Runtime data (config, conversation history) — git-ignored

About

A free AI integration for mysql/postgres connections in DbGate desktop app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors