diff --git a/apiserver/service/chat.go b/apiserver/service/chat.go index 4047eef14..0d57ce7b7 100644 --- a/apiserver/service/chat.go +++ b/apiserver/service/chat.go @@ -274,13 +274,13 @@ func (cs *ChatService) ListConversationHandler() gin.HandlerFunc { req := chat.APPMetadata{} _ = c.ShouldBindJSON(&req) req.AppNamespace = NamespaceInHeader(c) - resp, err := cs.server.ListConversations(c, req) + resp, err := cs.server.ListConversations(c.Request.Context(), req) if err != nil { klog.FromContext(c.Request.Context()).Error(err, "error list conversation") c.JSON(http.StatusInternalServerError, chat.ErrorResp{Err: err.Error()}) return } - if err := cs.server.FillAppIconToConversations(c, &resp); err != nil { + if err := cs.server.FillAppIconToConversations(c.Request.Context(), &resp); err != nil { // note: fill app icon is try our best, don't need to return error klog.FromContext(c.Request.Context()).Error(err, "error fill app icon to conversations") } @@ -309,7 +309,7 @@ func (cs *ChatService) DeleteConversationHandler() gin.HandlerFunc { c.JSON(http.StatusBadRequest, chat.ErrorResp{Err: err.Error()}) return } - err := cs.server.DeleteConversation(c, conversationID) + err := cs.server.DeleteConversation(c.Request.Context(), conversationID) if err != nil { klog.FromContext(c.Request.Context()).Error(err, "error delete conversation") c.JSON(http.StatusInternalServerError, chat.ErrorResp{Err: err.Error()}) @@ -341,7 +341,7 @@ func (cs *ChatService) HistoryHandler() gin.HandlerFunc { return } req.AppNamespace = NamespaceInHeader(c) - resp, err := cs.server.ListMessages(c, req) + resp, err := cs.server.ListMessages(c.Request.Context(), req) if err != nil { klog.FromContext(c.Request.Context()).Error(err, "error list messages") c.JSON(http.StatusInternalServerError, chat.ErrorResp{Err: err.Error()}) @@ -383,7 +383,7 @@ func (cs *ChatService) ReferenceHandler() gin.HandlerFunc { c.JSON(http.StatusBadRequest, chat.ErrorResp{Err: err.Error()}) return } - resp, err := cs.server.GetMessageReferences(c, req) + resp, err := cs.server.GetMessageReferences(c.Request.Context(), req) if err != nil { klog.FromContext(c.Request.Context()).Error(err, "error get message references") c.JSON(http.StatusInternalServerError, chat.ErrorResp{Err: err.Error()}) diff --git a/apiserver/service/minio_server.go b/apiserver/service/minio_server.go index 70f4ef776..f3c9ca0a6 100644 --- a/apiserver/service/minio_server.go +++ b/apiserver/service/minio_server.go @@ -834,7 +834,7 @@ func (m *minioAPI) CreateWebCrawlerFile(ctx *gin.Context) { namespace := NamespaceInHeader(ctx) // read versioneddataset - vds, err := versioneddataset.GetVersionedDataset(ctx, m.client, body.VersionedDataset, namespace) + vds, err := versioneddataset.GetVersionedDataset(ctx.Request.Context(), m.client, body.VersionedDataset, namespace) if err != nil { klog.Errorf("failed to get versioneddataset error %s", err) ctx.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{ @@ -843,7 +843,7 @@ func (m *minioAPI) CreateWebCrawlerFile(ctx *gin.Context) { return } // read datasource - ds, err := apiserverds.ReadDatasource(ctx, m.client, body.Datasource, namespace) + ds, err := apiserverds.ReadDatasource(ctx.Request.Context(), m.client, body.Datasource, namespace) if err != nil { klog.Errorf("failed to get datasource error %s", err) ctx.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{ @@ -882,7 +882,7 @@ func (m *minioAPI) CreateWebCrawlerFile(ctx *gin.Context) { } object := fmt.Sprintf("dataset/%s/%s/%s-%s.web", vds.Dataset.Name, vds.Version, ds.Namespace, ds.Name) - _, err = source.Client.PutObject(ctx, namespace, object, bytes.NewReader(content), int64(len(content)), minio.PutObjectOptions{}) + _, err = source.Client.PutObject(ctx.Request.Context(), namespace, object, bytes.NewReader(content), int64(len(content)), minio.PutObjectOptions{}) if err != nil { klog.Errorf("failed to put webcrawler file error %s", err) ctx.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{ diff --git a/apiserver/service/rag_server.go b/apiserver/service/rag_server.go index 397ccc104..24a4822ce 100644 --- a/apiserver/service/rag_server.go +++ b/apiserver/service/rag_server.go @@ -59,7 +59,7 @@ func (r *RagAPI) Summary(ctx *gin.Context) { namespace := NamespaceInHeader(ctx) rr := v1alpha1.RAG{} - if err := r.c.Get(ctx, types.NamespacedName{ + if err := r.c.Get(ctx.Request.Context(), types.NamespacedName{ Namespace: namespace, Name: ragName, }, &rr); err != nil { klog.Error(fmt.Sprintf("can't get rag by name %s", ragName)) @@ -109,7 +109,7 @@ func (r *RagAPI) ReportDetail(ctx *gin.Context) { namespace := NamespaceInHeader(ctx) rr := v1alpha1.RAG{} - if err := r.c.Get(ctx, types.NamespacedName{ + if err := r.c.Get(ctx.Request.Context(), types.NamespacedName{ Namespace: namespace, Name: ragName, }, &rr); err != nil { klog.Error(fmt.Sprintf("can't get rag by name %s", ragName)) @@ -145,7 +145,7 @@ func (r *RagAPI) ReportScatter(ctx *gin.Context) { namespace := NamespaceInHeader(ctx) rr := v1alpha1.RAG{} - if err := r.c.Get(ctx, types.NamespacedName{ + if err := r.c.Get(ctx.Request.Context(), types.NamespacedName{ Namespace: namespace, Name: ragName, }, &rr); err != nil { klog.Error(fmt.Sprintf("can't get rag by name %s", ragName))