Refactor assistant type assertion in Xgen processing

- Improve type safety when accessing Neo's assistant
- Use type assertion with ok check to handle potential nil or incorrect type
- Simplify assistant context retrieval in Xgen settings
This commit is contained in:
Max 2025-02-09 18:26:51 +08:00
parent dc6967805e
commit 8f57c38b26

View file

@ -568,8 +568,7 @@ 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 {
if ast, ok := neo.Neo.Assistant.(*assistant.Assistant); ok {
agent["default"] = map[string]interface{}{
"assistant_id": ast.ID,
"assistant_name": ast.Name,