能力标签
Glancer
🛠
AI工具

Glancer

基于 Ruby · 开源免费,本地部署,数据完全自主可控
英文名:glancer
⭐ 8 Stars 💻 Ruby 📄 MIT 🏷 AI 7.5分
7.5AI 综合评分
installablebusiness-intelligencedatabasegemllmragruby
✦ AI Skill Hub 推荐

经 AI Skill Hub 精选评估,Glancer 获评「推荐使用」。这款AI工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 7.5 分,适合有一定技术背景的用户使用。

📚 深度解析

Glancer 是一款基于 Ruby 的开源工具,在 GitHub 上收获 0k+ Star,是installable、business-intelligence、database、gem领域中的优质开源项目。开源工具的最大优势在于代码完全透明,你可以审计每一行代码的安全性,也可以根据自身需求进行二次开发和定制。

**为什么要使用开源工具而非商业 SaaS?**
对于个人开发者和有隐私需求的用户,本地部署的开源工具意味着数据不离本机,不受第三方服务商的数据政策约束。同时,开源工具通常没有使用次数限制和月度费用,一次安装即可长期使用,对于高频使用场景的总拥有成本(TCO)远低于订阅制商业工具。

**安装与环境准备**
Glancer 依赖 Ruby 运行环境。建议通过 pyenv(Python)或 nvm(Node.js)管理 Ruby 版本,避免全局环境污染。对于新手用户,推荐先创建虚拟环境(python -m venv venv && source venv/bin/activate),再安装依赖,这样即使出现问题也可以随时删除虚拟环境重新开始,不影响系统稳定性。

**社区与维护**
GitHub Issue 和 Discussion 是获取帮助的最快渠道。在提问前建议先检查 Closed Issues(已关闭的问题),大多数常见问题都已有解答。遇到 Bug 时,提供 pip list 的输出、完整错误堆栈和最小可复现示例,能显著提高开发者响应速度。AI Skill Hub 将持续追踪 Glancer 的版本更新,及时通知重要功能变化。

📋 工具概览

Glancer是一款开源的AI工具,基于Ruby on Rails engine,提供自然语言数据库查询接口,简化数据分析和可视化。

Glancer 是一款基于 Ruby 开发的开源工具,专注于 installable、business-intelligence、database 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

GitHub Stars
⭐ 8
开发语言
Ruby
支持平台
Windows / macOS / Linux
维护状态
轻量级项目,按需更新
开源协议
MIT
AI 综合评分
7.5 分
工具类型
AI工具
Forks

📖 中文文档

以下内容由 AI Skill Hub 根据项目信息自动整理,如需查看完整原始文档请访问底部「原始来源」。

Glancer是一款开源的AI工具,基于Ruby on Rails engine,提供自然语言数据库查询接口,简化数据分析和可视化。

Glancer 是一款基于 Ruby 开发的开源工具,专注于 installable、business-intelligence、database 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

📌 核心特色
  • 开源免费,支持本地部署,数据完全自主可控
  • 活跃的 GitHub 开源社区,持续迭代更新
  • 提供详细文档和使用示例,新手友好
  • 支持自定义配置,灵活适配不同使用环境
  • 可作为基础组件集成进现有技术栈或进行二次开发
🎯 主要使用场景
  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发
以下安装命令基于项目开发语言和类型自动生成,实际以官方 README 为准。
安装命令
# 克隆仓库
git clone https://github.com/ErnaneJ/glancer
cd glancer

# 查看安装说明
cat README.md

# 按 README 完成环境依赖安装后即可使用
📋 安装步骤说明
  1. 访问 GitHub 仓库页面
  2. 按照 README 文档完成依赖安装
  3. 根据系统环境完成初始化配置
  4. 参考官方示例或文档开始使用
  5. 遇到问题可在 GitHub Issues 中查找解答
以下用法示例由 AI Skill Hub 整理,涵盖最常见的使用场景。
常用命令 / 代码示例
# 查看帮助
glancer --help

# 基本运行
glancer [options] <input>

# 详细使用说明请查阅文档
# https://github.com/ErnaneJ/glancer
以下配置示例基于典型使用场景生成,具体参数请参照官方文档调整。
配置示例
# glancer 配置说明
# 查看配置选项
glancer --config-example > config.yml

# 常见配置项
# output_dir: ./output
# log_level: info
# workers: 4

