refactor: align module naming with ai-agent

This commit is contained in:
t
2026-08-21 00:57:23 +08:00
parent 2bbf42b741
commit 6845c728f8
2 changed files with 7 additions and 7 deletions
+36
View File
@@ -0,0 +1,36 @@
package aiagent
import (
"errors"
"net/http"
"code.tczkiot.com/wlw/ai-agent/identity"
"code.tczkiot.com/wlw/ai-agent/internal/bootstrap"
"code.tczkiot.com/wlw/ai-agent/internal/services"
)
type Options struct {
ConfigPath string
QuerySubjects identity.QuerySubjectsFunc
Authorize identity.AuthorizeFunc
}
// New initializes the customer-service business module. Authentication and
// authorization must already have been completed by the host system.
func New(options Options) (http.Handler, error) {
if options.QuerySubjects == nil {
return nil, errors.New("ai-agent: QuerySubjects is required")
}
if options.Authorize == nil {
return nil, errors.New("ai-agent: Authorize is required")
}
if options.ConfigPath == "" {
options.ConfigPath = "config/config.yaml"
}
services.SetQuerySubjects(options.QuerySubjects)
services.SetAuthorize(options.Authorize)
if err := bootstrap.Init(options.ConfigPath); err != nil {
return nil, err
}
return bootstrap.NewServer()
}