query_lens 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -4
- data/app/services/query_lens/sql_generator.rb +3 -2
- data/app/views/query_lens/queries/show.html.erb +1 -1
- data/lib/generators/query_lens/install/install_generator.rb +8 -1
- data/{db/migrate/20260207000001_create_query_lens_tables.rb → lib/generators/query_lens/install/templates/create_query_lens_tables.rb.tt} +1 -1
- data/lib/query_lens/engine.rb +0 -8
- data/lib/query_lens/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 302bd0c222f001ae9997180641b03390b244395de3f4b5070b21be1812590fd8
|
|
4
|
+
data.tar.gz: df5c31d6ab1ca79837cb0e433130b0666f45831666b96a704f4ed27ac5b22465
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c70804e76cbb049fc5733868e6c0c53976a99960425c1894bd544faeff95e82d93fb6827da4ac3a3355694b478d4b92cb2586e4086f394e402087a6470e5afb1
|
|
7
|
+
data.tar.gz: 60ba99c1ff1753974762f25f2a30def02d1fee229c334d1fcaac773e1dea3978f26a9faf9d0f2d8e2d1e2d4148caa94ae1773eda1f8a34f43b7a7f5b59521f42
|
data/README.md
CHANGED
|
@@ -4,9 +4,9 @@ A mountable Rails engine that lets users write natural language questions and ge
|
|
|
4
4
|
|
|
5
5
|
Powered by [RubyLLM](https://rubyllm.com), QueryLens works with any major AI provider: OpenAI, Anthropic (Claude), Google Gemini, DeepSeek, Mistral, Ollama (local models), and more.
|
|
6
6
|
|
|
7
|
-
[
|
|
7
|
+

|
|
8
8
|
|
|
9
|
-
[
|
|
9
|
+
[Watch the demo (90 seconds)](https://www.loom.com/share/595ed0ea3c1f42b28152a345db586c85)
|
|
10
10
|
|
|
11
11
|
**Want to try it without touching your own database?** The [QueryLens Testbed](https://github.com/bryanbeshore/query_lens_testbed) is a ready-to-go Rails app with sample data — clone, run, and start querying in under 2 minutes.
|
|
12
12
|
|
|
@@ -43,8 +43,10 @@ rails db:migrate
|
|
|
43
43
|
|
|
44
44
|
This will:
|
|
45
45
|
1. Create `config/initializers/query_lens.rb` with RubyLLM and QueryLens configuration
|
|
46
|
-
2.
|
|
47
|
-
3.
|
|
46
|
+
2. Copy the migration to create the `query_lens_projects`, `query_lens_saved_queries`, and `query_lens_conversations` tables
|
|
47
|
+
3. Add the engine route to your `config/routes.rb`
|
|
48
|
+
|
|
49
|
+
> **Upgrading from a previous version?** If you already ran migrations from an earlier release (before the install generator included them), your tables are already in place. Just run `rails generate query_lens:install` and skip or discard the generated migration file — no need to migrate again.
|
|
48
50
|
|
|
49
51
|
## Configuration
|
|
50
52
|
|
|
@@ -14,8 +14,9 @@ module QueryLens
|
|
|
14
14
|
- Always include an ORDER BY clause when it makes sense (e.g., by date descending, by amount descending).
|
|
15
15
|
|
|
16
16
|
RESPONSE FORMAT:
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
- When the user asks for data or wants a new/modified query: respond with a brief explanation (1-2 sentences), then the SQL query wrapped in ```sql code fences.
|
|
18
|
+
- When the user asks about the results, asks what a column means, wants clarification, or is discussing the data: respond conversationally WITHOUT SQL code fences. The existing query and results will remain visible.
|
|
19
|
+
- Only include ```sql code fences when you are providing a new or modified query.
|
|
19
20
|
|
|
20
21
|
DATABASE SCHEMA:
|
|
21
22
|
%{schema}
|
|
@@ -253,9 +253,9 @@
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
if (data.explanation) addMessage('ai', data.explanation, genTime);
|
|
256
|
+
conversation.push({ role: 'assistant', content: data.raw || data.explanation });
|
|
256
257
|
if (data.sql) {
|
|
257
258
|
el.sql.value = data.sql;
|
|
258
|
-
conversation.push({ role: 'assistant', content: data.raw || data.explanation });
|
|
259
259
|
await runQueryWithTrace(trace);
|
|
260
260
|
} else {
|
|
261
261
|
addTrace(trace);
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
+
require "rails/generators/active_record/migration"
|
|
2
|
+
|
|
1
3
|
module QueryLens
|
|
2
4
|
module Generators
|
|
3
5
|
class InstallGenerator < Rails::Generators::Base
|
|
6
|
+
include ActiveRecord::Generators::Migration
|
|
4
7
|
source_root File.expand_path("templates", __dir__)
|
|
5
8
|
|
|
6
|
-
desc "Creates a QueryLens initializer and adds the engine route."
|
|
9
|
+
desc "Creates a QueryLens initializer, copies migrations, and adds the engine route."
|
|
7
10
|
|
|
8
11
|
def copy_initializer
|
|
9
12
|
template "initializer.rb", "config/initializers/query_lens.rb"
|
|
10
13
|
end
|
|
11
14
|
|
|
15
|
+
def copy_migrations
|
|
16
|
+
migration_template "create_query_lens_tables.rb.tt", "db/migrate/create_query_lens_tables.rb"
|
|
17
|
+
end
|
|
18
|
+
|
|
12
19
|
def add_route
|
|
13
20
|
route 'mount QueryLens::Engine => "/query_lens"'
|
|
14
21
|
end
|
data/lib/query_lens/engine.rb
CHANGED
|
@@ -5,13 +5,5 @@ module QueryLens
|
|
|
5
5
|
initializer "query_lens.assets" do |app|
|
|
6
6
|
app.config.assets.precompile += %w[query_lens/application.js] if app.config.respond_to?(:assets)
|
|
7
7
|
end
|
|
8
|
-
|
|
9
|
-
initializer "query_lens.migrations" do |app|
|
|
10
|
-
unless app.root.to_s == root.to_s
|
|
11
|
-
config.paths["db/migrate"].expanded.each do |expanded_path|
|
|
12
|
-
app.config.paths["db/migrate"] << expanded_path
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
8
|
end
|
|
17
9
|
end
|
data/lib/query_lens/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: query_lens
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bryan Beshore
|
|
@@ -107,8 +107,8 @@ files:
|
|
|
107
107
|
- app/views/query_lens/layouts/application.html.erb
|
|
108
108
|
- app/views/query_lens/queries/show.html.erb
|
|
109
109
|
- config/routes.rb
|
|
110
|
-
- db/migrate/20260207000001_create_query_lens_tables.rb
|
|
111
110
|
- lib/generators/query_lens/install/install_generator.rb
|
|
111
|
+
- lib/generators/query_lens/install/templates/create_query_lens_tables.rb.tt
|
|
112
112
|
- lib/generators/query_lens/install/templates/initializer.rb
|
|
113
113
|
- lib/query_lens.rb
|
|
114
114
|
- lib/query_lens/configuration.rb
|