1
0
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:
源文雨
2025-09-24 23:37:27 +08:00
parent a655747fa2
commit 0cdc929590

View File

@@ -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.