neh 0.0.18 → 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: 3a0072dc145f6f3c9465b0ab362284e8524e12714c9fe691e2b3409068053bb2
4
- data.tar.gz: dc46224b988d300326cb4bde008d244651e67bf0b723194992217db54d7b2f8c
3
+ metadata.gz: 0567a7b6d4b3447f6101fa3862024751fe912d09c32159c2d60e4d4e59d6ecf1
4
+ data.tar.gz: 0e25bd53826dd8802f94a0708ea73cb00001c7d1f224acea9d8851f818ec2940
5
5
  SHA512:
6
- metadata.gz: 53cec3325e390fc4b6d480139178a97f8fd9b3cf656aabe1b88b033091573fd2b59914ac2ddc69596547588b9fe31eff9c5431d08df55e921d4b0fc971d30418
7
- data.tar.gz: 5a6e101c210e48c84a8c29957e46a761c928e00b3a0a50cd62be7b5f803af195d9f77148e3e766e476a906b348d8f1eedacadc283d5a6adb6eeaa9b444ccb786
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
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.18"
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.18
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