Skip to content

pahnin/pg-admin-genAi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PG Admin GenAI

A Postgres Admin Assistant powered by LLMs with a modern, minimal UI.
The app helps you query your Postgres database using natural language, with the model generating SQL queries and explanations.

Built in Rust with Freya for UI.


✨ Goals

  • 🛠️ Developer-friendly – run everything locally without complex setup.
  • 💰 Minimal token usage – optimized for local LLM inference instead of remote APIs.
  • 🎨 Modern, minimal UI – clean interface for writing and running queries.

🚀 Running Locally

⚠️ Note: Configuring DB connection strings and OpenAI/LLM API endpoints via GUI is not implemented yet.
For now, you must configure using config.toml.

1. Install Prerequisites

  • Rust & Cargo
  • Local Postgres instance
  • Local LLM server:
    • Ollama
    • LM Studio server
    • or any server exposing an OpenAI-compatible API
      (like http://localhost:#{PORT}/v1/chat/completions)

2. Run Postgres

Start Postgres locally with a database and tables that match your schema.
Example: you can try the sample postgres dev server setup:

./tests/dev-db.sh

3. Run LLM server

Start an Ollama or compatible server locally. Make sure it listens at:

http://localhost:1234/v1/chat/completions

Adjust the model name in src/llm.rs if you want to use a different one (default: deepseek-coder-v2:latest).

4. Update configuration

Update settings in config.toml to point to your DB server and LLM server:

# Which Postgres profile is active, you can add multiple profiles and select one as default
active_postgres = "local"

# Which LLM profile is active, you can add multiple profiles and select one as default
active_llm = "default"

[postgres_profiles.local]
host = "localhost"
port = 5432
user = "postgres"
password = "password"
dbname = "postgres"

[llm_profiles.default]
api_url = "http://localhost:1234/v1"
model = "deepseek-coder-v2-lite-instruct"

5. Run the app

cargo run

Demo (27-08-2025)

Screencast.From.2025-08-27.11-25-54.mp4

🤝 Contributing

We welcome contributions!

  1. Open an issue to discuss bugs, features, or ideas.
  2. Submit a pull request with your changes.
  3. Follow semantic commit messages (Conventional Commits).

Examples:

  • feat(agent): add support for retrying on clarification errors
  • fix(db): handle NULL values in query results
  • chore(ui): improve error logging

🧭 Roadmap

  • Configurable DB connection and LLM endpoint using config.toml
  • GitHub Actions CI with smoke tests
  • Major UI revamp with dropdowns, overlays, chat history
  • GUI Configurable DB connection
  • GUI Configurable LLM endpoint and model
  • [-] Schema explorer in UI
  • Tabbed SQL editor and saving SQL to file
  • Reactive buttons (disable while async job is running)
  • Context menus for tables (helper hooks based on AI)
  • Context menus for individual cells (helper hooks based on AI)
  • DB-level AI recommendations (index, constraints, normalization)
  • Codegen (generate language code from SQL)
  • Unit tests with mocks (instead of real Postgres)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors