From 5f06ba2b9b44b6d1ce46c543f546526f09d4a8f7 Mon Sep 17 00:00:00 2001 From: Kunal Dawar Date: Fri, 20 Dec 2024 16:40:44 +0530 Subject: [PATCH] update marshell --- management/prompt.go | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/management/prompt.go b/management/prompt.go index 7a00aad8..4c1ecf52 100644 --- a/management/prompt.go +++ b/management/prompt.go @@ -454,28 +454,18 @@ type PromptRendering struct { // MarshalJSON implements a custom [json.Marshaler]. func (c *PromptRendering) MarshalJSON() ([]byte, error) { + copyPromptRendering := *c if c.RenderingMode != nil && *c.RenderingMode == RenderingModeStandard { - return json.Marshal(&PromptRendering{ - RenderingMode: c.RenderingMode, - ContextConfiguration: nil, - DefaultHeadTagsDisabled: nil, - HeadTags: nil, - Tenant: nil, - Prompt: nil, - Screen: nil, - }) + copyPromptRendering.ContextConfiguration = nil + copyPromptRendering.DefaultHeadTagsDisabled = nil + copyPromptRendering.HeadTags = nil } + copyPromptRendering.Tenant = nil + copyPromptRendering.Prompt = nil + copyPromptRendering.Screen = nil - return json.Marshal(&PromptRendering{ - RenderingMode: c.RenderingMode, - ContextConfiguration: c.ContextConfiguration, - DefaultHeadTagsDisabled: c.DefaultHeadTagsDisabled, - HeadTags: c.HeadTags, - Tenant: nil, - Prompt: nil, - Screen: nil, - }) + return json.Marshal(©PromptRendering) } // MarshalJSON implements a custom [json.Marshaler].