trix-genius 0.0.14 → 0.1.0

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: 5b012de7dd80c90da7c071b6913ceaa42a2d210f401537137f8bbbce80e1ce71
4
- data.tar.gz: 0fe0d891d3b5ebf10a5a356fa2a4df556037ab0f7c1adffd0defe7d96eaac52e
3
+ metadata.gz: 05ebdc43ab189099199225ca593632dd48606ed04a3a8c517a538672b4262b2e
4
+ data.tar.gz: 384e3465038e32372293c6bc3f2a6d9990e78be80226d135251f1f48649b04b4
5
5
  SHA512:
6
- metadata.gz: 520222e15e0aa79bce7dc37af4b30f61c3556dd1db306260e74b15fd9fcedb5c52092252e39e7f936168b28e6f08989e2cc9341ac1baa337f299dc4b4fadd14e
7
- data.tar.gz: 527584fdd2c718e0c3f591ec8219a395f70ca9f4d13cca7ae8d7d491832435dd221d345bfcbe2595fb73324e05ec3dee759ef8cbf4914b516dc4253dd82f09ec
6
+ metadata.gz: a47ca9c4fa3552d08ff016b1633eccc00d4f5f06b8fb571828e02de7b0aff85ed81e64cac1cdd37d6b1269c9f002e1fcffda80d772980fed4a5e83f03e9b8068
7
+ data.tar.gz: d781f74a992cfac430634d776fa236ad1a5f9ef10a7417f77cae268afd94a0e9b1ac896b2a64b01fbf1a240e02d3b96fbd9a074db6f74a8b5c169a5ecf6d262c
@@ -28,7 +28,7 @@ module TrixGenius
28
28
 
29
29
  if File.exist?(js_application_controller_path)
30
30
  application_controller_file = File.read(js_application_controller_path)
31
- inject_into_file js_application_controller_path, "\n" + 'import TrixController from "controllers/trix-controller"' + "\n", after: 'import { Application } from "@hotwired/stimulus"'
31
+ inject_into_file js_application_controller_path, "\n" + 'import TrixController from "controllers/trix_genius_controller"' + "\n", after: 'import { Application } from "@hotwired/stimulus"'
32
32
  inject_into_file js_application_controller_path, "\n" + 'application.register("trix", TrixController)' + ("\n" * 2), before: 'export { application }'
33
33
  else
34
34
  puts javascript_application_controller_msg
@@ -1,4 +1,4 @@
1
- TrixGenius.configure do |config|
2
- config.deepseek_api_key=ENV['DEEPSEEK_API_KEY']
3
- end
4
-
1
+ Rails.application.config.deepseek = {
2
+ api_url: ENV['API_URL'],
3
+ api_key: ENV['DEEPSEEK_API_KEY']
4
+ }
@@ -1,7 +1,8 @@
1
- class OrthographyController < ApplicationController
1
+ require 'faraday'
2
+
3
+ class TrixGeniusController < ApplicationController
2
4
  skip_before_action :verify_authenticity_token
3
5
 
4
- # POST /correct_orthography
5
6
  def correct_spelling
6
7
  text = params.require(:text)
7
8
 
@@ -18,7 +19,7 @@ class OrthographyController < ApplicationController
18
19
  def call_ai_service(text)
19
20
  headers = {
20
21
  'Content-Type' => 'application/json',
21
- 'Authorization' => "Bearer #{ENV['DEEPSEEK_API_KEY']}"
22
+ 'Authorization' => "Bearer #{Rails.application.config.deepseek[:api_key}"
22
23
  }
23
24
 
24
25
  body = {
@@ -28,7 +29,7 @@ class OrthographyController < ApplicationController
28
29
  max_tokens: 500
29
30
  }.to_json
30
31
 
31
- response = Faraday.post(ENV['API_URL'], body, headers)
32
+ response = Faraday.post(Rails.application.config.deepseek[:api_url],, body, headers)
32
33
 
33
34
  if response.success?
34
35
  return JSON.parse(response.body)['choices'][0]['message']['content'].split('"')[1]
@@ -69,7 +69,7 @@ RSpec.describe TrixGenius::Generators::InstallGenerator, type: :generator do
69
69
  it "Should updates controller application.js with import line" do
70
70
  run_generator
71
71
  assert_file "app/javascript/controllers/application.js" do |content|
72
- expect(content).to include('import TrixController from "controllers/trix-controller"')
72
+ expect(content).to include('import TrixController from "controllers/trix_genius_controller"')
73
73
  expect(content).to include('application.register("trix", TrixController)')
74
74
  end
75
75
  end
@@ -1,7 +1,8 @@
1
- class OrthographyController < ApplicationController
1
+ require 'faraday'
2
+
3
+ class TrixGeniusController < ApplicationController
2
4
  skip_before_action :verify_authenticity_token
3
5
 
4
- # POST /correct_orthography
5
6
  def correct_spelling
6
7
  text = params.require(:text)
7
8
 
@@ -18,7 +19,7 @@ class OrthographyController < ApplicationController
18
19
  def call_ai_service(text)
19
20
  headers = {
20
21
  'Content-Type' => 'application/json',
21
- 'Authorization' => "Bearer #{ENV['DEEPSEEK_API_KEY']}"
22
+ 'Authorization' => "Bearer #{Rails.application.config.deepseek[:api_key}"
22
23
  }
23
24
 
24
25
  body = {
@@ -28,7 +29,7 @@ class OrthographyController < ApplicationController
28
29
  max_tokens: 500
29
30
  }.to_json
30
31
 
31
- response = Faraday.post(ENV['API_URL'], body, headers)
32
+ response = Faraday.post(Rails.application.config.deepseek[:api_url],, body, headers)
32
33
 
33
34
  if response.success?
34
35
  return JSON.parse(response.body)['choices'][0]['message']['content'].split('"')[1]
@@ -1,5 +1,5 @@
1
1
  import { Application } from "@hotwired/stimulus"
2
- import TrixController from "controllers/trix-controller"
2
+ import TrixController from "controllers/trix_genius_controller"
3
3
 
4
4
  const application = Application.start()
5
5
 
@@ -1,4 +1,4 @@
1
- TrixGenius.configure do |config|
2
- config.deepseek_api_key=ENV['DEEPSEEK_API_KEY']
3
- end
4
-
1
+ Rails.application.config.deepseek = {
2
+ api_url: ENV['API_URL'],
3
+ api_key: ENV['DEEPSEEK_API_KEY']
4
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trix-genius
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giménez Silva Germán Alberto https://rubystacknews.com/