From ee69e10408dfce94f5b74862095d6d05e3108fe3 Mon Sep 17 00:00:00 2001 From: 0xff-dev Date: Fri, 29 Mar 2024 14:28:27 +0800 Subject: [PATCH] fix: the application does not exist and does not affect other icon configurations --- apiserver/pkg/chat/chat_server.go | 5 ++++- apiserver/pkg/chat/storage/storage.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apiserver/pkg/chat/chat_server.go b/apiserver/pkg/chat/chat_server.go index 7a89b31a5..4fec672e6 100644 --- a/apiserver/pkg/chat/chat_server.go +++ b/apiserver/pkg/chat/chat_server.go @@ -432,7 +432,10 @@ func (cs *ChatServer) FillAppIconToConversations(ctx context.Context, conversati } err := cs.cli.Get(ctx, types.NamespacedName{Namespace: ns, Name: name}, app) if err != nil { - return err + // FIXME: Currently, there is a request for an application that cannot be found in a conversation in the database, + // causing other conversations to be unable to add icons, so an error is encountered here and no error is returned. + klog.Errorf("failed to get application %s in namespace %s, error %s", name, ns, err) + return nil } result[index] = app.Spec.Icon return nil diff --git a/apiserver/pkg/chat/storage/storage.go b/apiserver/pkg/chat/storage/storage.go index 40092b4df..d58362b39 100644 --- a/apiserver/pkg/chat/storage/storage.go +++ b/apiserver/pkg/chat/storage/storage.go @@ -42,7 +42,7 @@ type Conversation struct { Debug bool `gorm:"column:debug;type:bool;comment:debug mode" json:"-"` DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:time;comment:the time the conversation deleted at" json:"-"` // icon only valid in conversation list api - Icon string `gorm:"-" json:"icon,omitempty"` + Icon string `gorm:"-" json:"icon"` } // Message represent a message in storage