fix: Ensure safe access to tenant agent configuration in update handler
This commit is contained in:
@@ -355,7 +355,10 @@ func (h *TenantHandler) updateTenantAgentConfigInternal(c *gin.Context) {
|
|||||||
// Get existing tenant
|
// Get existing tenant
|
||||||
tenant := ctx.Value(types.TenantInfoContextKey).(*types.Tenant)
|
tenant := ctx.Value(types.TenantInfoContextKey).(*types.Tenant)
|
||||||
// Update agent configuration
|
// Update agent configuration
|
||||||
useCustomPrompt := tenant.AgentConfig.UseCustomSystemPrompt
|
useCustomPrompt := false
|
||||||
|
if tenant.AgentConfig != nil {
|
||||||
|
useCustomPrompt = tenant.AgentConfig.UseCustomSystemPrompt
|
||||||
|
}
|
||||||
if req.UseCustomPrompt != nil {
|
if req.UseCustomPrompt != nil {
|
||||||
useCustomPrompt = *req.UseCustomPrompt
|
useCustomPrompt = *req.UseCustomPrompt
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user