Changeset 0.17.0 (#75)
This commit is contained in:
@@ -69,8 +69,16 @@ func (t *kbSearchTool) Execute(ctx context.Context, execCtx ExecutionContext, ar
|
||||
// Resolve user's team IDs for scoped access
|
||||
teamIDs, _ := t.stores.Teams.GetUserTeamIDs(ctx, execCtx.UserID)
|
||||
|
||||
// Get active KB IDs for this channel (respects scope: global, team, personal)
|
||||
kbIDs, err := t.stores.KnowledgeBases.GetActiveKBIDs(ctx, execCtx.ChannelID, execCtx.UserID, teamIDs)
|
||||
// Get active KB IDs for this channel, including persona-bound KBs
|
||||
var kbIDs []string
|
||||
var err error
|
||||
if execCtx.PersonaID != "" {
|
||||
kbIDs, err = t.stores.KnowledgeBases.GetActiveKBIDsWithPersona(
|
||||
ctx, execCtx.ChannelID, execCtx.UserID, teamIDs, execCtx.PersonaID)
|
||||
} else {
|
||||
kbIDs, err = t.stores.KnowledgeBases.GetActiveKBIDs(
|
||||
ctx, execCtx.ChannelID, execCtx.UserID, teamIDs)
|
||||
}
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to look up active knowledge bases: %w", err)
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ type ToolResult struct {
|
||||
type ExecutionContext struct {
|
||||
UserID string
|
||||
ChannelID string
|
||||
PersonaID string // set when a persona is active — tools use for scoped KB access
|
||||
}
|
||||
|
||||
// Tool is the interface every built-in tool implements.
|
||||
|
||||
Reference in New Issue
Block a user