mirror of
https://github.com/fumiama/go-onebot-agent.git
synced 2026-06-05 02:00:23 +08:00
feat: add view image status management
This commit is contained in:
13
agent.go
13
agent.go
@@ -28,6 +28,7 @@ type Agent struct {
|
||||
chars string
|
||||
perm *Perm
|
||||
manualaddreq bool
|
||||
hasimageapi bool
|
||||
}
|
||||
|
||||
// NewAgent 创建一个 Agent 实例。
|
||||
@@ -59,6 +60,11 @@ func (ag *Agent) AddRequest(grp int64, req *zero.APIRequest) {
|
||||
ag.log.Add(grp, req, true)
|
||||
}
|
||||
|
||||
// CanViewImage will be true if SetViewImageAPI is called
|
||||
func (ag *Agent) CanViewImage() bool {
|
||||
return ag.hasimageapi
|
||||
}
|
||||
|
||||
// SetViewImageAPI 为 agent 增加识图功能, 需要模型支持视觉
|
||||
func (ag *Agent) SetViewImageAPI(api deepinfra.API, p model.Protocol) {
|
||||
ag.log.SetPreModelize(func(s *fmt.Stringer) {
|
||||
@@ -93,6 +99,13 @@ func (ag *Agent) SetViewImageAPI(api deepinfra.API, p model.Protocol) {
|
||||
}
|
||||
}
|
||||
})
|
||||
ag.hasimageapi = true
|
||||
}
|
||||
|
||||
// ClearViewImageAPI ...
|
||||
func (ag *Agent) ClearViewImageAPI() {
|
||||
ag.log.SetPreModelize(nil)
|
||||
ag.hasimageapi = false
|
||||
}
|
||||
|
||||
// GetAction get OneBot CallAction from LLM and add it to context.
|
||||
|
||||
Reference in New Issue
Block a user