# 环境变量(覆盖配置文件)
export GLANCER_CONFIG="/path/to/config.yml"
📑 README 深度解析 真实文档 完整度 78/100 查看 GitHub 原文 →
以下内容由系统直接从 GitHub README 解析整理,保留代码块、表格与列表结构。

简介

<p align="center"> <img src="./.github/assets/glancer-banner.svg" alt="Glancer" width="100%"> </p>

<p align="center"> <strong>Natural language database queries for your Rails app — powered by RAG and LLMs.</strong> </p>

<p align="center"> <a href="https://github.com/ErnaneJ/glancer/actions/workflows/ci.yml"> <img src="https://github.com/ErnaneJ/glancer/actions/workflows/ci.yml/badge.svg" alt="CI"> </a> <a href="https://github.com/ErnaneJ/glancer"> <img src="https://github.com/ErnaneJ/glancer/raw/refs/heads/badge-generator/.github/badges/coverage.svg" alt="Coverage"> </a> <a href="https://rubygems.org/gems/glancer"> <img src="https://badge.fury.io/rb/glancer.svg" alt="Gem Version"> </a> <a href="LICENSE.txt"> <img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"> </a> <a href="https://www.ruby-lang.org/en/"> <img src="https://img.shields.io/badge/ruby-%3E%3D%203.3-CC342D" alt="Ruby >= 3.3"> </a> <a href="https://rubyonrails.org/"> <img src="https://img.shields.io/badge/rails-%3E%3D%207.0-CC0000" alt="Rails >= 7.0"> </a> </p>

---

Glancer is a Ruby on Rails engine that mounts a full chat interface inside your app and lets anyone on your team query the database in plain language, no SQL required. You ask a question, Glancer retrieves the relevant schema context, generates a query, validates and executes it safely, then returns the results with a human-readable explanation.

"How many orders were placed in the last 30 days, grouped by status?"
→ SELECT executed, results shown, answer written in plain language.

<p align="center"> <a href="https://github.com/ErnaneJ/glancer/raw/refs/heads/main/.github/assets/demo.mp4"> <img src="./.github/assets/demo.gif" alt="DEMO"> </a> </p>

Requirements

DependencyMinimum version
Ruby3.3
Rails7.0
DatabaseSQLite, PostgreSQL, or MySQL / MariaDB
LLM providerGemini, OpenAI, or OpenRouter API key

Glancer is built on top of ruby_llm, a provider-agnostic LLM client for Ruby. All LLM calls (query generation, humanized responses, embeddings, and optional question enrichment) go through ruby_llm, so any model it supports works with Glancer.

Installation

2. Run the install generator

rails generate glancer:install

This creates:

  • config/initializers/glancer.rb — your main configuration file
  • config/glancer/llm_context.glancer.md — optional domain context written in Markdown
  • Mounts the engine at /glancer in config/routes.rb

Usage from Ruby

You can call Glancer's internals directly from the Rails console or your own code:

