feat: Enhance suggested questions functionality with wiki integration
- Updated the SuggestedQuestion interface to include 'wiki' as a new source type, allowing for more diverse question origins. - Implemented ListRecentForSuggestions method in the wikiPageRepository to retrieve recent wiki pages for fallback suggestions, improving the agent's ability to generate relevant questions when other sources are unavailable. - Enhanced the customAgentService to utilize the new wiki page suggestions, ensuring a broader range of questions can be generated from wiki content. These changes significantly improve the agent's suggestion capabilities by incorporating wiki content, enhancing user interaction and information retrieval.
This commit is contained in:
@@ -290,9 +290,9 @@ func (a *CustomAgent) IsAgentMode() bool {
|
||||
type SuggestedQuestion struct {
|
||||
// 问题文本
|
||||
Question string `json:"question"`
|
||||
// 来源类型: "faq", "document", "agent_config"
|
||||
// 来源类型: "agent_config", "faq", "document", "wiki"
|
||||
Source string `json:"source"`
|
||||
// 来源知识库ID(仅 faq/document 来源时有值)
|
||||
// 来源知识库ID(仅 faq/document/wiki 来源时有值)
|
||||
KnowledgeBaseID string `json:"knowledge_base_id,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -111,6 +111,13 @@ type WikiPageRepository interface {
|
||||
// ListAll retrieves all wiki pages in a knowledge base (for link rebuilding, graph generation).
|
||||
ListAll(ctx context.Context, kbID string) ([]*types.WikiPage, error)
|
||||
|
||||
// ListRecentForSuggestions returns recent user-visible wiki pages under the given
|
||||
// knowledge bases, used to produce fallback suggested questions for Wiki-only KBs
|
||||
// that do not have AI-generated document questions or recommended FAQ entries.
|
||||
// Excludes index/log pages and archived pages. Returns up to `limit` rows sorted
|
||||
// by updated_at descending.
|
||||
ListRecentForSuggestions(ctx context.Context, tenantID uint64, kbIDs []string, limit int) ([]*types.WikiPage, error)
|
||||
|
||||
// Delete soft-deletes a wiki page by knowledge base ID and slug.
|
||||
Delete(ctx context.Context, kbID string, slug string) error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user