mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
change: rename VLM name
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v5.0.0-beta-2506051747
|
v5.0.0-beta-2506051809
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import (
|
|||||||
// NewChat creates a new chat session
|
// NewChat creates a new chat session
|
||||||
func (h *MCPHost) NewChat(ctx context.Context) (*Chat, error) {
|
func (h *MCPHost) NewChat(ctx context.Context) (*Chat, error) {
|
||||||
// Get model config from environment variables
|
// Get model config from environment variables
|
||||||
modelConfig, err := ai.GetModelConfig(option.LLMServiceTypeDoubaoVL)
|
modelConfig, err := ai.GetModelConfig(option.DOUBAO_1_5_THINKING_VISION_PRO_250428)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
hrp "github.com/httprunner/httprunner/v5"
|
hrp "github.com/httprunner/httprunner/v5"
|
||||||
"github.com/httprunner/httprunner/v5/uixt/option"
|
"github.com/httprunner/httprunner/v5/uixt/option"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestIOSSettingsAction(t *testing.T) {
|
func TestIOSSettingsAction(t *testing.T) {
|
||||||
@@ -83,7 +84,7 @@ func TestAndroidAction(t *testing.T) {
|
|||||||
|
|
||||||
func TestStartToGoal(t *testing.T) {
|
func TestStartToGoal(t *testing.T) {
|
||||||
userInstruction := `连连看是一款经典的益智消除类小游戏,通常以图案或图标为主要元素。以下是连连看的基本规则说明:
|
userInstruction := `连连看是一款经典的益智消除类小游戏,通常以图案或图标为主要元素。以下是连连看的基本规则说明:
|
||||||
1. 游戏目标: 玩家需要在规定时间内,通过连接相同的图案或图标,将它们从游戏界面中消除。
|
1. 游戏目标: 玩家需要通过连接相同的图案或图标,将它们从游戏界面中消除。
|
||||||
2. 连接规则:
|
2. 连接规则:
|
||||||
- 两个相同的图案可以通过不超过三条直线连接。
|
- 两个相同的图案可以通过不超过三条直线连接。
|
||||||
- 连接线可以水平或垂直,但不能斜线,也不能跨过其他图案。
|
- 连接线可以水平或垂直,但不能斜线,也不能跨过其他图案。
|
||||||
@@ -91,9 +92,9 @@ func TestStartToGoal(t *testing.T) {
|
|||||||
3. 游戏界面:
|
3. 游戏界面:
|
||||||
- 游戏界面通常是一个矩形区域,内含多个图案或图标,排列成行和列。
|
- 游戏界面通常是一个矩形区域,内含多个图案或图标,排列成行和列。
|
||||||
- 图案或图标在未选中状态下背景为白色,选中状态下背景为绿色。
|
- 图案或图标在未选中状态下背景为白色,选中状态下背景为绿色。
|
||||||
4. 时间限制: 游戏通常设有时间限制,玩家需要在时间耗尽前完成所有图案的消除。
|
4. 重试机制:
|
||||||
5. 得分机制: 每成功连接并消除一对图案,玩家会获得相应的分数。完成游戏后,根据剩余时间和消除效率计算总分。
|
- 游戏失败后,可以点击「立即复活」按钮,观看视频广告;30秒,点击屏幕右上角关闭图标后可继续游戏。
|
||||||
6. 关卡设计: 游戏可能包含多个关卡,随着关卡的推进,图案的复杂度和数量会增加。
|
- 若无法再复活,可以点击「立即挑战」按钮,重新开始游戏。
|
||||||
|
|
||||||
注意事项:
|
注意事项:
|
||||||
1、当连接错误时,顶部的红心会减少一个,需及时调整策略,避免红心变为0个后游戏失败
|
1、当连接错误时,顶部的红心会减少一个,需及时调整策略,避免红心变为0个后游戏失败
|
||||||
@@ -105,7 +106,7 @@ func TestStartToGoal(t *testing.T) {
|
|||||||
|
|
||||||
testCase := &hrp.TestCase{
|
testCase := &hrp.TestCase{
|
||||||
Config: hrp.NewConfig("run ui action with start to goal").
|
Config: hrp.NewConfig("run ui action with start to goal").
|
||||||
SetLLMService(option.LLMServiceTypeDoubaoVL),
|
SetLLMService(option.DOUBAO_1_5_THINKING_VISION_PRO_250428),
|
||||||
TestSteps: []hrp.IStep{
|
TestSteps: []hrp.IStep{
|
||||||
hrp.NewStep("启动抖音「连了又连」小游戏").
|
hrp.NewStep("启动抖音「连了又连」小游戏").
|
||||||
Android().
|
Android().
|
||||||
@@ -117,14 +118,17 @@ func TestStartToGoal(t *testing.T) {
|
|||||||
StartToGoal(userInstruction, option.WithMaxRetryTimes(100)),
|
StartToGoal(userInstruction, option.WithMaxRetryTimes(100)),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
err := hrp.NewRunner(t).Run(testCase)
|
err := testCase.Dump2JSON("start_llk_game.json")
|
||||||
|
require.Nil(t, err)
|
||||||
|
|
||||||
|
err = hrp.NewRunner(t).Run(testCase)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAIAction(t *testing.T) {
|
func TestAIAction(t *testing.T) {
|
||||||
testCase := &hrp.TestCase{
|
testCase := &hrp.TestCase{
|
||||||
Config: hrp.NewConfig("run ui action with ai").
|
Config: hrp.NewConfig("run ui action with ai").
|
||||||
SetLLMService(option.LLMServiceTypeDoubaoVL),
|
SetLLMService(option.DOUBAO_1_5_THINKING_VISION_PRO_250428),
|
||||||
TestSteps: []hrp.IStep{
|
TestSteps: []hrp.IStep{
|
||||||
hrp.NewStep("launch settings").
|
hrp.NewStep("launch settings").
|
||||||
Android().AIAction("进入手机系统设置").
|
Android().AIAction("进入手机系统设置").
|
||||||
|
|||||||
@@ -129,12 +129,12 @@ func GetModelConfig(modelType option.LLMServiceType) (*ModelConfig, error) {
|
|||||||
|
|
||||||
func validateModelType(modelType option.LLMServiceType, modelName string) error {
|
func validateModelType(modelType option.LLMServiceType, modelName string) error {
|
||||||
switch modelType {
|
switch modelType {
|
||||||
case option.LLMServiceTypeUITARS:
|
case option.DOUBAO_1_5_UI_TARS_250428:
|
||||||
if !strings.Contains(modelName, "ui-tars") {
|
if !strings.Contains(modelName, "ui-tars") {
|
||||||
return fmt.Errorf("model name %s is not supported for %s", modelName, modelType)
|
return fmt.Errorf("model name %s is not supported for %s", modelName, modelType)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
case option.LLMServiceTypeDoubaoVL:
|
case option.DOUBAO_1_5_THINKING_VISION_PRO_250428:
|
||||||
if !strings.Contains(modelName, "doubao") || !strings.Contains(modelName, "vision") {
|
if !strings.Contains(modelName, "doubao") || !strings.Contains(modelName, "vision") {
|
||||||
return fmt.Errorf("model name %s is not supported", modelName)
|
return fmt.Errorf("model name %s is not supported", modelName)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ func NewAsserter(ctx context.Context, modelConfig *ModelConfig) (*Asserter, erro
|
|||||||
systemPrompt: defaultAssertionPrompt,
|
systemPrompt: defaultAssertionPrompt,
|
||||||
}
|
}
|
||||||
|
|
||||||
if modelConfig.ModelType == option.LLMServiceTypeUITARS {
|
if modelConfig.ModelType == option.DOUBAO_1_5_UI_TARS_250428 {
|
||||||
asserter.systemPrompt += "\n" + uiTarsAssertionResponseFormat
|
asserter.systemPrompt += "\n" + uiTarsAssertionResponseFormat
|
||||||
} else {
|
} else {
|
||||||
// define output format
|
// define output format
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func createAsserter(t *testing.T) *Asserter {
|
func createAsserter(t *testing.T) *Asserter {
|
||||||
modelConfig, err := GetModelConfig(option.LLMServiceTypeUITARS)
|
modelConfig, err := GetModelConfig(option.DOUBAO_1_5_UI_TARS_250428)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
asserter, err := NewAsserter(context.Background(), modelConfig)
|
asserter, err := NewAsserter(context.Background(), modelConfig)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ type LLMContentParser interface {
|
|||||||
|
|
||||||
func NewLLMContentParser(modelType option.LLMServiceType) LLMContentParser {
|
func NewLLMContentParser(modelType option.LLMServiceType) LLMContentParser {
|
||||||
switch modelType {
|
switch modelType {
|
||||||
case option.LLMServiceTypeUITARS:
|
case option.DOUBAO_1_5_UI_TARS_250428:
|
||||||
return &UITARSContentParser{
|
return &UITARSContentParser{
|
||||||
systemPrompt: doubao_1_5_ui_tars_planning_prompt,
|
systemPrompt: doubao_1_5_ui_tars_planning_prompt,
|
||||||
actionMapping: doubao_1_5_ui_tars_action_mapping,
|
actionMapping: doubao_1_5_ui_tars_action_mapping,
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ func (p *Planner) History() *ConversationHistory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Planner) RegisterTools(tools []*schema.ToolInfo) error {
|
func (p *Planner) RegisterTools(tools []*schema.ToolInfo) error {
|
||||||
if p.modelConfig.ModelType == option.LLMServiceTypeUITARS {
|
if p.modelConfig.ModelType == option.DOUBAO_1_5_UI_TARS_250428 {
|
||||||
// tools have been registered in ui-tars system prompt
|
// tools have been registered in ui-tars system prompt
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ func TestVLMPlanning(t *testing.T) {
|
|||||||
|
|
||||||
userInstruction += "\n\n请基于以上游戏规则,给出下一步可点击的两个图标坐标"
|
userInstruction += "\n\n请基于以上游戏规则,给出下一步可点击的两个图标坐标"
|
||||||
|
|
||||||
modelConfig, err := GetModelConfig(option.LLMServiceTypeUITARS)
|
modelConfig, err := GetModelConfig(option.DOUBAO_1_5_UI_TARS_250428)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
planner, err := NewPlanner(context.Background(), modelConfig)
|
planner, err := NewPlanner(context.Background(), modelConfig)
|
||||||
@@ -72,7 +72,7 @@ func TestXHSPlanning(t *testing.T) {
|
|||||||
|
|
||||||
userInstruction := "点击第二个帖子的作者头像"
|
userInstruction := "点击第二个帖子的作者头像"
|
||||||
|
|
||||||
modelConfig, err := GetModelConfig(option.LLMServiceTypeUITARS)
|
modelConfig, err := GetModelConfig(option.DOUBAO_1_5_UI_TARS_250428)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
planner, err := NewPlanner(context.Background(), modelConfig)
|
planner, err := NewPlanner(context.Background(), modelConfig)
|
||||||
@@ -115,7 +115,7 @@ func TestChatList(t *testing.T) {
|
|||||||
|
|
||||||
userInstruction := "请结合图片的文字信息,请告诉我一共有多少个群聊,哪些群聊右下角有绿点"
|
userInstruction := "请结合图片的文字信息,请告诉我一共有多少个群聊,哪些群聊右下角有绿点"
|
||||||
|
|
||||||
modelConfig, err := GetModelConfig(option.LLMServiceTypeUITARS)
|
modelConfig, err := GetModelConfig(option.DOUBAO_1_5_UI_TARS_250428)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
planner, err := NewPlanner(context.Background(), modelConfig)
|
planner, err := NewPlanner(context.Background(), modelConfig)
|
||||||
@@ -147,7 +147,7 @@ func TestChatList(t *testing.T) {
|
|||||||
|
|
||||||
func TestHandleSwitch(t *testing.T) {
|
func TestHandleSwitch(t *testing.T) {
|
||||||
userInstruction := "检查发送框下方的联网搜索开关,蓝色为开启状态,灰色为关闭状态;若开关处于关闭状态,则点击进行开启"
|
userInstruction := "检查发送框下方的联网搜索开关,蓝色为开启状态,灰色为关闭状态;若开关处于关闭状态,则点击进行开启"
|
||||||
modelConfig, err := GetModelConfig(option.LLMServiceTypeUITARS)
|
modelConfig, err := GetModelConfig(option.DOUBAO_1_5_UI_TARS_250428)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
planner, err := NewPlanner(context.Background(), modelConfig)
|
planner, err := NewPlanner(context.Background(), modelConfig)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func setupADBDriverExt(t *testing.T) *XTDriver {
|
|||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
driverExt, err := NewXTDriver(driver,
|
driverExt, err := NewXTDriver(driver,
|
||||||
option.WithCVService(option.CVServiceTypeVEDEM),
|
option.WithCVService(option.CVServiceTypeVEDEM),
|
||||||
option.WithLLMService(option.LLMServiceTypeDoubaoVL),
|
option.WithLLMService(option.DOUBAO_1_5_THINKING_VISION_PRO_250428),
|
||||||
)
|
)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
return driverExt
|
return driverExt
|
||||||
|
|||||||
@@ -31,10 +31,8 @@ func WithCVService(service CVServiceType) AIServiceOption {
|
|||||||
type LLMServiceType string
|
type LLMServiceType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
LLMServiceTypeUITARS LLMServiceType = "ui-tars" // not support function calling and json response
|
DOUBAO_1_5_UI_TARS_250428 LLMServiceType = "doubao-1.5-ui-tars-250428" // not support function calling and json response
|
||||||
LLMServiceTypeDoubaoVL LLMServiceType = "doubao-vision"
|
DOUBAO_1_5_THINKING_VISION_PRO_250428 LLMServiceType = "doubao-1.5-thinking-vision-pro-250428"
|
||||||
LLMServiceTypeGPT LLMServiceType = "gpt"
|
|
||||||
LLMServiceTypeQwenVL LLMServiceType = "qwen-vl"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func WithLLMService(modelType LLMServiceType) AIServiceOption {
|
func WithLLMService(modelType LLMServiceType) AIServiceOption {
|
||||||
|
|||||||
Reference in New Issue
Block a user