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

This commit is contained in:
wizardchen
2025-11-14 12:30:11 +08:00
parent 6988f3af4d
commit 527b2d46e9
+4 -1
View File
@@ -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
}