luogu 0.1.4 → 0.1.6
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/README.md +1 -0
- data/lib/luogu/chatgpt.rb +10 -0
- data/lib/luogu/cli.rb +11 -0
- data/lib/luogu/init.rb +1 -0
- data/lib/luogu/version.rb +1 -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: 5dc8912fdf448f5a9cb2f27d32125bf5a82b5231a8c74f36c03c2269d3345a14
|
4
|
+
data.tar.gz: 9039e6a2ebf32390d96625e734e63c49a9fda770945d8240a4a11dc3d8af114b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfc85f6ebf5dc6970243291b277654a86adc93d3a917e4c571f7e2a7b08bbc74fd7d20ee5fbacd4981ba8b983f9b1da05fe97a60da9b8a3b607a4fe5bf8b6b7b
|
7
|
+
data.tar.gz: e5b8db6cb68a539ec09f706fed396dfafccc352817f1072616b66db77843d95fea9c67374fda515407c75cb71273523d0c8ede5793387a4663ab8c8ca9848480
|
data/README.md
CHANGED
data/lib/luogu/chatgpt.rb
CHANGED
@@ -85,6 +85,16 @@ module Luogu
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
+
def playload(messages)
|
89
|
+
messages.each do |message|
|
90
|
+
puts "test: #{message}"
|
91
|
+
self.puts self.chat(message)
|
92
|
+
end
|
93
|
+
now = Time.now.to_i
|
94
|
+
self.class.save @row_history, "./prompt.row_history.test-#{now}.md"
|
95
|
+
self.class.save @history.to_a, "./prompt.history.test-#{now}.md"
|
96
|
+
end
|
97
|
+
|
88
98
|
class << self
|
89
99
|
def save(history, file_path)
|
90
100
|
text = ""
|
data/lib/luogu/cli.rb
CHANGED
@@ -12,6 +12,7 @@ module Luogu
|
|
12
12
|
luogu build <file> -> 编译prompt
|
13
13
|
luogu run <file> -> 测试 prompt
|
14
14
|
luogu gen <file> <target> -> 根据 json 生成 prompt 文件
|
15
|
+
luogu test <file> <test_file.yml> -> 根据 yaml 来对 prompt 进行测试
|
15
16
|
"""
|
16
17
|
exit
|
17
18
|
end
|
@@ -37,6 +38,16 @@ module Luogu
|
|
37
38
|
chatgpt = ChatGPT.save(json, args.last)
|
38
39
|
end
|
39
40
|
|
41
|
+
subcommands['test'] = Proc.new do |args|
|
42
|
+
promtpt_file = args.first
|
43
|
+
promtpt_test_file = args.last
|
44
|
+
|
45
|
+
chatgpt = ChatGPT.new(args.first)
|
46
|
+
|
47
|
+
messages = YAML.load_file(promtpt_test_file)
|
48
|
+
chatgpt.playload messages
|
49
|
+
end
|
50
|
+
|
40
51
|
if subcommands.key?(ARGV.first)
|
41
52
|
subcommands[ARGV.first].call(ARGV[1..-1])
|
42
53
|
else
|
data/lib/luogu/init.rb
CHANGED
data/lib/luogu/version.rb
CHANGED