Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
feat: 增强 KnowledgeQAStream Client参数
wizardchend6a1647be396
diff --git a/client/README.md b/client/README.mdindex 2509aaf65..1426d98e7 100644--- a/client/README.md+++ b/client/README.md@@ -105,7 +105,11 @@ if err != nil {}// 流式问答-err = apiClient.KnowledgeQAStream(context.Background(), session.ID, "什么是机器学习?", func(response *client.StreamResponse) error {+err = apiClient.KnowledgeQAStream(context.Background(), session.ID, &client.KnowledgeQARequest{+ Query: "什么是机器学习?",+ KnowledgeBaseIDs: []string{knowledgeBaseID}, // 可选:指定知识库+ WebSearchEnabled: false, // 可选:是否启用网络搜索+}, func(response *client.StreamResponse) error {// 处理每个响应片段fmt.Print(response.Content)return nildiff --git a/client/example.go b/client/example.goindex 67a6f5de8..5b98bdf04 100644--- a/client/example.go+++ b/client/example.go@@ -150,7 +150,7 @@ func ExampleUsage() {err = apiClient.KnowledgeQAStream(context.Background(),session.ID,- question,+ &KnowledgeQARequest{Query: question},func(response *StreamResponse) error {if response.ResponseType == ResponseTypeAnswer {answer.WriteString(response.Content)@@ -181,7 +181,7 @@ func ExampleUsage() {err = apiClient.KnowledgeQAStream(context.Background(),session.ID,- streamQuestion,+ &KnowledgeQARequest{Query: streamQuestion},func(response *StreamResponse) error {fmt.Print(response.Content)return nildiff --git a/client/session.go b/client/session.goindex ff6ad437d..65b6a185b 100644--- a/client/session.go+++ b/client/session.go@@ -227,7 +227,13 @@ func (c *Client) GenerateTitle(ctx context.Context, sessionID string, request *G// KnowledgeQARequest knowledge Q&A requesttype KnowledgeQARequest struct {- Query string `json:"query"`+ Query string `json:"query"` // Query text for knowledge base search+ KnowledgeBaseIDs []string `json:"knowledge_base_ids"` // Selected knowledge base IDs for this request+ KnowledgeIDs []string `json:"knowledge_ids"` // Selected knowledge IDs for this request+ AgentEnabled bool `json:"agent_enabled"` // Whether agent mode is enabled for this request+ AgentID string `json:"agent_id"` // Selected custom agent ID for this request+ WebSearchEnabled bool `json:"web_search_enabled"` // Whether web search is enabled for this request+ SummaryModelID string `json:"summary_model_id"` // Optional summary model ID (overrides session default)}type ResponseType string@@ -250,15 +256,11 @@ type StreamResponse struct {func (c *Client) KnowledgeQAStream(ctx context.Context,sessionID string,- query string,+ request *KnowledgeQARequest,callback func(*StreamResponse) error,) error {path := fmt.Sprintf("/api/v1/knowledge-chat/%s", sessionID)- fmt.Printf("Starting KnowledgeQAStream request, session ID: %s, query: %s\n", sessionID, query)-- request := &KnowledgeQARequest{- Query: query,- }+ fmt.Printf("Starting KnowledgeQAStream request, session ID: %s, query: %s\n", sessionID, request.Query)resp, err := c.doRequest(ctx, http.MethodPost, path, request, nil)if err != nil {