feat: 优化无用逻辑

This commit is contained in:
余泓铮
2025-06-30 19:41:12 +08:00
parent dbb72cd801
commit 6e8edcaa53
2 changed files with 8 additions and 6 deletions

View File

@@ -139,11 +139,6 @@ func (wd *WDADriver) Setup() error {
// Store base URL for building full URLs
baseURL := fmt.Sprintf("http://localhost:%d", localPort)
wd.Session.SetBaseURL(baseURL)
if err = wd.initMjpegClient(); err != nil {
return err
}
// create new session
if err := wd.InitSession(nil); err != nil {
return errors.Wrap(code.DeviceHTTPDriverError, err.Error())
@@ -840,6 +835,10 @@ func (wd *WDADriver) triggerWDALog(data map[string]interface{}) (rawResp []byte,
func (wd *WDADriver) ScreenRecord(opts ...option.ActionOption) (videoPath string, err error) {
log.Info().Msg("WDADriver.ScreenRecord")
err = wd.initMjpegClient()
if err != nil {
return "", err
}
timestamp := time.Now().Format("20060102_150405") + fmt.Sprintf("_%03d", time.Now().UnixNano()/1e6%1000)
fileName := filepath.Join(config.GetConfig().ScreenShotsPath(), fmt.Sprintf("%s.mp4", timestamp))

View File

@@ -1,7 +1,9 @@
package option
func NewAIServiceOptions(opts ...AIServiceOption) *AIServiceOptions {
services := &AIServiceOptions{}
services := &AIServiceOptions{
Enable: true,
}
for _, option := range opts {
option(services)
}
@@ -9,6 +11,7 @@ func NewAIServiceOptions(opts ...AIServiceOption) *AIServiceOptions {
}
type AIServiceOptions struct {
Enable bool `json:"enable,omitempty" yaml:"enable,omitempty"`
CVService CVServiceType `json:"cv_service,omitempty" yaml:"cv_service,omitempty"`
LLMService LLMServiceType `json:"llm_service,omitempty" yaml:"llm_service,omitempty"`
LLMConfig *LLMServiceConfig `json:"llm_config,omitempty" yaml:"llm_config,omitempty"` // advanced LLM configuration