qodex-rails 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cc9a5ccd335641d6c77c77ec917e86f4546b9ad6b17111b5a3ea52bc79faa3c
4
- data.tar.gz: b5bc6ee69f2d251c98cc72c22957d01f0f58437909b47f031e91d1b31dd44de6
3
+ metadata.gz: 5d080fca50aa62a0fd87df635167b95cc00c08daf13c66ece7967b623bd40d4f
4
+ data.tar.gz: bc4bbe33dad3f8cabb516452d7f15953db58fb60419dc66cfe3ece4b6e2298c0
5
5
  SHA512:
6
- metadata.gz: 17ebca6fdc4e5349277352f388181e6e5a75164c3acaa43a52db8c3f39ae257e1b3a1f48459eaf0e89aa507b050c49b7a1f563e157a63f8375355dee65f4afee
7
- data.tar.gz: 9e2e6bd01d2d2eb2be4073aac3403154edf8a8ca68db91ab06bf5c84405aa589c927885572f4dfbe18d846e1081e6ba3c688766c48bc8dbf1bdd1dbec592fc72
6
+ metadata.gz: 7ddfeddfa0c02ee396284a0d606a70120266b9483734d69b06fb9f771152b02e29697b9799cb2586f8c48f43491ebe3f4f41b5def8a0bcc04dbeacdc09716d02
7
+ data.tar.gz: '09ef8c37d89a0ec3fb07759e79320dff24d415ff0659502502b5c515ce6fb468e0d140787cf307a8659f5d797c9f025f5c48b700da11e03e0bec44b2f5eaee64'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Qodex
4
4
  module Rails
5
- VERSION = "0.1.1"
5
+ VERSION = "0.1.2"
6
6
  end
7
7
  end
@@ -10,6 +10,15 @@ module QodexRails
10
10
  end
11
11
 
12
12
  def call(env)
13
+ # Exit early if collection_name or api_key are not configured
14
+ unless QodexRails.configuration.collection_name && QodexRails.configuration.api_key
15
+ Rails.logger.warn "QodexRails: collection_name or api_key not configured. Skipping middleware."
16
+ return @app.call(env)
17
+ end
18
+
19
+ # Print the initializer keys to the output
20
+ Rails.logger.info "QodexRails Initializer Keys: Collection Name: #{QodexRails.configuration.collection_name}, API Key: #{QodexRails.configuration.api_key}"
21
+
13
22
  start_time = Time.now
14
23
 
15
24
  # Capture the request details
@@ -59,7 +68,7 @@ module QodexRails
59
68
  end
60
69
 
61
70
  def send_to_api(logs)
62
- uri = URI("#{ENV['API_URL']}/api/v1/collections/create_with_folder/#{ENV['API_KEY']}")
71
+ uri = URI("https://api.app.qodex.ai/api/v1/collections/create_with_folder/#{QodexRails.configuration.api_key}")
63
72
  request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
64
73
  request.body = JSON.generate(logs)
65
74
  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
@@ -67,7 +76,7 @@ module QodexRails
67
76
  end
68
77
 
69
78
  # Optionally log the response from the external API
70
- Rails.logger.info "API Response: #{response.body}" if response
79
+ Rails.logger.info "URI: #{uri}, API Response: #{response.body}" if response
71
80
  end
72
81
  end
73
82
  end
@@ -1,3 +1,3 @@
1
1
  module QodexRails
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qodex-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sid
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-30 00:00:00.000000000 Z
11
+ date: 2023-10-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Intercept your rails application to power Qodex.ai AI copilot.
14
14
  email:
@@ -31,6 +31,7 @@ files:
31
31
  - lib/qodex/rails.rb
32
32
  - lib/qodex/rails/version.rb
33
33
  - qodex-rails-0.1.0.gem
34
+ - qodex-rails-0.1.1.gem
34
35
  - sig/qodex/rails.rbs
35
36
  homepage: https://qodex.ai
36
37
  licenses: