Skip to content

Commit

Permalink
Address comment
Browse files Browse the repository at this point in the history
Signed-off-by: Daishan Peng <[email protected]>
  • Loading branch information
StrongMonkey committed Dec 20, 2024
1 parent 698029d commit dadae58
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,12 @@ func Agent(ctx context.Context, db kclient.Client, agent *v1.Agent, oauthServerU
return nil, nil, err
}

extraEnv, added, err := addKnowledgeTools(ctx, db, agent, opts.Thread, extraEnv)
extraEnv, added, err := configureKnowledgeEnvs(ctx, db, agent, opts.Thread, extraEnv)
if err != nil {
return nil, nil, err
}

// If no knowledge env are added, we should remove the knowledge tool to avoid calling it with empty data to confuse user
if !added {
filteredTools := make([]string, 0)
for _, tool := range mainTool.Tools {
Expand Down Expand Up @@ -169,7 +170,8 @@ func OAuthAppEnv(ctx context.Context, db kclient.Client, oauthAppNames []string,
return extraEnv, nil
}

func addKnowledgeTools(ctx context.Context, db kclient.Client, agent *v1.Agent, thread *v1.Thread, extraEnv []string) ([]string, bool, error) {
// configureKnowledgeEnvs configures environment variables based on knowledge sets associated with an agent and an optional thread.
func configureKnowledgeEnvs(ctx context.Context, db kclient.Client, agent *v1.Agent, thread *v1.Thread, extraEnv []string) ([]string, bool, error) {
var knowledgeSetNames []string
knowledgeSetNames = append(knowledgeSetNames, agent.Status.KnowledgeSetNames...)
if thread != nil {
Expand Down

0 comments on commit dadae58

Please sign in to comment.