refactor: NewXTDriver api, return error if init failed

This commit is contained in:
lilong.129
2025-04-30 14:31:36 +08:00
parent 2ae252b52a
commit 0e9389c796
21 changed files with 146 additions and 146 deletions
+43
View File
@@ -0,0 +1,43 @@
package option
func NewAIServiceOptions(opts ...AIServiceOption) *AIServiceOptions {
services := &AIServiceOptions{}
for _, option := range opts {
option(services)
}
return services
}
type AIServiceOptions struct {
CVService CVServiceType
LLMService LLMServiceType
}
type AIServiceOption func(*AIServiceOptions)
type CVServiceType string
const (
CVServiceTypeVEDEM CVServiceType = "vedem"
CVServiceTypeOpenCV CVServiceType = "opencv"
)
func WithCVService(service CVServiceType) AIServiceOption {
return func(opts *AIServiceOptions) {
opts.CVService = service
}
}
type LLMServiceType string
const (
LLMServiceTypeUITARS LLMServiceType = "ui-tars"
LLMServiceTypeGPT LLMServiceType = "gpt"
LLMServiceTypeQwenVL LLMServiceType = "qwen-vl"
)
func WithLLMService(modelType LLMServiceType) AIServiceOption {
return func(opts *AIServiceOptions) {
opts.LLMService = modelType
}
}