feat: 新增FAQ条目获取接口,支持按ID查询单个FAQ条目;增强标签删除功能,支持content_only模式仅删除标签下内容
This commit is contained in:
@@ -209,6 +209,23 @@ func (c *Client) CreateFAQEntry(ctx context.Context,
|
||||
return response.Data, nil
|
||||
}
|
||||
|
||||
// GetFAQEntry retrieves a single FAQ entry by ID.
|
||||
func (c *Client) GetFAQEntry(ctx context.Context,
|
||||
knowledgeBaseID, entryID string,
|
||||
) (*FAQEntry, error) {
|
||||
path := fmt.Sprintf("/api/v1/knowledge-bases/%s/faq/entries/%s", knowledgeBaseID, entryID)
|
||||
resp, err := c.doRequest(ctx, http.MethodGet, path, nil, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var response FAQEntryResponse
|
||||
if err := parseResponse(resp, &response); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response.Data, nil
|
||||
}
|
||||
|
||||
// UpdateFAQEntry updates a single FAQ entry.
|
||||
func (c *Client) UpdateFAQEntry(ctx context.Context,
|
||||
knowledgeBaseID, entryID string, payload *FAQEntryPayload,
|
||||
|
||||
+7
-2
@@ -137,15 +137,20 @@ func (c *Client) UpdateTag(ctx context.Context,
|
||||
return response.Data, nil
|
||||
}
|
||||
|
||||
// DeleteTag deletes a tag. Set force to true to delete even if the tag is referenced.
|
||||
// DeleteTag deletes a tag.
|
||||
// Set force to true to delete even if the tag is referenced.
|
||||
// Set contentOnly to true to only delete the content under the tag but keep the tag itself.
|
||||
func (c *Client) DeleteTag(ctx context.Context,
|
||||
knowledgeBaseID, tagID string, force bool,
|
||||
knowledgeBaseID, tagID string, force bool, contentOnly bool,
|
||||
) error {
|
||||
path := fmt.Sprintf("/api/v1/knowledge-bases/%s/tags/%s", knowledgeBaseID, tagID)
|
||||
query := url.Values{}
|
||||
if force {
|
||||
query.Add("force", "true")
|
||||
}
|
||||
if contentOnly {
|
||||
query.Add("content_only", "true")
|
||||
}
|
||||
|
||||
resp, err := c.doRequest(ctx, http.MethodDelete, path, nil, query)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user