fix: parse result for finished type

This commit is contained in:
lilong.129
2025-03-22 01:19:23 +08:00
parent 12e0f7f9a2
commit f46fcfb456
3 changed files with 35 additions and 5 deletions

View File

@@ -1 +1 @@
v5.0.0-beta-2503220107
v5.0.0-beta-2503220119

View File

@@ -113,7 +113,7 @@ func (p *ActionParser) parseActionText(actionText, thought string) ([]ParsedActi
"type": regexp.MustCompile(`type\(content='([^']+)'\)`),
"scroll": regexp.MustCompile(`scroll\(start_box='([^']+)', direction='([^']+)'\)`),
"wait": regexp.MustCompile(`wait\(\)`),
"finished": regexp.MustCompile(`finished\(\)`),
"finished": regexp.MustCompile(`finished\(content='([^']+)'\)`),
"call_user": regexp.MustCompile(`call_user\(\)`),
}

View File

@@ -93,9 +93,6 @@ func TestVLMPlanning(t *testing.T) {
}
func TestXHSPlanning(t *testing.T) {
err := loadEnv()
require.NoError(t, err)
imageBase64, size, err := loadImage("testdata/xhs-feed.jpeg")
require.NoError(t, err)
@@ -165,6 +162,39 @@ func TestXHSPlanning(t *testing.T) {
}
}
func TestChatList(t *testing.T) {
imageBase64, size, err := loadImage("testdata/chat_list.jpeg")
require.NoError(t, err)
userInstruction := "请结合图片的文字信息,请告诉我一共有多少个群聊,哪些群聊右下角有绿点"
planner, err := NewPlanner(context.Background())
require.NoError(t, err)
opts := &PlanningOptions{
UserInstruction: userInstruction,
Message: &schema.Message{
Role: schema.User,
MultiContent: []schema.ChatMessagePart{
{
Type: schema.ChatMessagePartTypeImageURL,
ImageURL: &schema.ChatMessageImageURL{
URL: imageBase64,
},
},
},
},
Size: size,
}
// 执行规划
result, err := planner.Call(opts)
// 验证结果
require.NoError(t, err)
require.NotNil(t, result)
}
func TestValidateInput(t *testing.T) {
imageBase64, size, err := loadImage("testdata/popup_risk_warning.png")
require.NoError(t, err)