From b49a5f57e80b3b2f988e41c178582cb409dfc701 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Mon, 15 Dec 2025 15:08:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9EFAQ=E6=9D=A1=E7=9B=AE?= =?UTF-8?q?=E6=8E=A8=E8=8D=90=E5=AD=97=E6=AE=B5=E5=92=8C=E6=8C=89=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=89=B9=E9=87=8F=E6=9B=B4=E6=96=B0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/faq.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/faq.go b/client/faq.go index 232a5c877..eca2dffac 100644 --- a/client/faq.go +++ b/client/faq.go @@ -17,6 +17,7 @@ type FAQEntry struct { KnowledgeBaseID string `json:"knowledge_base_id"` TagID string `json:"tag_id"` IsEnabled bool `json:"is_enabled"` + IsRecommended bool `json:"is_recommended"` StandardQuestion string `json:"standard_question"` SimilarQuestions []string `json:"similar_questions"` NegativeQuestions []string `json:"negative_questions"` @@ -38,6 +39,7 @@ type FAQEntryPayload struct { TagID string `json:"tag_id,omitempty"` TagName string `json:"tag_name,omitempty"` IsEnabled *bool `json:"is_enabled,omitempty"` + IsRecommended *bool `json:"is_recommended,omitempty"` } // FAQBatchUpsertPayload represents the request body for batch import (append/replace). @@ -220,11 +222,14 @@ func (c *Client) UpdateFAQEntry(ctx context.Context, // UpdateFAQEntryFieldsBatch updates multiple fields for FAQ entries in bulk. // Supports updating is_enabled, is_recommended, tag_id in a single call. +// Supports two modes: +// - byID: update by entry ID, key is entry ID +// - byTag: update all entries under a tag, key is tag ID (empty string for uncategorized) func (c *Client) UpdateFAQEntryFieldsBatch(ctx context.Context, - knowledgeBaseID string, byID map[string]FAQEntryFieldsUpdate, + knowledgeBaseID string, byID map[string]FAQEntryFieldsUpdate, byTag map[string]FAQEntryFieldsUpdate, ) error { path := fmt.Sprintf("/api/v1/knowledge-bases/%s/faq/entries/fields", knowledgeBaseID) - resp, err := c.doRequest(ctx, http.MethodPut, path, &FAQEntryFieldsBatchRequest{ByID: byID}, nil) + resp, err := c.doRequest(ctx, http.MethodPut, path, &FAQEntryFieldsBatchRequest{ByID: byID, ByTag: byTag}, nil) if err != nil { return err }