Skip to content

Commit 89d70fb

Browse files
authored
Merge pull request #50 from ThinkThinkAI/apikey_notrequired
apikey is technically not required
2 parents 298cba5 + aa35713 commit 89d70fb

5 files changed

Lines changed: 6 additions & 15 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.23-alpha
1+
1.0.24-alpha

app/models/data_source.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ class DataSource < ApplicationRecord
1010
before_save :encrypt_password, if: :password_changed?
1111
before_save :unset_other_connected_sources, if: :connected
1212

13+
# has_many :data_source_users
14+
# has_many :users, through: :data_source_users
15+
1316
after_save :build_tables_if_connected
1417

1518
after_destroy :activate_first_available_data_source_if_none_active

app/models/user.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def self.from_omniauth(auth)
2323
end
2424

2525
def settings_incomplete?
26-
ai_url.blank? || ai_model.blank? || ai_api_key.blank?
26+
ai_url.blank? || ai_model.blank?
2727
end
2828

2929
private

app/services/ai_service.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def query_system_message(data_source)
3030
You will be asked by the user for information or to perform a task on the database.
3131
Your response will only be in JSON which will include up too 2 things.
3232
1. the query to do what was requested by the user.
33-
2. if the query is a delete or update then a select query to preview which records would be affected.
33+
2. if the query is not a select query we will need to preview which records would be affected. examples are drop, update, delete.
3434
The JSON will look like this. { sql: "query needed", preview: "preview query" }
3535
Do not include the preview if it is not necesary.
3636
Below is the schema for the database.

spec/models/user_spec.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,6 @@
8787
expect(user.settings_incomplete?).to be true
8888
end
8989
end
90-
91-
context 'when ai_api_key is blank' do
92-
before do
93-
user.ai_url = 'http://example.com'
94-
user.ai_model = 'example_model'
95-
user.ai_api_key = ''
96-
end
97-
98-
it 'returns true' do
99-
expect(user.settings_incomplete?).to be true
100-
end
101-
end
10290
end
10391

10492
describe '.from_omniauth' do

0 commit comments

Comments
 (0)