```ruby

Configuration

Edit config/initializers/glancer.rb. Minimal working setup:

Glancer.configure do |config|
  config.llm_provider   = :gemini
  config.llm_model      = "gemini-2.0-flash"
  config.gemini_api_key = ENV["GEMINI_API_KEY"]

  config.schema_permission = true  # allow indexing db/schema.rb
end

Full configuration reference

OptionDefaultDescription
adapterauto-detected:postgres, :mysql, :mysql2, or :sqlite
query_mode:sql:sql (raw SELECT) or :activerecord (Ruby expression)
read_only_dbnilReplica connection URL
statement_timeout30.secondsMax execution time; enforced server-side on PG and MySQL
llm_provider:geminiDefault provider for all roles (:gemini, :openai, :openrouter)
llm_model"gemini-2.0-flash"Default model for all roles
code_provider / code_modelinherits defaultProvider/model for query generation
chat_provider / chat_modelinherits defaultProvider/model for humanized responses
embedding_provider / embedding_modelinherits defaultProvider/model for embeddings
enrichment_provider / enrichment_modelinherits defaultProvider/model for question enrichment
query_enrichment_enabledfalsePre-retrieval question rewriting to inject table hints
gemini_api_keynilGemini API key
openai_api_keynilOpenAI API key
openrouter_api_keynilOpenRouter API key
schema_permissionfalseIndex db/schema.rb
models_permissionfalseIndex app/models/**/*.rb
context_file_path"config/glancer/llm_context.glancer.md"Custom domain context file
chunk_size1000Max characters per embedding chunk
chunk_overlap150Overlap between consecutive chunks
k5Top-k chunks retrieved per question
min_score0.6Minimum cosine similarity score (0.0–1.0)
schema_documents_weight1.3Score boost for schema chunks
context_documents_weight1.2Score boost for context chunks
models_documents_weight1.1Score boost for model chunks
history_limit6Prior conversation turns included in the LLM prompt
workflow_cache_ttl5.minutesIn-memory result cache TTL; 0 to disable
log_verbosity:info:silent, :none, :info, or :debug
log_output_pathnilLog file path; nil writes to stdout
blazer_pathnilBlazer base path; auto-detected when blazer gem is present

Chat interface

Visit /glancer in your browser.

  • Async processing — messages are handled in a background thread; the UI polls for completion so you can open a new chat while another query runs.
  • Step labels — the interface shows what the pipeline is doing: enriching, retrieving context, generating code, validating, executing, preparing response.
  • @mention autocomplete — type @table_name to pin a specific table to your question; it renders as a chip linked to the schema viewer.
  • Dual query modes — generated SQL or Ruby is syntax-highlighted in the response.
  • Inline code editing — modify the generated query and re-run it without asking a new question. Edited versions show a badge.
  • Results table — with one-click CSV export (client-side, no backend endpoint).
  • Charts — bar, line, doughnut, and scatter charts are auto-generated from the result set where meaningful.
  • Fullscreen charts — expand any chart to a fullscreen dialog for detailed inspection.
  • Blazer integration — open the SQL in Blazer pre-filled, if the gem is installed.
  • Audio input — click the microphone to dictate your question.
  • Multi-language — ask in any language; the LLM responds in the same language.
  • Custom instructions — set persistent system instructions at /glancer/settings.
  • Schema viewer — browse all indexed tables and columns at /glancer/db-schema.
  • Message details panel — shows generated code, edit history, execution audit, sources used, and enriched question.

Validate table references against the indexed schema

Glancer::Workflow::SQLValidator.validate_tables_exist!("SELECT * FROM orders JOIN unknown_table") ```

Run the full pipeline

result = Glancer::Workflow.run(chat.id, "Which products have never been ordered?")

5. Start asking questions

http://localhost:3000/glancer

Retrieve relevant chunks for a question (without running the full pipeline)

chunks = Glancer::Retriever.search("monthly revenue by region")

🇨🇳 中文文档镜像 AI 翻译 2026-06-02
英文原文章节由系统翻译为中文摘要,便于快速理解。完整原文见上方 "📑 README 深度解析"。
📌 简介

Glancer 是一个专为 Rails 应用设计的自然语言数据库查询工具。它利用 RAG(检索增强生成)技术与 LLM(大语言模型)的力量,让开发者和用户能够直接通过自然语言与数据库进行交互,无需编写复杂的 SQL 语句即可获取数据洞察。

📋 环境依赖

使用 Glancer 需要满足以下环境要求:Ruby 版本需在 3.3 及以上,Rails 版本需在 7.0 及以上;数据库支持 SQLite、PostgreSQL 或 MySQL/MariaDB;此外,您需要准备 Gemini、OpenAI 或 OpenRouter 的 API key 以驱动 LLM 能力。

🛠 安装步骤(Docker/pip/源码)

安装过程非常简单。首先通过 Gem 安装依赖,然后运行 `rails generate glancer:install` 生成器。该命令会自动创建配置文件 `config/initializers/glancer.rb` 和可选的领域上下文文件 `config/glancer/llm_context.glancer.md`,并自动在 `config/routes.rb` 中挂载 `/glancer` 路由。

🚀 使用教程

Glancer 不仅提供 Web 界面,还支持在 Ruby 代码中直接调用其内部逻辑。您可以在 Rails console 或业务代码中直接调用 Glancer 的 API,例如使用 `Glancer::Retriever` 进行语义搜索,或通过 `Glancer::Workflow.run` 执行完整的自然语言查询流水线。

⚙️ 配置说明(含 MCP / env)

您可以通过编辑 `config/initializers/glancer.rb` 进行详细配置。支持设置 `llm_provider`(如 :gemini)、`llm_model` 以及相应的 API key。为了安全起见,建议开启 `schema_permission` 以允许索引 `db/schema.rb`。此外,还支持配置 `read_only_db` 以连接只读副本,并设置 `statement_timeout` 防止长查询耗尽资源。

