Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix: Ensure safe access to tenant agent configuration in update handler

wizardchen527b2d46e95a
diff --git a/internal/handler/tenant.go b/internal/handler/tenant.go
index 2d0dccdc5..736525e92 100644
--- a/internal/handler/tenant.go
+++ b/internal/handler/tenant.go
@@ -355,7 +355,10 @@ func (h *TenantHandler) updateTenantAgentConfigInternal(c *gin.Context) {
// Get existing tenant
tenant := ctx.Value(types.TenantInfoContextKey).(*types.Tenant)
// Update agent configuration
- useCustomPrompt := tenant.AgentConfig.UseCustomSystemPrompt
+ useCustomPrompt := false
+ if tenant.AgentConfig != nil {
+ useCustomPrompt = tenant.AgentConfig.UseCustomSystemPrompt
+ }
if req.UseCustomPrompt != nil {
useCustomPrompt = *req.UseCustomPrompt
}