query_lens 0.1.0 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d28f67096af3240b7f12db962ca83d94b7cb0677d729f3410f4101ef2a827ddd
4
- data.tar.gz: cf58506046e37fbd584b6cd8fcf11f3b24567d6495a16250d50797f8f206872e
3
+ metadata.gz: 8483ac3f8d86dbaa16242e87fec870d20161b25ccb1e68c6781c77f5043475fb
4
+ data.tar.gz: 0f36bbc48b10e5b9fa933d4b57bd05c846947f67dfc906fbc1e06e09e6152c95
5
5
  SHA512:
6
- metadata.gz: 6f544be843075beeb03ae79316627e2970b5b8644358fdf60b2576c22555790e97699502a93ba09d9c64b724547e2f47770c25953c2a16ebe9a485fa8dfc3ee7
7
- data.tar.gz: d6ef26c0c2fcf1527bb57eb70d98e56a4fe18bc8e57965a3b917b1a537dca8007684e76fcd21ee8099d401c1d3cf6da8623e9bd19d6bb0c8353948ff9f9ecee5
6
+ metadata.gz: 45eb9530141266e8de24ee0f6fa437e62eb48887f0d9603ad20451046e860f533697ceab831a474200143b1f6ca103b033fbc95080e527e5cb6e9be0cad46ec3
7
+ data.tar.gz: 1375571e833d3244d091c4b16b70a363c58289a5b522290679b936bcc376befbbe81363a70092399f56c3e23a8a29befe1755058e63101e0e8f9563fea4ebac5
data/README.md CHANGED
@@ -4,6 +4,12 @@ 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
+ ![QueryLens Screenshot](docs/screenshot.png)
8
+
9
+ [Watch the demo (90 seconds)](https://www.loom.com/share/595ed0ea3c1f42b28152a345db586c85)
10
+
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
+
7
13
  ## Features
8
14
 
9
15
  - Natural language to SQL conversion powered by any LLM
@@ -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
- Respond with a brief explanation of what the query does, then the SQL query wrapped in ```sql code fences.
18
- Keep explanations concise (1-2 sentences).
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);
@@ -0,0 +1,32 @@
1
+ class CreateQueryLensTables < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :query_lens_projects do |t|
4
+ t.string :name, null: false
5
+ t.text :description
6
+ t.integer :position
7
+ t.timestamps
8
+ end
9
+
10
+ add_index :query_lens_projects, :name, unique: true
11
+
12
+ create_table :query_lens_saved_queries do |t|
13
+ t.string :name, null: false
14
+ t.text :description
15
+ t.text :sql, null: false
16
+ t.references :project, foreign_key: { to_table: :query_lens_projects, on_delete: :nullify }
17
+ t.integer :position
18
+ t.timestamps
19
+ end
20
+
21
+ add_index :query_lens_saved_queries, [:project_id, :name], unique: true
22
+
23
+ create_table :query_lens_conversations do |t|
24
+ t.string :title, null: false
25
+ t.text :messages
26
+ t.text :last_sql
27
+ t.timestamps
28
+ end
29
+
30
+ add_index :query_lens_conversations, :updated_at
31
+ end
32
+ end
@@ -1,3 +1,3 @@
1
1
  module QueryLens
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
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.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Beshore
@@ -107,6 +107,7 @@ 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
110
111
  - lib/generators/query_lens/install/install_generator.rb
111
112
  - lib/generators/query_lens/install/templates/initializer.rb
112
113
  - lib/query_lens.rb