From 0e3060708c5dee1cad1c9b6599775314dc5f494f Mon Sep 17 00:00:00 2001 From: bjwswang Date: Fri, 2 Feb 2024 06:13:58 +0000 Subject: [PATCH] chore: add some logs in chat doc;increaset ingress timeout Signed-off-by: bjwswang --- apiserver/pkg/chat/chat_docs.go | 9 ++++++++- deploy/charts/arcadia/Chart.yaml | 2 +- deploy/charts/arcadia/templates/ingress-apiserver.yaml | 5 ++++- deploy/charts/arcadia/templates/ingress-fastchat.yaml | 7 ++++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/apiserver/pkg/chat/chat_docs.go b/apiserver/pkg/chat/chat_docs.go index 3444a69e5..d865e88fb 100644 --- a/apiserver/pkg/chat/chat_docs.go +++ b/apiserver/pkg/chat/chat_docs.go @@ -110,6 +110,7 @@ func (cs *ChatServer) ReceiveConversationDoc(ctx context.Context, messageID stri if err != nil { return nil, err } + message.Answer = resp.Summary message.Latency = int64(resp.TimecostForSummarization) message.Documents = append(message.Documents, storage.Document{ @@ -212,7 +213,10 @@ func (cs *ChatServer) SummarizeConversationDoc(ctx context.Context, req Conversa errStr += fmt.Sprintf(" ErrEmbedding: %s", errEmbedding.Error()) // break once error occurs ctx.Done() + return } + klog.V(1).ErrorS(errEmbedding, "ErrEmbedding", "document", doc.Filename, "conversation", "") + klog.V(5).Infof("Generate embeddings for doc %s is successful!") }() // For summary generation @@ -231,9 +235,12 @@ func (cs *ChatServer) SummarizeConversationDoc(ctx context.Context, req Conversa summary, errSummary = cs.GenerateSingleDocSummary(ctx, req, doc, documents, respStream) if errSummary != nil { // break once error occurs - errStr += fmt.Sprintf(" ErrSummary: %s", errEmbedding.Error()) + errStr += fmt.Sprintf(" ErrSummary: %s", errSummary.Error()) ctx.Done() + klog.V(1).ErrorS(errSummary, "ErrSummary", "document", doc.Filename, "conversation", "") + return } + klog.V(5).Infof("Generate summarization is done! Summary: %s", summary) }() // wait until all finished wg.Wait() diff --git a/deploy/charts/arcadia/Chart.yaml b/deploy/charts/arcadia/Chart.yaml index 284e281e8..e87ccaa5c 100644 --- a/deploy/charts/arcadia/Chart.yaml +++ b/deploy/charts/arcadia/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: arcadia description: A Helm chart(KubeBB Component) for KubeAGI Arcadia type: application -version: 0.2.28 +version: 0.2.29 appVersion: "0.1.0" keywords: diff --git a/deploy/charts/arcadia/templates/ingress-apiserver.yaml b/deploy/charts/arcadia/templates/ingress-apiserver.yaml index 402269894..b0fbb0846 100644 --- a/deploy/charts/arcadia/templates/ingress-apiserver.yaml +++ b/deploy/charts/arcadia/templates/ingress-apiserver.yaml @@ -17,7 +17,10 @@ metadata: nginx.ingress.kubernetes.io/load-balance: round_robin nginx.ingress.kubernetes.io/proxy-body-size: "" nginx.ingress.kubernetes.io/proxy-buffering: "on" - nginx.ingress.kubernetes.io/proxy-connect-timeout: "60" + nginx.ingress.kubernetes.io/proxy-connect-timeout: 600s + nginx.ingress.kubernetes.io/proxy-next-upstream-timeout: 600s + nginx.ingress.kubernetes.io/proxy-read-timeout: 600s + nginx.ingress.kubernetes.io/proxy-send-timeout: 600s nginx.ingress.kubernetes.io/server-alias: "" nginx.ingress.kubernetes.io/ssl-redirect: "true" nginx.ingress.kubernetes.io/upstream-vhost: $host diff --git a/deploy/charts/arcadia/templates/ingress-fastchat.yaml b/deploy/charts/arcadia/templates/ingress-fastchat.yaml index 79640e1e4..18cc76ae3 100644 --- a/deploy/charts/arcadia/templates/ingress-fastchat.yaml +++ b/deploy/charts/arcadia/templates/ingress-fastchat.yaml @@ -15,7 +15,12 @@ metadata: nginx.ingress.kubernetes.io/load-balance: round_robin nginx.ingress.kubernetes.io/proxy-body-size: "" nginx.ingress.kubernetes.io/proxy-buffering: "on" - nginx.ingress.kubernetes.io/proxy-connect-timeout: "60" + # It may take too long when call embedding/llm model,so we increase the proxy-connect-timeout to 600 seoncds + # WIth suggeststion https://stackoverflow.com/questions/24453388/nginx-reverse-proxy-causing-504-gateway-timeout + nginx.ingress.kubernetes.io/proxy-connect-timeout: 600s + nginx.ingress.kubernetes.io/proxy-next-upstream-timeout: 600s + nginx.ingress.kubernetes.io/proxy-read-timeout: 600s + nginx.ingress.kubernetes.io/proxy-send-timeout: 600s nginx.ingress.kubernetes.io/server-alias: "" nginx.ingress.kubernetes.io/ssl-redirect: "true" nginx.ingress.kubernetes.io/upstream-vhost: $host