yptools 1.0.15 → 1.0.16
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 +4 -4
- data/lib/yptools/chatai/yp_chatai.rb +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cb3e39055391054fe343255192ab05476b7e579002f2749e52b664293c47347
|
4
|
+
data.tar.gz: df8a95a939692f3f62da1e04a8240c84feadd2adb2da6a3110445dbb2144a9ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19f54c0bc031663974d6115540de9bf6f0001b12815a9691a2d85774e90618888d1e7674704778d10d90f38f1e695bd5a20c606ebe0d9c505f4e5b10815b2aaf
|
7
|
+
data.tar.gz: eba0155e8c4030b679fb400efd9397aae196fbfdef9523cf074f2c7195ac83ab0d4a2f177a270eaf4c3d9858452e4cdbe35a01e2f4b48370621ba2fff3f214e8
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative '../log/yp_log'
|
2
2
|
require 'net/http'
|
3
3
|
require 'json'
|
4
|
+
require 'base64'
|
4
5
|
|
5
6
|
class YPChatAI
|
6
7
|
|
@@ -14,9 +15,13 @@ class YPChatAI
|
|
14
15
|
http = Net::HTTP.new(url.host, url.port)
|
15
16
|
http.use_ssl = true
|
16
17
|
# 设置请求头
|
18
|
+
yp_token = "c2stTVRVMVZqeUdpNWxzYlU1TmNlU1pUM0JsYmtGSmNYam5iUk5ROENVYUd2QVR4WXpp"
|
19
|
+
# 将Base64字符串解码为原始二进制数据
|
20
|
+
decoded_data = Base64.decode64(yp_token).force_encoding("UTF-8")
|
21
|
+
|
17
22
|
headers = {
|
18
23
|
'Content-Type' => 'application/json',
|
19
|
-
'Authorization' => 'Bearer
|
24
|
+
'Authorization' => 'Bearer ' + decoded_data
|
20
25
|
}
|
21
26
|
# 设置请body
|
22
27
|
data = {
|