chatKnowledgeActive reports whether the exception applies to THIS turn: enabled and at least one knowledge base attached to the session. Without an attached base the chat turn stays exactly as before.
()
| 49 | // enabled and at least one knowledge base attached to the session. Without an |
| 50 | // attached base the chat turn stays exactly as before. |
| 51 | func (cli *ChatCLI) chatKnowledgeActive() bool { |
| 52 | if !chatKnowledgeEnabled() || cli.contextHandler == nil { |
| 53 | return false |
| 54 | } |
| 55 | sessionID := cli.currentSessionName |
| 56 | if sessionID == "" { |
| 57 | sessionID = "default" |
| 58 | } |
| 59 | return len(cli.contextHandler.GetManager().AttachedKnowledge(sessionID)) > 0 |
| 60 | } |
| 61 | |
| 62 | // knowledgeToolDefinition is the native tool-use definition offered in the |
| 63 | // chat decision turn. The parameters mirror the @knowledge JSON envelope, so |