Merge pull request #860 from trheyi/main

Add default assistant details to Xgen settings
This commit is contained in:
Max 2025-02-09 17:58:50 +08:00 committed by GitHub
commit b841dbc24f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,6 +20,8 @@ import (
"github.com/yaoapp/yao/config"
"github.com/yaoapp/yao/data"
"github.com/yaoapp/yao/i18n"
"github.com/yaoapp/yao/neo"
"github.com/yaoapp/yao/neo/assistant"
"github.com/yaoapp/yao/share"
"github.com/yaoapp/yao/widgets/login"
)
@ -563,6 +565,20 @@ func processXgen(process *process.Process) interface{} {
}
}
// The default assistant
agent := map[string]interface{}{}
if neo.Neo != nil {
ast := neo.Neo.Assistant.(*assistant.Assistant)
if ast != nil {
agent["default"] = map[string]interface{}{
"assistant_id": ast.ID,
"assistant_name": ast.Name,
"assistant_avatar": ast.Avatar,
"assistant_deleteable": false,
}
}
}
xgenSetting := map[string]interface{}{
"name": Setting.Name,
"description": Setting.Description,
@ -574,6 +590,7 @@ func processXgen(process *process.Process) interface{} {
"token": Setting.Token,
"optional": Setting.Optional,
"login": xgenLogin,
"agent": agent,
}
if Setting.Logo != "" {