diff --git a/pkg/controller/handlers/knowledgeset/knowledgeset.go b/pkg/controller/handlers/knowledgeset/knowledgeset.go index 12007967..08f97e70 100644 --- a/pkg/controller/handlers/knowledgeset/knowledgeset.go +++ b/pkg/controller/handlers/knowledgeset/knowledgeset.go @@ -54,6 +54,7 @@ func (h *Handler) GenerateDataDescription(req router.Request, resp router.Respon } if len(files.Items) == 0 { + ks.Status.IsEmpty = true return nil } diff --git a/pkg/render/render.go b/pkg/render/render.go index 1a3151bd..380be304 100644 --- a/pkg/render/render.go +++ b/pkg/render/render.go @@ -154,7 +154,7 @@ func addKnowledgeTools(ctx context.Context, db kclient.Client, agent *v1.Agent, dataDescription = ks.Status.SuggestedDataDescription } - if dataDescription == "" { + if ks.Status.IsEmpty || dataDescription == "" { continue } diff --git a/pkg/storage/apis/otto.gptscript.ai/v1/knowledgeset.go b/pkg/storage/apis/otto.gptscript.ai/v1/knowledgeset.go index 7fbe1f35..bc7ffc12 100644 --- a/pkg/storage/apis/otto.gptscript.ai/v1/knowledgeset.go +++ b/pkg/storage/apis/otto.gptscript.ai/v1/knowledgeset.go @@ -46,6 +46,7 @@ type KnowledgeSetStatus struct { ObservedIngestionGeneration int64 `json:"observedIngestionGeneration,omitempty"` SuggestedDataDescription string `json:"suggestedDataDescription,omitempty"` WorkspaceName string `json:"workspaceName,omitempty"` + IsEmpty bool `json:"isEmpty,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/storage/openapi/generated/openapi_generated.go b/pkg/storage/openapi/generated/openapi_generated.go index 9b059d64..613020bc 100644 --- a/pkg/storage/openapi/generated/openapi_generated.go +++ b/pkg/storage/openapi/generated/openapi_generated.go @@ -3949,6 +3949,12 @@ func schema_storage_apis_ottogptscriptai_v1_KnowledgeSetStatus(ref common.Refere Format: "", }, }, + "isEmpty": { + SchemaProps: spec.SchemaProps{ + Type: []string{"boolean"}, + Format: "", + }, + }, }, }, },