feat: 新增FAQ列表排序功能,支持按更新时间升序/降序排列;优化标签名称批量查询,提升查询效率

This commit is contained in:
wizardchen
2025-12-24 11:00:57 +08:00
parent 529b31da23
commit b2eec004c9
14 changed files with 88 additions and 9 deletions
+6 -1
View File
@@ -17,6 +17,7 @@ type FAQEntry struct {
KnowledgeID string `json:"knowledge_id"`
KnowledgeBaseID string `json:"knowledge_base_id"`
TagID string `json:"tag_id"`
TagName string `json:"tag_name"`
IsEnabled bool `json:"is_enabled"`
IsRecommended bool `json:"is_recommended"`
StandardQuestion string `json:"standard_question"`
@@ -139,8 +140,9 @@ type faqSimpleResponse struct {
}
// ListFAQEntries returns paginated FAQ entries under a knowledge base.
// sortOrder: "asc" for time ascending (updated_at ASC), default is time descending (updated_at DESC)
func (c *Client) ListFAQEntries(ctx context.Context,
knowledgeBaseID string, page, pageSize int, tagID string, keyword string,
knowledgeBaseID string, page, pageSize int, tagID string, keyword string, sortOrder string,
) (*FAQEntriesPage, error) {
path := fmt.Sprintf("/api/v1/knowledge-bases/%s/faq/entries", knowledgeBaseID)
query := url.Values{}
@@ -156,6 +158,9 @@ func (c *Client) ListFAQEntries(ctx context.Context,
if keyword != "" {
query.Add("keyword", keyword)
}
if sortOrder != "" {
query.Add("sort_order", sortOrder)
}
resp, err := c.doRequest(ctx, http.MethodGet, path, nil, query)
if err != nil {