Remove OpenAI API references from Assistant struct and initialization

- Eliminate the `openai` field from the `Assistant` struct and its initialization in the `initialize` method, streamlining the Assistant's internal structure.
- This change simplifies the codebase by removing unnecessary dependencies on the OpenAI API, enhancing maintainability.
This commit is contained in:
Max 2026-02-12 19:47:06 +08:00
parent d598394337
commit 464f1abf63
3 changed files with 1 additions and 11 deletions

View file

@ -215,7 +215,6 @@ func (ast *Assistant) Clone() *Assistant {
UpdatedAt: ast.UpdatedAt,
},
HookScript: ast.HookScript,
openai: ast.openai,
}
// Deep copy tags

View file

@ -15,7 +15,6 @@ import (
"github.com/yaoapp/yao/agent/i18n"
searchTypes "github.com/yaoapp/yao/agent/search/types"
store "github.com/yaoapp/yao/agent/store/types"
"github.com/yaoapp/yao/openai"
"gopkg.in/yaml.v3"
)
@ -796,12 +795,6 @@ func (ast *Assistant) initialize() error {
}
ast.Connector = conn
api, err := openai.New(conn)
if err != nil {
return err
}
ast.openai = api
// Register scripts as process handlers
if len(ast.Scripts) > 0 {
if err := ast.RegisterScripts(); err != nil {

View file

@ -8,7 +8,6 @@ import (
outputMessage "github.com/yaoapp/yao/agent/output/message"
store "github.com/yaoapp/yao/agent/store/types"
api "github.com/yaoapp/yao/openai"
)
const (
@ -34,8 +33,7 @@ type Assistant struct {
// Internal
// ===============================
openai *api.OpenAI // OpenAI API
vision bool // Whether this assistant supports vision
vision bool // Whether this assistant supports vision
}
// MCPTool represents a simplified MCP tool for building LLM requests