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 +4 -4
- data/lib/neh/cli/base.rb +10 -4
- data/lib/neh/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0567a7b6d4b3447f6101fa3862024751fe912d09c32159c2d60e4d4e59d6ecf1
|
4
|
+
data.tar.gz: 0e25bd53826dd8802f94a0708ea73cb00001c7d1f224acea9d8851f818ec2940
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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.
|
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-
|
11
|
+
date: 2024-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|