You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.7 KiB
58 lines
1.7 KiB
package agents
|
|
|
|
import (
|
|
"yunyan/lego/base"
|
|
"yunyan/lego/core"
|
|
"yunyan/modules"
|
|
)
|
|
|
|
type apiComp struct {
|
|
modules.MCompHttpGate
|
|
service base.IRPCXService
|
|
module *Agents
|
|
options *Options
|
|
}
|
|
|
|
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
|
this.MCompHttpGate.Init(service, module, comp, options)
|
|
this.service = service.(base.IRPCXService)
|
|
this.module = module.(*Agents)
|
|
this.options = options.(*Options)
|
|
return
|
|
}
|
|
|
|
// 外部API响应结构
|
|
type voitransAgentsResp struct {
|
|
Agents []*voitransAgentItem `json:"agents"`
|
|
}
|
|
|
|
type voitransAgentItem struct {
|
|
AgentID string `json:"agent_id"`
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
Description string `json:"description"`
|
|
AvatarURL string `json:"avatar_url"`
|
|
SupportedLanguages []string `json:"supported_languages"`
|
|
Variables []*voitransAgentVariable `json:"variables"`
|
|
}
|
|
|
|
type voitransAgentVariable struct {
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
Required bool `json:"required"`
|
|
Default string `json:"default"`
|
|
Description string `json:"description"`
|
|
}
|
|
|
|
type voitransConnectResp struct {
|
|
ConnectURL string `json:"connect_url"`
|
|
Token string `json:"token"`
|
|
ExpiresAt string `json:"expires_at"`
|
|
ExpiresIn int32 `json:"expires_in"`
|
|
Agent struct {
|
|
AgentID string `json:"agent_id"`
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
Description string `json:"description"`
|
|
} `json:"agent"`
|
|
}
|
|
|