From 121e9b3e1b31cd06cfa57535ffd605be740d32d7 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Tue, 16 Dec 2025 15:31:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A7=BB=E9=99=A4=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E7=9A=84FAQ=E6=9D=A1=E7=9B=AE=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/faq.go | 44 -------------------------------------------- 1 file changed, 44 deletions(-) diff --git a/client/faq.go b/client/faq.go index 4fe01464a..14c6f9ce1 100644 --- a/client/faq.go +++ b/client/faq.go @@ -172,28 +172,6 @@ func (c *Client) ListFAQEntries(ctx context.Context, return response.Data, nil } -// ExportFAQEntries exports all FAQ entries from a knowledge base as CSV data. -// The CSV format matches the import example format with 8 columns: -// 分类(必填), 问题(必填), 相似问题(选填-多个用##分隔), 反例问题(选填-多个用##分隔), -// 机器人回答(必填-多个用##分隔), 是否全部回复(选填-默认FALSE), 是否停用(选填-默认FALSE), -// 是否禁止被推荐(选填-默认False 可被推荐) -func (c *Client) ExportFAQEntries(ctx context.Context, knowledgeBaseID string) ([]byte, error) { - path := fmt.Sprintf("/api/v1/knowledge-bases/%s/faq/entries/export", knowledgeBaseID) - resp, err := c.doRequest(ctx, http.MethodGet, path, nil, nil) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - // Read the raw CSV data from response body - data, err := io.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("failed to read export response: %w", err) - } - - return data, nil -} - // UpsertFAQEntries imports or appends FAQ entries asynchronously and returns the task ID. func (c *Client) UpsertFAQEntries(ctx context.Context, knowledgeBaseID string, payload *FAQBatchUpsertPayload, @@ -231,28 +209,6 @@ func (c *Client) CreateFAQEntry(ctx context.Context, return response.Data, nil } -// ExportFAQEntries exports all FAQ entries from a knowledge base as CSV data. -// The CSV format matches the import example format with 8 columns: -// 分类(必填), 问题(必填), 相似问题(选填-多个用##分隔), 反例问题(选填-多个用##分隔), -// 机器人回答(必填-多个用##分隔), 是否全部回复(选填-默认FALSE), 是否停用(选填-默认FALSE), -// 是否禁止被推荐(选填-默认False 可被推荐) -func (c *Client) ExportFAQEntries(ctx context.Context, knowledgeBaseID string) ([]byte, error) { - path := fmt.Sprintf("/api/v1/knowledge-bases/%s/faq/entries/export", knowledgeBaseID) - resp, err := c.doRequest(ctx, http.MethodGet, path, nil, nil) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - // Read the raw CSV data from response body - data, err := io.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("failed to read export response: %w", err) - } - - return data, nil -} - // UpdateFAQEntry updates a single FAQ entry. func (c *Client) UpdateFAQEntry(ctx context.Context, knowledgeBaseID, entryID string, payload *FAQEntryPayload,