luogu 0.1.3 → 0.1.5

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: cb3e745f62ebfb4ebf7401ee41225be94c005b911669df30c622d62a44400696
4
- data.tar.gz: 181e888e61066c2f99d3102e946b7e35eca9dca07c15fd91e55b7fc8bd83894d
3
+ metadata.gz: d22ef62531ee8bf0c04bcc4258e2e0287f31b73f03da333b0e4b84aa4438ed3a
4
+ data.tar.gz: 5d9fffc7274eb10622ece637326b0981aec632714b462b2c3762dc12ca6faa38
5
5
  SHA512:
6
- metadata.gz: 8c46cd1408e4baba2cf08f7498ba39408a7acf3ac442ed347f7e7ce0b958210a42e042b492dd11d97a768476165fc65f253b3fd138dabd2bd50ec03b3b815880
7
- data.tar.gz: d84cf9a0d8ca218452976cadd450f696d294df1d809872dc7775a190a15880268283d72cebe899ccd3e1a77c3a9d9e24befae6a7763d2325310b7470a9b88489
6
+ metadata.gz: 395e2b399e098e1c566aa88cf90ecd197b8866528ce7a97c95e11c64bc829778bd1be17a1258cf0f2144c64ad073f18cead2d174881cfa6f01a6fa5b7794831a
7
+ data.tar.gz: 05f9abbddd765a5b0265415fc0afa448446870958cb99b8d07d71930c748c8bb97e80a2c45122c00de3cc0feb906c88cec51168b6b137c3b3ee85975fe1d48b2
data/README.md CHANGED
@@ -13,6 +13,7 @@
13
13
  - luogu build <file> 编译成对应的json
14
14
  - luogu run <file> 测试prompt
15
15
  - luogu gen <prompt.json file> <target.md> 用来逆向生成md文件的命令
16
+ - luogu test <file> <yml> 用来跑自动化测试 yaml 一行一句话
16
17
 
17
18
  你可以在项目目录的.env中设置下面的环境变量,或者直接系统设置
18
19
  ```
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(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
@@ -10,6 +10,7 @@ module Luogu
10
10
 
11
11
  def render
12
12
  process_file
13
+ @messages
13
14
  end
14
15
 
15
16
  def to_json
data/lib/luogu/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Luogu
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luogu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - MJ