feat: set LLMService/CVService for case runner

This commit is contained in:
lilong.129
2025-04-28 19:45:07 +08:00
parent 7fa4155390
commit 4d7dc466f3
5 changed files with 31 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ import (
"reflect"
"github.com/httprunner/httprunner/v5/internal/builtin"
"github.com/httprunner/httprunner/v5/uixt/ai"
"github.com/httprunner/httprunner/v5/uixt/option"
)
@@ -42,6 +43,8 @@ type TConfig struct {
Path string `json:"path,omitempty" yaml:"path,omitempty"` // testcase file path
PluginSetting *PluginConfig `json:"plugin,omitempty" yaml:"plugin,omitempty"` // plugin config
IgnorePopup bool `json:"ignore_popup,omitempty" yaml:"ignore_popup,omitempty"`
LLMService ai.LLMServiceType `json:"llm_service,omitempty" yaml:"llm_service,omitempty"`
CVService ai.CVServiceType `json:"cv_service,omitempty" yaml:"cv_service,omitempty"`
}
func (c *TConfig) Get() *TConfig {
@@ -108,6 +111,18 @@ func (c *TConfig) SetWeight(weight int) *TConfig {
return c
}
// SetLLMService sets LLM service for current testcase.
func (c *TConfig) SetLLMService(llmService ai.LLMServiceType) *TConfig {
c.LLMService = llmService
return c
}
// SetCVService sets CV service for current testcase.
func (c *TConfig) SetCVService(cvService ai.CVServiceType) *TConfig {
c.CVService = cvService
return c
}
func (c *TConfig) SetWebSocket(times, interval, timeout, size int64) *TConfig {
c.WebSocketSetting = &WebSocketConfig{
ReconnectionTimes: times,