🔌 API 说明

Glancer 提供了一个直观的 Chat 界面,可通过浏览器访问 `/glancer` 使用。该界面支持异步处理机制,消息在后台线程中运行,UI 会通过轮询机制实时反馈进度。界面会通过 Step labels 清晰展示当前流水线状态,包括数据富化、上下文检索及代码生成等步骤。

🔄 工作流/模块

Glancer 内部构建了一套完整的 Workflow 流水线。通过 `Glancer::Workflow` 模块,您可以运行完整的查询链路;同时内置了 `SQLValidator` 模块,能够根据索引的 Schema 自动校验 SQL 语句中的表引用是否合法,确保生成的查询安全且准确。

❓ FAQ 摘要

安装完成后,您只需访问 `http://localhost:3000/glancer` 即可开始通过自然语言向数据库提问。Glancer 会自动处理从问题理解到结果生成的全过程,让数据查询变得像聊天一样简单。

🎯 aiskill88 AI 点评 A 级 2026-05-24

Glancer是一款开源的AI工具,提供自然语言数据库查询接口,简化数据分析和可视化,值得关注。

📚 实用指南(长尾问题)
适合谁
  • 构建多智能体协作系统的 Agent 开发者
  • 构建企业知识库 / RAG 检索应用的团队
最佳实践
  • 分块大小建议 256-512 tokens,向量库优选 pgvector 或 Qdrant
  • Agent 任务先做 dry-run 验证工具调用链,再开启自主执行
常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • embedding 模型与查询模型不一致导致检索失效
部署方案
  • 云端托管:可放在 Vercel / Railway / Fly.io 等 PaaS 平台
相关搜索
glancer 中文教程glancer 安装报错怎么办glancer Agent 工作流glancer 与同类工具对比glancer 最佳实践glancer 适合谁用

⚡ 核心功能

👥 适合谁
  • 构建多智能体协作系统的 Agent 开发者
  • 构建企业知识库 / RAG 检索应用的团队
⭐ 最佳实践
  • 分块大小建议 256-512 tokens,向量库优选 pgvector 或 Qdrant
  • Agent 任务先做 dry-run 验证工具调用链,再开启自主执行
⚠️ 常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • embedding 模型与查询模型不一致导致检索失效

👥 适合人群

AI 技术爱好者研究人员和学生开发者和工程师技术创业者

🎯 使用场景

  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发

⚖️ 优点与不足

✅ 优点
  • +MIT 协议,可免费商用
  • +完全开源免费,无授权费用
  • +本地部署,数据完全自主可控
  • +开发者社区支持,遇问题可查可问
⚠️ 不足
  • 安装和初始配置可能需要一定技术基础
  • 功能完整性通常不如成熟商业产品
  • 技术支持主要依赖开源社区,响应速度不稳定
⚠️ 使用须知

AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。

建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。

📄 License 说明

✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。

🔗 相关工具推荐

📰 相关 AI 新闻
🍿 AI 圈相关吃瓜
🗺️ 相关解决方案
🧩 你可能还需要
基于当前 Skill 的能力图谱,自动补全的工具组合

❓ 常见问题 FAQ

glancer 是一款Ruby开发的AI辅助工具。开源AI工具:A Ruby on Rails engine that adds a natural language database query interface to 。⭐8 · Ruby 主要应用场景包括:Glancer适用于数据分析和可视化的场景,帮助用户快速创建自然语言数据库查询接口,提高工作效率。。
💡 AI Skill Hub 点评

AI Skill Hub 点评:Glancer 的核心功能完整,质量良好。对于AI 技术爱好者来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。

📚 深入学习 Glancer
查看分步骤安装教程和完整使用指南,快速上手这款工具
🌐 原始信息
原始名称 glancer
原始描述 开源AI工具:A Ruby on Rails engine that adds a natural language database query interface to 。⭐8 · Ruby
Topics installablebusiness-intelligencedatabasegemllmragruby
GitHub https://github.com/ErnaneJ/glancer
License MIT
语言 Ruby
🔗 原始来源
🐙 GitHub 仓库  https://github.com/ErnaneJ/glancer

收录时间:2026-05-24 · 更新时间:2026-05-30 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。