neh 0.0.19 → 0.0.20

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: 0c98adee45058fca1fd2d8ad4d4b986e9273d053336e380fa9cdc3e745bc2d25
4
- data.tar.gz: a2a97a95699a29cde7e0374be428613d34caf49cbba52610917f3e147bf32798
3
+ metadata.gz: 0567a7b6d4b3447f6101fa3862024751fe912d09c32159c2d60e4d4e59d6ecf1
4
+ data.tar.gz: 0e25bd53826dd8802f94a0708ea73cb00001c7d1f224acea9d8851f818ec2940
5
5
  SHA512:
6
- metadata.gz: 02773dbfef6e5f43f48fd77d7f71587a5c3e8b811e4acbeaa47d529504257f714f5c0952e8e515bd8f90c359058fb0c4f591f54cab37ddc5f961a0bb99cafe12
7
- data.tar.gz: 48f77eebdb4b7c6b94ea5a449c39db3e56465c916d37cfd7084b46386a767302c7157b9921375742603b224abd454e13fbf0978e315f67ec238321526f6af937
6
+ metadata.gz: 31e4294dd35df3193358e93b632c2c7746590670a21367efeb60fbfd3fa53553500a3906aa725fb87f8b6b12d8559a164834b4c431f05e145b2d99caf4173a16
7
+ data.tar.gz: 75779ccf1bdc6e51f25a25348741f130748094abcc71db3199a4ab170f3910dbd9daa423c8f864896be86b5418dceb5b53c138b12e9479db5cff41c4c6d848e2
data/lib/neh/cli/base.rb CHANGED
@@ -11,7 +11,7 @@ require 'faraday'
11
11
  require 'pry' if ENV['NEH_DEBUG']
12
12
  require 'active_support/all'
13
13
 
14
- class Neh::Cli::Base
14
+ class Neh::Cli::Base # rubocop:disable Metrics/ClassLength
15
15
  def initialize(*args, options:)
16
16
  @message = args.join(' ')
17
17
 
@@ -19,8 +19,8 @@ class Neh::Cli::Base
19
19
  server_host = ENV.fetch('NEH_SERVER_HOST', 'yoryo.gipcompany.com')
20
20
  server_port = ENV.fetch('NEH_SERVER_PORT', 443)
21
21
  @channel = 'LargeLanguageModelQueryChannel'
22
-
23
- url = "ws://#{server_host}:#{server_port}/cable"
22
+ @uuid = SecureRandom.uuid
23
+ url = "ws://#{server_host}:#{server_port}/cable?uuid=#{@uuid}"
24
24
  @endpoint = Async::HTTP::Endpoint.parse(url)
25
25
  end
26
26
 
@@ -56,11 +56,15 @@ class Neh::Cli::Base
56
56
  def handle_connection_message(connection, message)
57
57
  type = message[:type]
58
58
 
59
+ print "type: #{type}, message: #{message}" if ENV['NEH_DEBUG']
60
+
59
61
  case type
60
62
  when 'welcome'
61
63
  subscribe(connection)
62
- when 'confirm_subscription', 'ping'
64
+ when 'confirm_subscription'
63
65
  on_subscribed
66
+ when 'ping'
67
+ # do nothing
64
68
  when 'disconnect'
65
69
  puts "Connection has been disconnected. Reason: #{message[:reason]}"
66
70
  close(connection)
@@ -90,7 +94,8 @@ class Neh::Cli::Base
90
94
  {
91
95
  command: :subscribe,
92
96
  identifier: {
93
- channel: @channel
97
+ channel: @channel,
98
+ uuid: @uuid
94
99
  }.to_json
95
100
  }
96
101
  connection.write(content.to_json)
@@ -101,6 +106,7 @@ class Neh::Cli::Base
101
106
  response = http_connection.post("/api/neh/#{command}") do |req|
102
107
  req.body = {
103
108
  message: @message,
109
+ uuid: @uuid,
104
110
  token:
105
111
  }.to_json
106
112
 
data/lib/neh/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Neh
4
- VERSION = "0.0.19"
4
+ VERSION = "0.0.20"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Atsushi Ishida
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-12 00:00:00.000000000 Z
11
+ date: 2024-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport