You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ntool-biz/nkatago/config.go

30 lines
986 B
Go

1 year ago
package nkatago
import (
"errors"
"strings"
)
// KatagoConfig Katago配置
type KatagoConfig struct {
Exec string // Exec 可执行程序路径,可以是相对路径 必填
Mode EngineType `json:",default=Analysis"` // 类型 Analysis | Gtp
Dir string `json:",default=/"` // Katago 路径
Model string `json:",default=/"` // 模型文件路径,可以是相对路径
Config string `json:",default=analysis.cfg"` // 配置文件路径,可以是相对路径
}
func (c KatagoConfig) BuildGTP() (*GtpEngine, error) {
if c.Mode != EngineGTP {
return nil, errors.New("engine mode does not matched")
}
return NewGtpEngine(c.Exec, strings.ToLower(c.Mode), c.Dir, c.Model, c.Config)
}
func (c KatagoConfig) BuildAnalysis() (*AnalysisEngine, error) {
if c.Mode != EngineAnalysis {
return nil, errors.New("engine mode does not matched")
}
return NewAnalysisEngine(c.Exec, strings.ToLower(c.Mode), c.Dir, c.Model, c.Config)
}