diff --git a/client/knowledge.go b/client/knowledge.go index fc98987c..a551818f 100644 --- a/client/knowledge.go +++ b/client/knowledge.go @@ -858,9 +858,15 @@ type UpdateManualKnowledgeRequest struct { Content string `json:"content,omitempty"` } -// BatchUpdateKnowledgeTagsRequest contains the mapping of knowledge IDs to tag IDs. +// BatchUpdateKnowledgeTagsRequest sets tags on documents. +// Send Updates, or KnowledgeIDs together with TagIDs. An empty TagIDs clears +// the tags; omitting it while KnowledgeIDs is set is rejected. type BatchUpdateKnowledgeTagsRequest struct { - Updates map[string]*string `json:"updates"` // knowledge_id -> tag_id (nil to clear) + Updates map[string]*string `json:"updates,omitempty"` // knowledge_id -> tag_id (nil to clear) + KBID string `json:"kb_id,omitempty"` + KnowledgeIDs []string `json:"knowledge_ids,omitempty"` + // Keep an explicit empty array on the wire; nil remains null and is rejected in the list form. + TagIDs []string `json:"tag_ids"` } // CreateManualKnowledge creates a knowledge entry from manual Markdown content. diff --git a/client/knowledge_tags_test.go b/client/knowledge_tags_test.go new file mode 100644 index 00000000..9a1eddb6 --- /dev/null +++ b/client/knowledge_tags_test.go @@ -0,0 +1,31 @@ +package client + +import ( + "encoding/json" + "reflect" + "testing" +) + +func TestBatchKnowledgeTagsPreservesEmptyList(t *testing.T) { + for _, tags := range [][]string{nil, {}, {"tag-1"}} { + request := BatchUpdateKnowledgeTagsRequest{KnowledgeIDs: []string{"k-1"}, TagIDs: tags} + body, err := json.Marshal(request) + if err != nil { + t.Fatal(err) + } + // Decode as the server does: nil is rejected, [] deliberately clears tags. + var received struct { + KnowledgeIDs []string `json:"knowledge_ids"` + TagIDs []string `json:"tag_ids"` + } + if err := json.Unmarshal(body, &received); err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(tags, received.TagIDs) { + t.Errorf("tags = %#v, want %#v; body = %s", received.TagIDs, tags, body) + } + if !reflect.DeepEqual(request.KnowledgeIDs, received.KnowledgeIDs) { + t.Errorf("knowledge IDs = %#v, want %#v", received.KnowledgeIDs, request.KnowledgeIDs) + } + } +} diff --git a/client/knowledgebase.go b/client/knowledgebase.go index be63e228..d2b23aef 100644 --- a/client/knowledgebase.go +++ b/client/knowledgebase.go @@ -56,6 +56,14 @@ type ChunkingConfig struct { Separators []string `json:"separators"` // Separators } +// IndexingStrategy selects which indexing pipelines are active. +type IndexingStrategy struct { + VectorEnabled bool `json:"vector_enabled"` + KeywordEnabled bool `json:"keyword_enabled"` + WikiEnabled bool `json:"wiki_enabled"` + GraphEnabled bool `json:"graph_enabled"` +} + // FAQConfig represents faq-specific configuration type FAQConfig struct { IndexMode string `json:"index_mode"` @@ -356,6 +364,90 @@ func (c *Client) UpdateKnowledgeBase(ctx context.Context, return &response.Data, nil } +// PatchKnowledgeBaseRequest changes only the fields it carries. +// A nil field is left unchanged. Nested objects use pointers so a false or +// zero value can be sent without the other fields being cleared. +type PatchKnowledgeBaseRequest struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + EmbeddingModelID *string `json:"embedding_model_id,omitempty"` + SummaryModelID *string `json:"summary_model_id,omitempty"` + StorageBackendID *string `json:"storage_backend_id,omitempty"` + ChunkingConfig *PatchChunkingConfig `json:"chunking_config,omitempty"` + IndexingStrategy *PatchIndexingStrategy `json:"indexing_strategy,omitempty"` + VLMConfig *PatchVLMConfig `json:"vlm_config,omitempty"` + ASRConfig *PatchASRConfig `json:"asr_config,omitempty"` + FAQConfig *PatchFAQConfig `json:"faq_config,omitempty"` + AutoTagConfig *PatchAutoTagConfig `json:"auto_tag_config,omitempty"` + ImageProcessing *PatchImageProcessingConfig `json:"image_processing_config,omitempty"` +} + +// PatchChunkingConfig is the partial chunking update. Nil fields stay as they are. +type PatchChunkingConfig struct { + ChunkSize *int `json:"chunk_size,omitempty"` + ChunkOverlap *int `json:"chunk_overlap,omitempty"` + Separators *[]string `json:"separators,omitempty"` +} + +// PatchIndexingStrategy is the partial indexing update. Nil flags stay as they are. +type PatchIndexingStrategy struct { + VectorEnabled *bool `json:"vector_enabled,omitempty"` + KeywordEnabled *bool `json:"keyword_enabled,omitempty"` + WikiEnabled *bool `json:"wiki_enabled,omitempty"` + GraphEnabled *bool `json:"graph_enabled,omitempty"` +} + +// PatchVLMConfig is the partial caption-model update. +type PatchVLMConfig struct { + Enabled *bool `json:"enabled,omitempty"` + ModelID *string `json:"model_id,omitempty"` +} + +// PatchASRConfig changes only the speech-recognition fields provided. +type PatchASRConfig struct { + Enabled *bool `json:"enabled,omitempty"` + ModelID *string `json:"model_id,omitempty"` + Language *string `json:"language,omitempty"` +} + +// PatchFAQConfig changes only the FAQ indexing fields provided. +type PatchFAQConfig struct { + IndexMode *string `json:"index_mode,omitempty"` + QuestionIndexMode *string `json:"question_index_mode,omitempty"` +} + +// PatchAutoTagConfig changes only the automatic tagging fields provided. +type PatchAutoTagConfig struct { + Enabled *bool `json:"enabled,omitempty"` + ModelID *string `json:"model_id,omitempty"` + MaxTags *int `json:"max_tags,omitempty"` + SkipIfTagged *bool `json:"skip_if_tagged,omitempty"` +} + +// PatchImageProcessingConfig changes only the image settings provided. +type PatchImageProcessingConfig struct { + ModelID *string `json:"model_id,omitempty"` +} + +// PatchKnowledgeBase changes the supplied settings and preserves omitted fields. +func (c *Client) PatchKnowledgeBase(ctx context.Context, + knowledgeBaseID string, + request *PatchKnowledgeBaseRequest, +) (*KnowledgeBase, error) { + path := fmt.Sprintf("/api/v1/knowledge-bases/%s", knowledgeBaseID) + resp, err := c.doRequest(ctx, http.MethodPatch, path, request, nil) + if err != nil { + return nil, err + } + + var response KnowledgeBaseResponse + if err := parseResponse(resp, &response); err != nil { + return nil, err + } + + return &response.Data, nil +} + // DeleteKnowledgeBase deletes a knowledge base func (c *Client) DeleteKnowledgeBase(ctx context.Context, knowledgeBaseID string) error { path := fmt.Sprintf("/api/v1/knowledge-bases/%s", knowledgeBaseID) diff --git a/client/knowledgebase_patch_test.go b/client/knowledgebase_patch_test.go new file mode 100644 index 00000000..8c3f1513 --- /dev/null +++ b/client/knowledgebase_patch_test.go @@ -0,0 +1,67 @@ +package client + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "reflect" + "testing" +) + +func TestPatchKnowledgeBasePreservesFieldPresence(t *testing.T) { + for _, body := range []string{ + `{}`, + `{"asr_config":{"language":"en"}}`, + `{"asr_config":{"enabled":false}}`, + `{"asr_config":{"model_id":""}}`, + `{"asr_config":{"language":""}}`, + `{"faq_config":{"question_index_mode":"separate"}}`, + `{"faq_config":{"index_mode":"question_only"}}`, + `{"auto_tag_config":{"max_tags":5}}`, + `{"auto_tag_config":{"enabled":false,"skip_if_tagged":false}}`, + `{"auto_tag_config":{"model_id":"","max_tags":0}}`, + `{"image_processing_config":{}}`, + `{"image_processing_config":{"model_id":""}}`, + `{"chunking_config":{"chunk_overlap":0,"separators":[]}}`, + `{"indexing_strategy":{"vector_enabled":false}}`, + `{"vlm_config":{"enabled":false}}`, + } { + t.Run(body, func(t *testing.T) { + var request PatchKnowledgeBaseRequest + if err := json.Unmarshal([]byte(body), &request); err != nil { + t.Fatal(err) + } + var want map[string]any + if err := json.Unmarshal([]byte(body), &want); err != nil { + t.Fatal(err) + } + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPatch || r.URL.Path != "/api/v1/knowledge-bases/kb-1" { + t.Errorf("unexpected request: %s %s", r.Method, r.URL.Path) + } + var got map[string]any + if err := json.NewDecoder(r.Body).Decode(&got); err != nil { + t.Error(err) + } + if !reflect.DeepEqual(want, got) { + t.Errorf("request changed field presence: got %#v, want %#v", got, want) + } + w.Header().Set("Content-Type", "application/json") + if err := json.NewEncoder(w).Encode(map[string]any{ + "success": true, "data": map[string]any{"id": "kb-1"}, + }); err != nil { + t.Error(err) + } + })) + defer srv.Close() + kb, err := NewClient(srv.URL).PatchKnowledgeBase(context.Background(), "kb-1", &request) + if err != nil { + t.Fatal(err) + } + if kb.ID != "kb-1" { + t.Errorf("unexpected knowledge base: %#v", kb) + } + }) + } +} diff --git a/config/prompt_templates/agent_system_prompt.yaml b/config/prompt_templates/agent_system_prompt.yaml index 5d564b48..229fda50 100644 --- a/config/prompt_templates/agent_system_prompt.yaml +++ b/config/prompt_templates/agent_system_prompt.yaml @@ -162,6 +162,11 @@ templates: - List skills with skill.list using the agent's sandbox_config_id (host when it has none) and use their names exactly. If none are listed or the agent is not in smart-reasoning mode, explain what the user needs to change in the agent editor instead of guessing. - Built-in agents are shared by the whole workspace; before changing one, confirm with ask_user that the user means to change it for everyone. - Model endpoints and keys, MCP connection settings and credentials, and sharing or publishing an agent are outside what you can do. Tell the user where in WeKnora to do it. + Looking after knowledge bases: + - Create one with knowledge_base.create. Omit type for a document knowledge base. Omit the indexing flags for vector and keyword search. Model ids come from model.list. vector_store_id can be chosen only at creation. + - knowledge_base.update changes the settings you send. A field left out is kept, including one indexing flag or one chunk size. embedding_model_id cannot change after the knowledge base has documents. vector_store_id cannot be changed. Graph node and relation types stay in the knowledge base editor. + - Tags belong to a knowledge base. Create or rename them there, then set them on documents with knowledge.set_tags. Deleting a tag fails while documents still use it; take it off those documents first. Do not delete documents to remove a tag. + - knowledge.update_manual replaces the whole Markdown of a document that was created as manual knowledge. Send the complete text. Uploaded files are not edited this way. Questions about WeKnora itself: - For how a feature works, how to configure or deploy it, environment variables, the API or what changed in a release, search the documentation with search_weknora_docs and read the relevant section with read_weknora_doc before answering. It is the documentation of the version the user is running. - The documentation explains how WeKnora works; operations show how this workspace actually is. When the two seem to disagree, trust the operation result and say so. diff --git a/docs/docs.go b/docs/docs.go index a07d99f8..fa23d045 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -4401,7 +4401,13 @@ const docTemplate = `{ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } - } + }, + "x-agent": { + "id": "knowledge_base.create", + "label_param": "name", + "risk": "write" + }, + "x-agent-hint": "Creates a knowledge base owned by the user. Omit type for document. Omit indexing flags for vector and keyword search. Set embedding_model_id and summary_model_id from model.list. vector_store_id can be chosen only now. A field you leave out keeps its default." } }, "/knowledge-bases/copy": { @@ -4721,6 +4727,7 @@ const docTemplate = `{ "parameters": [ { "type": "string", + "x-agent": "knowledge_base_id", "description": "知识库ID", "name": "id", "in": "path", @@ -4752,7 +4759,99 @@ const docTemplate = `{ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } - } + }, + "x-agent": { + "id": "knowledge_base.delete", + "label": "name", + "risk": "destructive", + "target": "knowledge_base.get" + }, + "x-agent-hint": "Deletes the knowledge base and every document in it. Cannot be undone. Only the owner can delete it." + }, + "patch": { + "security": [ + { + "Bearer": [] + }, + { + "ApiKeyAuth": [] + } + ], + "description": "修改请求里出现的设置。未出现的字段保持不变,包括分块、索引和模型里没写到的项。", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "知识库" + ], + "summary": "部分更新知识库", + "parameters": [ + { + "type": "string", + "x-agent": "knowledge_base_id", + "description": "知识库ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "要修改的字段", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.PatchKnowledgeBaseRequest" + } + } + ], + "responses": { + "200": { + "description": "更新后的知识库", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/internal_handler.DataResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/internal_handler.KnowledgeBaseView" + } + } + } + ] + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + }, + "403": { + "description": "无权限", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + }, + "404": { + "description": "知识库不存在", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + } + }, + "x-agent": { + "id": "knowledge_base.update", + "label": "name", + "risk": "write", + "target": "knowledge_base.get" + }, + "x-agent-hint": "Changes the settings you send; a field left out is kept, including one indexing flag or one chunking field. Model ids come from model.list. embedding_model_id cannot change after documents exist. vector_store_id cannot be changed. Graph node types stay in the knowledge base editor." } }, "/knowledge-bases/{id}/activity": { @@ -6775,7 +6874,7 @@ const docTemplate = `{ "risk": "write", "target": "knowledge_base.get" }, - "x-agent-hint": "Creates a Markdown document. status=draft (the default) keeps it out of search; publish indexes it." + "x-agent-hint": "Creates a Markdown document. Send the full content, and status draft to keep it out of search or publish to index it." } }, "/knowledge-bases/{id}/knowledge/url": { @@ -7397,6 +7496,7 @@ const docTemplate = `{ "parameters": [ { "type": "string", + "x-agent": "knowledge_base_id", "description": "知识库ID", "name": "id", "in": "path", @@ -7408,18 +7508,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "type": "object", - "properties": { - "color": { - "type": "string" - }, - "name": { - "type": "string" - }, - "sort_order": { - "type": "integer" - } - } + "$ref": "#/definitions/internal_handler.CreateTagRequest" } } ], @@ -7448,7 +7537,14 @@ const docTemplate = `{ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } - } + }, + "x-agent": { + "id": "knowledge_base.create_tag", + "label": "name", + "risk": "write", + "target": "knowledge_base.get" + }, + "x-agent-hint": "Creates a tag in the knowledge base. Pass the returned tag id to knowledge.set_tags." } }, "/knowledge-bases/{id}/tags/{tag_id}": { @@ -7475,6 +7571,7 @@ const docTemplate = `{ "parameters": [ { "type": "string", + "x-agent": "knowledge_base_id", "description": "知识库ID", "name": "id", "in": "path", @@ -7482,6 +7579,7 @@ const docTemplate = `{ }, { "type": "string", + "x-agent": "tag_id", "description": "标签ID (UUID或seq_id)", "name": "tag_id", "in": "path", @@ -7493,7 +7591,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "type": "object" + "$ref": "#/definitions/internal_handler.UpdateTagRequest" } } ], @@ -7522,7 +7620,14 @@ const docTemplate = `{ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } - } + }, + "x-agent": { + "id": "knowledge_base.update_tag", + "label": "name", + "risk": "write", + "target": "knowledge_base.get" + }, + "x-agent-hint": "Renames a tag. tag_id comes from knowledge_base.list_tags. A field left out is kept." }, "delete": { "security": [ @@ -7547,6 +7652,7 @@ const docTemplate = `{ "parameters": [ { "type": "string", + "x-agent": "knowledge_base_id", "description": "知识库ID", "name": "id", "in": "path", @@ -7554,6 +7660,7 @@ const docTemplate = `{ }, { "type": "string", + "x-agent": "tag_id", "description": "标签ID (UUID或seq_id)", "name": "tag_id", "in": "path", @@ -7593,7 +7700,14 @@ const docTemplate = `{ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } - } + }, + "x-agent": { + "id": "knowledge_base.delete_tag", + "label": "name", + "risk": "destructive", + "target": "knowledge_base.get" + }, + "x-agent-hint": "Deletes a tag that no document uses. If documents still use it, this fails; take the tag off them with knowledge.set_tags first. Documents are not deleted." } }, "/knowledge-chat/{session_id}": { @@ -8091,6 +8205,7 @@ const docTemplate = `{ "parameters": [ { "type": "string", + "x-agent": "knowledge_id", "description": "知识ID", "name": "id", "in": "path", @@ -8131,7 +8246,14 @@ const docTemplate = `{ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } - } + }, + "x-agent": { + "id": "knowledge.update_manual", + "label": "title", + "risk": "write", + "target": "knowledge.get" + }, + "x-agent-hint": "Replaces the whole Markdown of a document created as manual knowledge. Send the complete content, not a diff. status draft keeps it out of search; publish indexes it. Uploaded files cannot be edited this way." } }, "/knowledge/move": { @@ -8355,7 +8477,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "批量更新知识条目的标签。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的空间解析", + "description": "批量更新知识条目的标签。传 updates,或传 knowledge_ids 与 tag_ids。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的空间解析", "consumes": [ "application/json" ], @@ -8368,12 +8490,12 @@ const docTemplate = `{ "summary": "批量更新知识标签", "parameters": [ { - "description": "标签更新请求(updates 必填,kb_id 可选)", + "description": "标签更新请求", "name": "request", "in": "body", "required": true, "schema": { - "type": "object" + "$ref": "#/definitions/internal_handler.KnowledgeTagBatchRequest" } } ], @@ -8390,7 +8512,20 @@ const docTemplate = `{ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } - } + }, + "x-agent": { + "id": "knowledge.set_tags", + "items": { + "as": "knowledge_id", + "label": "title", + "param": "knowledge_ids", + "target": "knowledge.get" + }, + "label": "name", + "risk": "write", + "target": "knowledge_base.get" + }, + "x-agent-hint": "Sets the same tags on up to 20 documents in one knowledge base, replacing the tags they have now. tag_ids come from knowledge_base.list_tags; an empty tag_ids clears every tag. It does not delete documents." } }, "/knowledge/{id}": { @@ -22890,14 +23025,19 @@ const docTemplate = `{ "type": "object", "properties": { "enabled": { - "type": "boolean" + "description": "Enabled turns speech transcription on. Also send asr_model_id.", + "type": "boolean", + "x-agent": "asr_enabled" }, "language": { - "description": "optional: language hint for transcription", - "type": "string" + "description": "Language is an optional hint for transcription, such as zh or en.", + "type": "string", + "x-agent": "asr_language" }, "model_id": { - "type": "string" + "description": "Model that transcribes audio. model.list returns the ids.", + "type": "string", + "x-agent": "asr_model_id" } } }, @@ -23399,17 +23539,26 @@ const docTemplate = `{ "type": "object", "properties": { "enabled": { - "type": "boolean" + "description": "Enabled turns automatic tagging on. The model picks from tags that already exist.", + "type": "boolean", + "x-agent": "auto_tag_enabled" }, "max_tags": { - "type": "integer" + "description": "MaxTags is how many tags one document may receive, from 1 to 10.", + "type": "integer", + "maximum": 10, + "minimum": 1, + "x-agent": "auto_tag_max_tags" }, "model_id": { - "type": "string" + "description": "ModelID overrides the summary model. Empty uses summary_model_id.", + "type": "string", + "x-agent": "auto_tag_model_id" }, "skip_if_tagged": { - "description": "SkipIfTagged leaves documents that already carry tags untouched, so a\ndeliberate manual classification is not diluted by model guesses. It is\na pointer because the default is true: rows written before this field\nexisted decode to nil and must not silently flip to \"always append\".", - "type": "boolean" + "description": "SkipIfTagged leaves a document alone when it already has tags. Empty means yes.", + "type": "boolean", + "x-agent": "auto_tag_skip_if_tagged" } } }, @@ -23790,30 +23939,45 @@ const docTemplate = `{ "properties": { "child_chunk_size": { "description": "ChildChunkSize is the size of child chunks used for embedding (default: 384).\nOnly used when EnableParentChild is true.", - "type": "integer" + "type": "integer", + "maximum": 10000, + "minimum": 1, + "x-agent": true }, "chunk_overlap": { - "description": "Chunk overlap", - "type": "integer" + "description": "Chunk overlap in characters.", + "type": "integer", + "maximum": 5000, + "minimum": 0, + "x-agent": true }, "chunk_size": { - "description": "Chunk size", - "type": "integer" + "description": "Chunk size in characters. Empty on create uses the server default.", + "type": "integer", + "maximum": 10000, + "minimum": 100, + "x-agent": true }, "enable_parent_child": { - "description": "EnableParentChild enables two-level parent-child chunking strategy.\nWhen enabled, large parent chunks provide context while small child chunks\nare used for vector matching. Retrieval matches on child but returns parent content.", - "type": "boolean" + "description": "EnableParentChild splits into large parent chunks and small child chunks. Search matches a child and returns its parent.", + "type": "boolean", + "x-agent": true }, "languages": { - "description": "Languages hints the heuristic patterns. Empty = auto-detect from content.\nExamples: [\"de\"], [\"en\", \"zh\"].", + "description": "Languages hints the splitter, for example de or zh. Empty detects the language from the document.", "type": "array", "items": { "type": "string" - } + }, + "x-agent": true, + "x-agent-maximum": "20" }, "parent_chunk_size": { "description": "ParentChunkSize is the size of parent chunks (default: 4096).\nOnly used when EnableParentChild is true.", - "type": "integer" + "type": "integer", + "maximum": 20000, + "minimum": 1, + "x-agent": true }, "parser_engine_rules": { "description": "ParserEngineRules configures which parser engine to use for each file type.\nWhen empty, DefaultParserEngine is used (builtin/simple routing, except\ntypes that only a specific engine can parse: ppt/pptx fall back to\nmarkitdown). A linked anydoc binding is preferred for every type it\nconverts.", @@ -23823,23 +23987,39 @@ const docTemplate = `{ } }, "separators": { - "description": "Separators", + "description": "Separators, in the order they are tried.", "type": "array", "items": { "type": "string" - } + }, + "x-agent": true, + "x-agent-maximum": "20" }, "strategy": { - "description": "Strategy selects the adaptive chunking tier. Empty / \"legacy\" preserves\nthe historical recursive splitter; \"auto\" lets a profiler pick between\nheading-aware, heuristic and recursive tiers; \"heading\" / \"heuristic\" /\n\"recursive\" pin the tier explicitly.", - "type": "string" + "description": "Strategy selects how documents are split: auto, heading, heuristic, recursive or legacy. Empty keeps the server default.", + "type": "string", + "enum": [ + "auto", + "heading", + "heuristic", + "recursive", + "legacy" + ], + "x-agent": true }, "table_metadata_instructions": { - "description": "TableMetadataInstructions contains optional business guidance used when\ngenerating searchable summaries for CSV/Excel tables. The system-owned\noutput contract remains fixed; these instructions only add domain context.", - "type": "string" + "description": "TableMetadataInstructions is extra guidance for CSV and Excel summaries. The output format stays fixed.", + "type": "string", + "x-agent": true, + "x-agent-detail": true, + "x-agent-max-bytes": "4000" }, "token_limit": { - "description": "TokenLimit caps chunk size in approximate tokens. 0 = use ChunkSize\nas a character count.", - "type": "integer" + "description": "TokenLimit caps chunk size in approximate tokens. 0 uses ChunkSize as a character count.", + "type": "integer", + "maximum": 100000, + "minimum": 0, + "x-agent": true } } }, @@ -24732,11 +24912,16 @@ const docTemplate = `{ "type": "object", "properties": { "custom_instructions": { - "description": "CustomInstructions adds domain-specific extraction guidance while the\nsystem keeps ownership of the structured graph output protocol.", - "type": "string" + "description": "CustomInstructions adds domain guidance. The graph output format stays fixed.", + "type": "string", + "x-agent": "extract_instructions", + "x-agent-detail": true, + "x-agent-max-bytes": "4000" }, "enabled": { - "type": "boolean" + "description": "Enabled turns graph extraction on. Node and relation types are edited in the knowledge base editor.", + "type": "boolean", + "x-agent": "extract_enabled" }, "nodes": { "type": "array", @@ -24751,13 +24936,20 @@ const docTemplate = `{ } }, "tags": { + "description": "Tags are the entity labels extraction may use.", "type": "array", "items": { "type": "string" - } + }, + "x-agent": "extract_tags", + "x-agent-maximum": "50" }, "text": { - "type": "string" + "description": "Text is the extraction prompt. Required when extraction is on and no text is saved yet.", + "type": "string", + "x-agent": "extract_text", + "x-agent-detail": true, + "x-agent-max-bytes": "8000" } } }, @@ -24797,10 +24989,30 @@ const docTemplate = `{ "type": "object", "properties": { "index_mode": { - "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQIndexMode" + "description": "IndexMode is question_only or question_answer.", + "enum": [ + "question_only", + "question_answer" + ], + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQIndexMode" + } + ], + "x-agent": "faq_index_mode" }, "question_index_mode": { - "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQQuestionIndexMode" + "description": "QuestionIndexMode is combined or separate.", + "enum": [ + "combined", + "separate" + ], + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQQuestionIndexMode" + } + ], + "x-agent": "faq_question_index_mode" } } }, @@ -25622,15 +25834,18 @@ const docTemplate = `{ }, "image_attrs_enabled": { "description": "ImageAttrsEnabled turns the attribute-observed image pipeline on for this\nknowledge base. It is off by default on purpose, so upgrading an\nexisting deployment never changes what happens to documents already\nbeing ingested: with it off every image is described and OCR'd exactly\nas before. When on, the describe round also observes image attributes and\nthe attribute policy decides whether OCR runs for it. A single upload can\noverride it per document through\nKnowledgeProcessOverrides.ImageAttrsEnabled.", - "type": "boolean" + "type": "boolean", + "x-agent": true }, "image_vector_enabled": { "description": "ImageVectorEnabled lets a knowledge base whose embedding model takes\nimages index each image by its own vector and recall it with one. It\nis off by default on purpose: a model that takes images is also used\nfor plain text, and turning this on costs an embedding call per image\nand widens vector recall. Existing knowledge bases stay off after an\nupgrade because the stored JSON has no such key.", - "type": "boolean" + "type": "boolean", + "x-agent": true }, "model_id": { - "description": "Model ID", - "type": "string" + "description": "Model ID used when describing images. Empty uses the knowledge base's caption model.", + "type": "string", + "x-agent": "image_model_id" } } }, @@ -26140,6 +26355,9 @@ const docTemplate = `{ }, "github_com_Tencent_WeKnora_internal_types.KnowledgeBase": { "type": "object", + "required": [ + "name" + ], "properties": { "asr_config": { "description": "ASR config (Automatic Speech Recognition)", @@ -26147,7 +26365,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ASRConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "auto_tag_config": { "description": "AutoTagConfig controls asynchronous association of existing tags after parsing.", @@ -26155,12 +26375,15 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.AutoTagConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "chunk_count": { "description": "Chunk count (not stored in database, calculated on query)", "type": "integer", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "chunking_config": { "description": "Chunking configuration", @@ -26168,7 +26391,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ChunkingConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "created_at": { "description": "Creation time of the knowledge base", @@ -26196,8 +26421,9 @@ const docTemplate = `{ "x-agent": true }, "embedding_model_id": { - "description": "ID of the embedding model", - "type": "string" + "description": "ID of the embedding model. model.list returns the ids. Cannot change after the knowledge base has documents.", + "type": "string", + "x-agent": "embedding_model_id" }, "extract_config": { "description": "Extract config", @@ -26205,7 +26431,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ExtractConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "faq_config": { "description": "FAQConfig stores FAQ specific configuration such as indexing strategy", @@ -26213,7 +26441,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "generated_profile": { "description": "GeneratedProfile is the machine-generated description: a gist, merged\ntopics, typical questions and the aggregate snapshot they came from. It\nnever overwrites the user-authored Description; both are shown to agents.", @@ -26226,7 +26456,8 @@ const docTemplate = `{ "id": { "description": "Unique identifier of the knowledge base", "type": "string", - "x-agent": "knowledge_base_id" + "x-agent": "knowledge_base_id", + "x-agent-response": true }, "image_processing_config": { "description": "Image processing configuration", @@ -26234,7 +26465,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ImageProcessingConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "indexing_strategy": { "description": "IndexingStrategy controls which indexing pipelines are active for this knowledge base.\nPipelines: vector search, keyword search, wiki generation, knowledge graph extraction.", @@ -26243,7 +26476,8 @@ const docTemplate = `{ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.IndexingStrategy" } ], - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "is_pinned": { "description": "IsPinned and PinnedAt are computed per-caller from user_kb_pins\n(see migration 000050). They used to be stored on the row itself,\nwhich made pinning a workspace-wide ordering decision gated behind\nthe kb-edit RBAC guard. The columns are still present in legacy\nschemas for rollback safety but are no longer read or written by\nthe application — both fields are tagged ` + "`" + `gorm:\"-\"` + "`" + ` so GORM\nignores them on every CRUD call and the list handler stamps them\nafter enriching with the caller's pin set.", @@ -26252,7 +26486,8 @@ const docTemplate = `{ "is_processing": { "description": "IsProcessing indicates if there is a processing import task (for FAQ type knowledge bases)", "type": "boolean", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "is_temporary": { "description": "Whether this knowledge base is temporary (ephemeral) and should be hidden from UI", @@ -26261,12 +26496,14 @@ const docTemplate = `{ "knowledge_count": { "description": "Knowledge count (not stored in database, calculated on query)", "type": "integer", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "name": { "description": "Name of the knowledge base", "type": "string", - "x-agent": true + "x-agent": true, + "x-agent-required": true }, "pinned_at": { "description": "PinnedAt records when the current caller pinned this knowledge\nbase; nil when they have not.", @@ -26275,7 +26512,8 @@ const docTemplate = `{ "processing_count": { "description": "ProcessingCount indicates the number of knowledge items being processed (for document type knowledge bases)", "type": "integer", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "profile_config": { "description": "ProfileConfig controls automatic generation of the knowledge-base\ndescription from per-document profiles (document knowledge bases only).", @@ -26283,7 +26521,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBaseProfileConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "question_generation_config": { "description": "QuestionGenerationConfig stores question generation configuration for document knowledge bases", @@ -26291,7 +26531,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "share_count": { "description": "ShareCount indicates the number of organizations this knowledge base is shared with (not stored in database)", @@ -26299,7 +26541,8 @@ const docTemplate = `{ }, "storage_backend_id": { "description": "StorageBackendID binds this KB to one concrete storage instance. The\nlegacy provider field remains readable during migration only.", - "type": "string" + "type": "string", + "x-agent": "storage_backend_id" }, "storage_config": { "description": "Deprecated: legacy COS config column. Kept for backward compatibility with old data.", @@ -26318,26 +26561,34 @@ const docTemplate = `{ ] }, "summary_model_id": { - "description": "Summary model ID", - "type": "string" + "description": "Summary model ID. model.list returns the ids. Used for summaries, and as the default for auto-tagging and the AI description.", + "type": "string", + "x-agent": "summary_model_id" }, "tenant_id": { "description": "Workspace ID", "type": "integer" }, "type": { - "description": "Type of the knowledge base (document, faq, etc.)", + "description": "Type of the knowledge base: document, faq or wiki. Empty means document.", "type": "string", + "enum": [ + "document", + "faq", + "wiki" + ], "x-agent": true }, "updated_at": { "description": "Last updated time of the knowledge base", "type": "string", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "vector_store_id": { "description": "VectorStoreID references the VectorStore this knowledge base is bound to.\nWhen nil, the KB falls back to the workspace's effective engines derived from\nthe RETRIEVE_DRIVER environment variable (env store flow).\nThis field is set once at creation time and must not be modified afterwards;\nenforcement lives at the GORM layer (` + "`" + `\u003c-:create` + "`" + `) plus the service-layer\nKB update path, which omits this field from its update DTO.", - "type": "string" + "type": "string", + "x-agent": "vector_store_id" }, "vlm_config": { "description": "VLM config", @@ -26345,7 +26596,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.VLMConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "wiki_config": { "description": "WikiConfig stores wiki-specific configuration (only for wiki type knowledge bases)", @@ -26353,13 +26606,23 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true } } }, "github_com_Tencent_WeKnora_internal_types.KnowledgeBaseConfig": { "type": "object", "properties": { + "asr_config": { + "description": "ASRConfig replaces speech-recognition settings when set. nil means no change.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ASRConfig" + } + ] + }, "auto_tag_config": { "description": "AutoTagConfig controls optional automatic association of existing KB tags.", "allOf": [ @@ -26376,6 +26639,18 @@ const docTemplate = `{ } ] }, + "embedding_model_id": { + "description": "EmbeddingModelID changes the embedding model. nil means no change.\nA knowledge base that already has documents cannot switch models.", + "type": "string" + }, + "extract_config": { + "description": "ExtractConfig replaces graph extraction settings when set. nil means no change.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ExtractConfig" + } + ] + }, "faq_config": { "description": "FAQ configuration (only for FAQ type knowledge bases)", "allOf": [ @@ -26408,6 +26683,22 @@ const docTemplate = `{ } ] }, + "question_generation_config": { + "description": "QuestionGenerationConfig replaces generated-question settings when set. nil means no change.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig" + } + ] + }, + "storage_backend_id": { + "description": "StorageBackendID rebinds file storage. nil means no change.", + "type": "string" + }, + "summary_model_id": { + "description": "SummaryModelID changes the summary model. nil means no change.", + "type": "string" + }, "wiki_config": { "description": "Wiki configuration (only for wiki-enabled knowledge bases)", "allOf": [ @@ -26479,15 +26770,21 @@ const docTemplate = `{ "type": "object", "properties": { "custom_instructions": { - "description": "CustomInstructions is appended to the stable system prompt, e.g. the\naudience the description should address or terms to keep.", - "type": "string" + "description": "CustomInstructions is extra guidance for the description, such as the audience. The format stays fixed.", + "type": "string", + "x-agent": "profile_instructions", + "x-agent-detail": true, + "x-agent-max-bytes": "4000" }, "enabled": { - "type": "boolean" + "description": "Enabled turns the AI knowledge-base description on.", + "type": "boolean", + "x-agent": "profile_enabled" }, "model_id": { - "description": "ModelID overrides the chat model; empty falls back to the KB summary model.", - "type": "string" + "description": "ModelID overrides the summary model. Empty uses summary_model_id.", + "type": "string", + "x-agent": "profile_model_id" } } }, @@ -27353,7 +27650,8 @@ const docTemplate = `{ "description": "Markdown content. The assistant may send a full document; the API limit\nis 200000 runes, and x-agent-max-bytes covers that in UTF-8.", "type": "string", "x-agent": true, - "x-agent-max-bytes": "800000" + "x-agent-max-bytes": "800000", + "x-agent-required": true }, "process_config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeProcessOverrides" @@ -27365,7 +27663,8 @@ const docTemplate = `{ "draft", "publish" ], - "x-agent": true + "x-agent": true, + "x-agent-required": true }, "tag_ids": { "type": "array", @@ -29117,15 +29416,23 @@ const docTemplate = `{ "type": "object", "properties": { "custom_instructions": { - "description": "CustomInstructions describes the intended audience or question style.\nIt is appended to the stable system question-generation template.", - "type": "string" + "description": "CustomInstructions describes who the questions are for. The question format stays fixed.", + "type": "string", + "x-agent": "question_instructions", + "x-agent-detail": true, + "x-agent-max-bytes": "4000" }, "enabled": { - "type": "boolean" + "description": "Enabled turns question generation on. Generated questions are indexed beside the chunk.", + "type": "boolean", + "x-agent": "question_generation_enabled" }, "question_count": { - "description": "Number of questions to generate per chunk (default: 3, max: 10)", - "type": "integer" + "description": "QuestionCount is how many questions to write per chunk, from 1 to 10.", + "type": "integer", + "maximum": 10, + "minimum": 1, + "x-agent": "question_count" } } }, @@ -31574,22 +31881,30 @@ const docTemplate = `{ "type": "string" }, "custom_instructions": { - "description": "CustomInstructions adds KB-specific image interpretation guidance without\nreplacing the system-owned OCR and Markdown output contract.", - "type": "string" + "description": "CustomInstructions adds image-reading guidance. The OCR and Markdown format stay fixed.", + "type": "string", + "x-agent": "vlm_instructions", + "x-agent-detail": true, + "x-agent-max-bytes": "4000" }, "description_language": { - "description": "DescriptionLanguage controls the language used for generated image\ncaptions. Empty means follow the document/request language.", - "type": "string" + "description": "DescriptionLanguage is the language of generated image captions. Empty follows the document language.", + "type": "string", + "x-agent": "vlm_language" }, "enabled": { - "type": "boolean" + "description": "Enabled turns image captions on. Also send vlm_model_id.", + "type": "boolean", + "x-agent": "vlm_enabled" }, "interface_type": { "description": "Interface Type: \"ollama\" or \"openai\"", "type": "string" }, "model_id": { - "type": "string" + "description": "Model that writes image captions. model.list returns the ids.", + "type": "string", + "x-agent": "vlm_model_id" }, "model_name": { "description": "兼容老版本\nModel Name", @@ -32043,20 +32358,32 @@ const docTemplate = `{ "type": "object", "properties": { "content_instructions": { - "description": "ContentInstructions controls tone, structure and emphasis for generated\nsummary/entity/index prose. Citation and merge rules remain system-owned.", - "type": "string" + "description": "ContentInstructions sets tone and emphasis for generated Wiki prose. Citations stay fixed.", + "type": "string", + "x-agent": "wiki_content_instructions", + "x-agent-detail": true, + "x-agent-max-bytes": "4000" }, "extraction_granularity": { - "description": "ExtractionGranularity controls how many candidate slugs Pass 0 extracts\nper document. Empty / unknown value is treated as WikiExtractionStandard.", + "description": "ExtractionGranularity is focused, standard or exhaustive. Empty means standard.", + "enum": [ + "focused", + "standard", + "exhaustive" + ], "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiExtractionGranularity" } - ] + ], + "x-agent": "wiki_granularity" }, "extraction_instructions": { - "description": "ExtractionInstructions tells candidate extraction which domain concepts\nto emphasize without replacing the stable JSON/citation protocol.", - "type": "string" + "description": "ExtractionInstructions tells page extraction which concepts to keep. The output format stays fixed.", + "type": "string", + "x-agent": "wiki_extraction_instructions", + "x-agent-detail": true, + "x-agent-max-bytes": "4000" }, "ingest_batch_size": { "description": "IngestBatchSize controls how many pending ops a single batch claims and\nprocesses before scheduling a follow-up. 0 falls back to the hard-coded\ndefault (5). Larger batches amortize per-batch setup and let more docs\nshare the batch-internal Map/Reduce fan-out; smaller batches spread a\nKB's backlog across more concurrent batches (finer scheduling grain).", @@ -32075,12 +32402,16 @@ const docTemplate = `{ "type": "integer" }, "max_pages_per_ingest": { - "description": "MaxPagesPerIngest limits pages created/updated per ingest operation (0 = no limit)", - "type": "integer" + "description": "MaxPagesPerIngest limits pages created or updated per ingest. 0 means no limit.", + "type": "integer", + "maximum": 1000, + "minimum": 0, + "x-agent": "wiki_max_pages" }, "synthesis_model_id": { - "description": "SynthesisModelID is the LLM model ID used for wiki page generation and updates", - "type": "string" + "description": "SynthesisModelID is the model that writes Wiki pages. Empty uses summary_model_id.", + "type": "string", + "x-agent": "wiki_synthesis_model_id" } } }, @@ -33256,6 +33587,25 @@ const docTemplate = `{ } } }, + "internal_handler.CreateTagRequest": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "color": { + "type": "string" + }, + "name": { + "description": "Tag name, unique in this knowledge base", + "type": "string", + "x-agent": true + }, + "sort_order": { + "type": "integer" + } + } + }, "internal_handler.CurrentUserCapabilities": { "type": "object", "properties": { @@ -34009,6 +34359,9 @@ const docTemplate = `{ }, "internal_handler.KnowledgeBaseView": { "type": "object", + "required": [ + "name" + ], "properties": { "asr_config": { "description": "ASR config (Automatic Speech Recognition)", @@ -34016,7 +34369,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ASRConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "auto_tag_config": { "description": "AutoTagConfig controls asynchronous association of existing tags after parsing.", @@ -34024,7 +34379,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.AutoTagConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "capabilities": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KBCapabilities" @@ -34032,7 +34389,8 @@ const docTemplate = `{ "chunk_count": { "description": "Chunk count (not stored in database, calculated on query)", "type": "integer", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "chunking_config": { "description": "Chunking configuration", @@ -34040,7 +34398,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ChunkingConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "created_at": { "description": "Creation time of the knowledge base", @@ -34068,8 +34428,9 @@ const docTemplate = `{ "x-agent": true }, "embedding_model_id": { - "description": "ID of the embedding model", - "type": "string" + "description": "ID of the embedding model. model.list returns the ids. Cannot change after the knowledge base has documents.", + "type": "string", + "x-agent": "embedding_model_id" }, "extract_config": { "description": "Extract config", @@ -34077,7 +34438,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ExtractConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "faq_config": { "description": "FAQConfig stores FAQ specific configuration such as indexing strategy", @@ -34085,7 +34448,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "generated_profile": { "description": "GeneratedProfile is the machine-generated description: a gist, merged\ntopics, typical questions and the aggregate snapshot they came from. It\nnever overwrites the user-authored Description; both are shown to agents.", @@ -34098,7 +34463,8 @@ const docTemplate = `{ "id": { "description": "Unique identifier of the knowledge base", "type": "string", - "x-agent": "knowledge_base_id" + "x-agent": "knowledge_base_id", + "x-agent-response": true }, "image_processing_config": { "description": "Image processing configuration", @@ -34106,7 +34472,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ImageProcessingConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "indexing_strategy": { "description": "IndexingStrategy controls which indexing pipelines are active for this knowledge base.\nPipelines: vector search, keyword search, wiki generation, knowledge graph extraction.", @@ -34115,7 +34483,8 @@ const docTemplate = `{ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.IndexingStrategy" } ], - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "is_pinned": { "description": "IsPinned and PinnedAt are computed per-caller from user_kb_pins\n(see migration 000050). They used to be stored on the row itself,\nwhich made pinning a workspace-wide ordering decision gated behind\nthe kb-edit RBAC guard. The columns are still present in legacy\nschemas for rollback safety but are no longer read or written by\nthe application — both fields are tagged ` + "`" + `gorm:\"-\"` + "`" + ` so GORM\nignores them on every CRUD call and the list handler stamps them\nafter enriching with the caller's pin set.", @@ -34124,7 +34493,8 @@ const docTemplate = `{ "is_processing": { "description": "IsProcessing indicates if there is a processing import task (for FAQ type knowledge bases)", "type": "boolean", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "is_temporary": { "description": "Whether this knowledge base is temporary (ephemeral) and should be hidden from UI", @@ -34133,7 +34503,8 @@ const docTemplate = `{ "knowledge_count": { "description": "Knowledge count (not stored in database, calculated on query)", "type": "integer", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "my_permission": { "description": "MyPermission is the caller's role on a knowledge base shared from\nanother workspace; GET /knowledge-bases/{id} sets it.", @@ -34148,7 +34519,8 @@ const docTemplate = `{ "name": { "description": "Name of the knowledge base", "type": "string", - "x-agent": true + "x-agent": true, + "x-agent-required": true }, "pinned_at": { "description": "PinnedAt records when the current caller pinned this knowledge\nbase; nil when they have not.", @@ -34157,7 +34529,8 @@ const docTemplate = `{ "processing_count": { "description": "ProcessingCount indicates the number of knowledge items being processed (for document type knowledge bases)", "type": "integer", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "profile_config": { "description": "ProfileConfig controls automatic generation of the knowledge-base\ndescription from per-document profiles (document knowledge bases only).", @@ -34165,7 +34538,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBaseProfileConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "question_generation_config": { "description": "QuestionGenerationConfig stores question generation configuration for document knowledge bases", @@ -34173,7 +34548,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "share_count": { "description": "ShareCount indicates the number of organizations this knowledge base is shared with (not stored in database)", @@ -34181,7 +34558,8 @@ const docTemplate = `{ }, "storage_backend_id": { "description": "StorageBackendID binds this KB to one concrete storage instance. The\nlegacy provider field remains readable during migration only.", - "type": "string" + "type": "string", + "x-agent": "storage_backend_id" }, "storage_config": { "description": "Deprecated: legacy COS config column. Kept for backward compatibility with old data.", @@ -34200,29 +34578,37 @@ const docTemplate = `{ ] }, "summary_model_id": { - "description": "Summary model ID", - "type": "string" + "description": "Summary model ID. model.list returns the ids. Used for summaries, and as the default for auto-tagging and the AI description.", + "type": "string", + "x-agent": "summary_model_id" }, "tenant_id": { "description": "Workspace ID", "type": "integer" }, "type": { - "description": "Type of the knowledge base (document, faq, etc.)", + "description": "Type of the knowledge base: document, faq or wiki. Empty means document.", "type": "string", + "enum": [ + "document", + "faq", + "wiki" + ], "x-agent": true }, "updated_at": { "description": "Last updated time of the knowledge base", "type": "string", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "vector_store_engine_type": { "type": "string" }, "vector_store_id": { "description": "VectorStoreID references the VectorStore this knowledge base is bound to.\nWhen nil, the KB falls back to the workspace's effective engines derived from\nthe RETRIEVE_DRIVER environment variable (env store flow).\nThis field is set once at creation time and must not be modified afterwards;\nenforcement lives at the GORM layer (` + "`" + `\u003c-:create` + "`" + `) plus the service-layer\nKB update path, which omits this field from its update DTO.", - "type": "string" + "type": "string", + "x-agent": "vector_store_id" }, "vector_store_name": { "type": "string" @@ -34239,7 +34625,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.VLMConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "wiki_config": { "description": "WikiConfig stores wiki-specific configuration (only for wiki type knowledge bases)", @@ -34247,7 +34635,9 @@ const docTemplate = `{ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true } } }, @@ -34352,6 +34742,47 @@ const docTemplate = `{ } } }, + "internal_handler.KnowledgeTagBatchRequest": { + "type": "object", + "properties": { + "kb_id": { + "description": "Knowledge base the documents belong to.", + "type": "string", + "x-agent": "knowledge_base_id", + "x-agent-required": true + }, + "knowledge_ids": { + "description": "Documents that receive the same tags. Mutually exclusive with updates.", + "type": "array", + "items": { + "type": "string" + }, + "x-agent": true, + "x-agent-maximum": "20", + "x-agent-required": true + }, + "tag_ids": { + "description": "Tags to set on every listed document. An empty list clears them.", + "type": "array", + "items": { + "type": "string" + }, + "x-agent": true, + "x-agent-maximum": "50", + "x-agent-required": true + }, + "updates": { + "description": "Map of knowledge id to the tag ids that replace its current tags.", + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, "internal_handler.ListAgentsResponse": { "type": "object", "properties": { @@ -35007,6 +35438,124 @@ const docTemplate = `{ } } }, + "internal_handler.PatchKnowledgeBaseRequest": { + "type": "object", + "properties": { + "asr_config": { + "description": "Speech transcription.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ASRConfig" + } + ] + }, + "auto_tag_config": { + "description": "Automatic tagging.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.AutoTagConfig" + } + ] + }, + "chunking_config": { + "description": "Chunking settings. Only the fields present are changed.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ChunkingConfig" + } + ] + }, + "description": { + "description": "New description. Omit to keep it; an empty string clears it.", + "type": "string", + "x-agent": true + }, + "embedding_model_id": { + "description": "Embedding model. Cannot change after the knowledge base has documents.", + "type": "string", + "x-agent": "embedding_model_id" + }, + "extract_config": { + "description": "Graph extraction. Node types stay in the knowledge base editor.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ExtractConfig" + } + ] + }, + "faq_config": { + "description": "FAQ indexing. Only for an FAQ knowledge base.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQConfig" + } + ] + }, + "image_processing_config": { + "description": "Image description settings.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ImageProcessingConfig" + } + ] + }, + "indexing_strategy": { + "description": "Indexing pipelines. A flag left out stays as it is.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.IndexingStrategy" + } + ] + }, + "name": { + "description": "New name. Omit to keep the current one.", + "type": "string", + "x-agent": true + }, + "profile_config": { + "description": "AI description of the knowledge base.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBaseProfileConfig" + } + ] + }, + "question_generation_config": { + "description": "Generated questions for each chunk.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig" + } + ] + }, + "storage_backend_id": { + "description": "Storage instance to bind. Omit to keep the current one.", + "type": "string", + "x-agent": "storage_backend_id" + }, + "summary_model_id": { + "description": "Summary model. model.list returns the ids.", + "type": "string", + "x-agent": "summary_model_id" + }, + "vlm_config": { + "description": "Image captions.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.VLMConfig" + } + ] + }, + "wiki_config": { + "description": "Wiki page settings.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiConfig" + } + ] + } + } + }, "internal_handler.PlaceholderGroups": { "type": "object", "properties": { @@ -36158,6 +36707,22 @@ const docTemplate = `{ } } }, + "internal_handler.UpdateTagRequest": { + "type": "object", + "properties": { + "color": { + "type": "string" + }, + "name": { + "description": "New name. Omit to keep the current one.", + "type": "string", + "x-agent": true + }, + "sort_order": { + "type": "integer" + } + } + }, "internal_handler.ValidateTokenResponse": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 24009449..ba56a2d5 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -4394,7 +4394,13 @@ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } - } + }, + "x-agent": { + "id": "knowledge_base.create", + "label_param": "name", + "risk": "write" + }, + "x-agent-hint": "Creates a knowledge base owned by the user. Omit type for document. Omit indexing flags for vector and keyword search. Set embedding_model_id and summary_model_id from model.list. vector_store_id can be chosen only now. A field you leave out keeps its default." } }, "/knowledge-bases/copy": { @@ -4714,6 +4720,7 @@ "parameters": [ { "type": "string", + "x-agent": "knowledge_base_id", "description": "知识库ID", "name": "id", "in": "path", @@ -4745,7 +4752,99 @@ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } - } + }, + "x-agent": { + "id": "knowledge_base.delete", + "label": "name", + "risk": "destructive", + "target": "knowledge_base.get" + }, + "x-agent-hint": "Deletes the knowledge base and every document in it. Cannot be undone. Only the owner can delete it." + }, + "patch": { + "security": [ + { + "Bearer": [] + }, + { + "ApiKeyAuth": [] + } + ], + "description": "修改请求里出现的设置。未出现的字段保持不变,包括分块、索引和模型里没写到的项。", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "知识库" + ], + "summary": "部分更新知识库", + "parameters": [ + { + "type": "string", + "x-agent": "knowledge_base_id", + "description": "知识库ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "要修改的字段", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/internal_handler.PatchKnowledgeBaseRequest" + } + } + ], + "responses": { + "200": { + "description": "更新后的知识库", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/internal_handler.DataResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/internal_handler.KnowledgeBaseView" + } + } + } + ] + } + }, + "400": { + "description": "请求参数错误", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + }, + "403": { + "description": "无权限", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + }, + "404": { + "description": "知识库不存在", + "schema": { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" + } + } + }, + "x-agent": { + "id": "knowledge_base.update", + "label": "name", + "risk": "write", + "target": "knowledge_base.get" + }, + "x-agent-hint": "Changes the settings you send; a field left out is kept, including one indexing flag or one chunking field. Model ids come from model.list. embedding_model_id cannot change after documents exist. vector_store_id cannot be changed. Graph node types stay in the knowledge base editor." } }, "/knowledge-bases/{id}/activity": { @@ -6768,7 +6867,7 @@ "risk": "write", "target": "knowledge_base.get" }, - "x-agent-hint": "Creates a Markdown document. status=draft (the default) keeps it out of search; publish indexes it." + "x-agent-hint": "Creates a Markdown document. Send the full content, and status draft to keep it out of search or publish to index it." } }, "/knowledge-bases/{id}/knowledge/url": { @@ -7390,6 +7489,7 @@ "parameters": [ { "type": "string", + "x-agent": "knowledge_base_id", "description": "知识库ID", "name": "id", "in": "path", @@ -7401,18 +7501,7 @@ "in": "body", "required": true, "schema": { - "type": "object", - "properties": { - "color": { - "type": "string" - }, - "name": { - "type": "string" - }, - "sort_order": { - "type": "integer" - } - } + "$ref": "#/definitions/internal_handler.CreateTagRequest" } } ], @@ -7441,7 +7530,14 @@ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } - } + }, + "x-agent": { + "id": "knowledge_base.create_tag", + "label": "name", + "risk": "write", + "target": "knowledge_base.get" + }, + "x-agent-hint": "Creates a tag in the knowledge base. Pass the returned tag id to knowledge.set_tags." } }, "/knowledge-bases/{id}/tags/{tag_id}": { @@ -7468,6 +7564,7 @@ "parameters": [ { "type": "string", + "x-agent": "knowledge_base_id", "description": "知识库ID", "name": "id", "in": "path", @@ -7475,6 +7572,7 @@ }, { "type": "string", + "x-agent": "tag_id", "description": "标签ID (UUID或seq_id)", "name": "tag_id", "in": "path", @@ -7486,7 +7584,7 @@ "in": "body", "required": true, "schema": { - "type": "object" + "$ref": "#/definitions/internal_handler.UpdateTagRequest" } } ], @@ -7515,7 +7613,14 @@ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } - } + }, + "x-agent": { + "id": "knowledge_base.update_tag", + "label": "name", + "risk": "write", + "target": "knowledge_base.get" + }, + "x-agent-hint": "Renames a tag. tag_id comes from knowledge_base.list_tags. A field left out is kept." }, "delete": { "security": [ @@ -7540,6 +7645,7 @@ "parameters": [ { "type": "string", + "x-agent": "knowledge_base_id", "description": "知识库ID", "name": "id", "in": "path", @@ -7547,6 +7653,7 @@ }, { "type": "string", + "x-agent": "tag_id", "description": "标签ID (UUID或seq_id)", "name": "tag_id", "in": "path", @@ -7586,7 +7693,14 @@ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } - } + }, + "x-agent": { + "id": "knowledge_base.delete_tag", + "label": "name", + "risk": "destructive", + "target": "knowledge_base.get" + }, + "x-agent-hint": "Deletes a tag that no document uses. If documents still use it, this fails; take the tag off them with knowledge.set_tags first. Documents are not deleted." } }, "/knowledge-chat/{session_id}": { @@ -8084,6 +8198,7 @@ "parameters": [ { "type": "string", + "x-agent": "knowledge_id", "description": "知识ID", "name": "id", "in": "path", @@ -8124,7 +8239,14 @@ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } - } + }, + "x-agent": { + "id": "knowledge.update_manual", + "label": "title", + "risk": "write", + "target": "knowledge.get" + }, + "x-agent-hint": "Replaces the whole Markdown of a document created as manual knowledge. Send the complete content, not a diff. status draft keeps it out of search; publish indexes it. Uploaded files cannot be edited this way." } }, "/knowledge/move": { @@ -8348,7 +8470,7 @@ "ApiKeyAuth": [] } ], - "description": "批量更新知识条目的标签。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的空间解析", + "description": "批量更新知识条目的标签。传 updates,或传 knowledge_ids 与 tag_ids。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的空间解析", "consumes": [ "application/json" ], @@ -8361,12 +8483,12 @@ "summary": "批量更新知识标签", "parameters": [ { - "description": "标签更新请求(updates 必填,kb_id 可选)", + "description": "标签更新请求", "name": "request", "in": "body", "required": true, "schema": { - "type": "object" + "$ref": "#/definitions/internal_handler.KnowledgeTagBatchRequest" } } ], @@ -8383,7 +8505,20 @@ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } } - } + }, + "x-agent": { + "id": "knowledge.set_tags", + "items": { + "as": "knowledge_id", + "label": "title", + "param": "knowledge_ids", + "target": "knowledge.get" + }, + "label": "name", + "risk": "write", + "target": "knowledge_base.get" + }, + "x-agent-hint": "Sets the same tags on up to 20 documents in one knowledge base, replacing the tags they have now. tag_ids come from knowledge_base.list_tags; an empty tag_ids clears every tag. It does not delete documents." } }, "/knowledge/{id}": { @@ -22883,14 +23018,19 @@ "type": "object", "properties": { "enabled": { - "type": "boolean" + "description": "Enabled turns speech transcription on. Also send asr_model_id.", + "type": "boolean", + "x-agent": "asr_enabled" }, "language": { - "description": "optional: language hint for transcription", - "type": "string" + "description": "Language is an optional hint for transcription, such as zh or en.", + "type": "string", + "x-agent": "asr_language" }, "model_id": { - "type": "string" + "description": "Model that transcribes audio. model.list returns the ids.", + "type": "string", + "x-agent": "asr_model_id" } } }, @@ -23392,17 +23532,26 @@ "type": "object", "properties": { "enabled": { - "type": "boolean" + "description": "Enabled turns automatic tagging on. The model picks from tags that already exist.", + "type": "boolean", + "x-agent": "auto_tag_enabled" }, "max_tags": { - "type": "integer" + "description": "MaxTags is how many tags one document may receive, from 1 to 10.", + "type": "integer", + "maximum": 10, + "minimum": 1, + "x-agent": "auto_tag_max_tags" }, "model_id": { - "type": "string" + "description": "ModelID overrides the summary model. Empty uses summary_model_id.", + "type": "string", + "x-agent": "auto_tag_model_id" }, "skip_if_tagged": { - "description": "SkipIfTagged leaves documents that already carry tags untouched, so a\ndeliberate manual classification is not diluted by model guesses. It is\na pointer because the default is true: rows written before this field\nexisted decode to nil and must not silently flip to \"always append\".", - "type": "boolean" + "description": "SkipIfTagged leaves a document alone when it already has tags. Empty means yes.", + "type": "boolean", + "x-agent": "auto_tag_skip_if_tagged" } } }, @@ -23783,30 +23932,45 @@ "properties": { "child_chunk_size": { "description": "ChildChunkSize is the size of child chunks used for embedding (default: 384).\nOnly used when EnableParentChild is true.", - "type": "integer" + "type": "integer", + "maximum": 10000, + "minimum": 1, + "x-agent": true }, "chunk_overlap": { - "description": "Chunk overlap", - "type": "integer" + "description": "Chunk overlap in characters.", + "type": "integer", + "maximum": 5000, + "minimum": 0, + "x-agent": true }, "chunk_size": { - "description": "Chunk size", - "type": "integer" + "description": "Chunk size in characters. Empty on create uses the server default.", + "type": "integer", + "maximum": 10000, + "minimum": 100, + "x-agent": true }, "enable_parent_child": { - "description": "EnableParentChild enables two-level parent-child chunking strategy.\nWhen enabled, large parent chunks provide context while small child chunks\nare used for vector matching. Retrieval matches on child but returns parent content.", - "type": "boolean" + "description": "EnableParentChild splits into large parent chunks and small child chunks. Search matches a child and returns its parent.", + "type": "boolean", + "x-agent": true }, "languages": { - "description": "Languages hints the heuristic patterns. Empty = auto-detect from content.\nExamples: [\"de\"], [\"en\", \"zh\"].", + "description": "Languages hints the splitter, for example de or zh. Empty detects the language from the document.", "type": "array", "items": { "type": "string" - } + }, + "x-agent": true, + "x-agent-maximum": "20" }, "parent_chunk_size": { "description": "ParentChunkSize is the size of parent chunks (default: 4096).\nOnly used when EnableParentChild is true.", - "type": "integer" + "type": "integer", + "maximum": 20000, + "minimum": 1, + "x-agent": true }, "parser_engine_rules": { "description": "ParserEngineRules configures which parser engine to use for each file type.\nWhen empty, DefaultParserEngine is used (builtin/simple routing, except\ntypes that only a specific engine can parse: ppt/pptx fall back to\nmarkitdown). A linked anydoc binding is preferred for every type it\nconverts.", @@ -23816,23 +23980,39 @@ } }, "separators": { - "description": "Separators", + "description": "Separators, in the order they are tried.", "type": "array", "items": { "type": "string" - } + }, + "x-agent": true, + "x-agent-maximum": "20" }, "strategy": { - "description": "Strategy selects the adaptive chunking tier. Empty / \"legacy\" preserves\nthe historical recursive splitter; \"auto\" lets a profiler pick between\nheading-aware, heuristic and recursive tiers; \"heading\" / \"heuristic\" /\n\"recursive\" pin the tier explicitly.", - "type": "string" + "description": "Strategy selects how documents are split: auto, heading, heuristic, recursive or legacy. Empty keeps the server default.", + "type": "string", + "enum": [ + "auto", + "heading", + "heuristic", + "recursive", + "legacy" + ], + "x-agent": true }, "table_metadata_instructions": { - "description": "TableMetadataInstructions contains optional business guidance used when\ngenerating searchable summaries for CSV/Excel tables. The system-owned\noutput contract remains fixed; these instructions only add domain context.", - "type": "string" + "description": "TableMetadataInstructions is extra guidance for CSV and Excel summaries. The output format stays fixed.", + "type": "string", + "x-agent": true, + "x-agent-detail": true, + "x-agent-max-bytes": "4000" }, "token_limit": { - "description": "TokenLimit caps chunk size in approximate tokens. 0 = use ChunkSize\nas a character count.", - "type": "integer" + "description": "TokenLimit caps chunk size in approximate tokens. 0 uses ChunkSize as a character count.", + "type": "integer", + "maximum": 100000, + "minimum": 0, + "x-agent": true } } }, @@ -24725,11 +24905,16 @@ "type": "object", "properties": { "custom_instructions": { - "description": "CustomInstructions adds domain-specific extraction guidance while the\nsystem keeps ownership of the structured graph output protocol.", - "type": "string" + "description": "CustomInstructions adds domain guidance. The graph output format stays fixed.", + "type": "string", + "x-agent": "extract_instructions", + "x-agent-detail": true, + "x-agent-max-bytes": "4000" }, "enabled": { - "type": "boolean" + "description": "Enabled turns graph extraction on. Node and relation types are edited in the knowledge base editor.", + "type": "boolean", + "x-agent": "extract_enabled" }, "nodes": { "type": "array", @@ -24744,13 +24929,20 @@ } }, "tags": { + "description": "Tags are the entity labels extraction may use.", "type": "array", "items": { "type": "string" - } + }, + "x-agent": "extract_tags", + "x-agent-maximum": "50" }, "text": { - "type": "string" + "description": "Text is the extraction prompt. Required when extraction is on and no text is saved yet.", + "type": "string", + "x-agent": "extract_text", + "x-agent-detail": true, + "x-agent-max-bytes": "8000" } } }, @@ -24790,10 +24982,30 @@ "type": "object", "properties": { "index_mode": { - "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQIndexMode" + "description": "IndexMode is question_only or question_answer.", + "enum": [ + "question_only", + "question_answer" + ], + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQIndexMode" + } + ], + "x-agent": "faq_index_mode" }, "question_index_mode": { - "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQQuestionIndexMode" + "description": "QuestionIndexMode is combined or separate.", + "enum": [ + "combined", + "separate" + ], + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQQuestionIndexMode" + } + ], + "x-agent": "faq_question_index_mode" } } }, @@ -25615,15 +25827,18 @@ }, "image_attrs_enabled": { "description": "ImageAttrsEnabled turns the attribute-observed image pipeline on for this\nknowledge base. It is off by default on purpose, so upgrading an\nexisting deployment never changes what happens to documents already\nbeing ingested: with it off every image is described and OCR'd exactly\nas before. When on, the describe round also observes image attributes and\nthe attribute policy decides whether OCR runs for it. A single upload can\noverride it per document through\nKnowledgeProcessOverrides.ImageAttrsEnabled.", - "type": "boolean" + "type": "boolean", + "x-agent": true }, "image_vector_enabled": { "description": "ImageVectorEnabled lets a knowledge base whose embedding model takes\nimages index each image by its own vector and recall it with one. It\nis off by default on purpose: a model that takes images is also used\nfor plain text, and turning this on costs an embedding call per image\nand widens vector recall. Existing knowledge bases stay off after an\nupgrade because the stored JSON has no such key.", - "type": "boolean" + "type": "boolean", + "x-agent": true }, "model_id": { - "description": "Model ID", - "type": "string" + "description": "Model ID used when describing images. Empty uses the knowledge base's caption model.", + "type": "string", + "x-agent": "image_model_id" } } }, @@ -26133,6 +26348,9 @@ }, "github_com_Tencent_WeKnora_internal_types.KnowledgeBase": { "type": "object", + "required": [ + "name" + ], "properties": { "asr_config": { "description": "ASR config (Automatic Speech Recognition)", @@ -26140,7 +26358,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ASRConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "auto_tag_config": { "description": "AutoTagConfig controls asynchronous association of existing tags after parsing.", @@ -26148,12 +26368,15 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.AutoTagConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "chunk_count": { "description": "Chunk count (not stored in database, calculated on query)", "type": "integer", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "chunking_config": { "description": "Chunking configuration", @@ -26161,7 +26384,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ChunkingConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "created_at": { "description": "Creation time of the knowledge base", @@ -26189,8 +26414,9 @@ "x-agent": true }, "embedding_model_id": { - "description": "ID of the embedding model", - "type": "string" + "description": "ID of the embedding model. model.list returns the ids. Cannot change after the knowledge base has documents.", + "type": "string", + "x-agent": "embedding_model_id" }, "extract_config": { "description": "Extract config", @@ -26198,7 +26424,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ExtractConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "faq_config": { "description": "FAQConfig stores FAQ specific configuration such as indexing strategy", @@ -26206,7 +26434,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "generated_profile": { "description": "GeneratedProfile is the machine-generated description: a gist, merged\ntopics, typical questions and the aggregate snapshot they came from. It\nnever overwrites the user-authored Description; both are shown to agents.", @@ -26219,7 +26449,8 @@ "id": { "description": "Unique identifier of the knowledge base", "type": "string", - "x-agent": "knowledge_base_id" + "x-agent": "knowledge_base_id", + "x-agent-response": true }, "image_processing_config": { "description": "Image processing configuration", @@ -26227,7 +26458,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ImageProcessingConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "indexing_strategy": { "description": "IndexingStrategy controls which indexing pipelines are active for this knowledge base.\nPipelines: vector search, keyword search, wiki generation, knowledge graph extraction.", @@ -26236,7 +26469,8 @@ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.IndexingStrategy" } ], - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "is_pinned": { "description": "IsPinned and PinnedAt are computed per-caller from user_kb_pins\n(see migration 000050). They used to be stored on the row itself,\nwhich made pinning a workspace-wide ordering decision gated behind\nthe kb-edit RBAC guard. The columns are still present in legacy\nschemas for rollback safety but are no longer read or written by\nthe application — both fields are tagged `gorm:\"-\"` so GORM\nignores them on every CRUD call and the list handler stamps them\nafter enriching with the caller's pin set.", @@ -26245,7 +26479,8 @@ "is_processing": { "description": "IsProcessing indicates if there is a processing import task (for FAQ type knowledge bases)", "type": "boolean", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "is_temporary": { "description": "Whether this knowledge base is temporary (ephemeral) and should be hidden from UI", @@ -26254,12 +26489,14 @@ "knowledge_count": { "description": "Knowledge count (not stored in database, calculated on query)", "type": "integer", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "name": { "description": "Name of the knowledge base", "type": "string", - "x-agent": true + "x-agent": true, + "x-agent-required": true }, "pinned_at": { "description": "PinnedAt records when the current caller pinned this knowledge\nbase; nil when they have not.", @@ -26268,7 +26505,8 @@ "processing_count": { "description": "ProcessingCount indicates the number of knowledge items being processed (for document type knowledge bases)", "type": "integer", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "profile_config": { "description": "ProfileConfig controls automatic generation of the knowledge-base\ndescription from per-document profiles (document knowledge bases only).", @@ -26276,7 +26514,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBaseProfileConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "question_generation_config": { "description": "QuestionGenerationConfig stores question generation configuration for document knowledge bases", @@ -26284,7 +26524,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "share_count": { "description": "ShareCount indicates the number of organizations this knowledge base is shared with (not stored in database)", @@ -26292,7 +26534,8 @@ }, "storage_backend_id": { "description": "StorageBackendID binds this KB to one concrete storage instance. The\nlegacy provider field remains readable during migration only.", - "type": "string" + "type": "string", + "x-agent": "storage_backend_id" }, "storage_config": { "description": "Deprecated: legacy COS config column. Kept for backward compatibility with old data.", @@ -26311,26 +26554,34 @@ ] }, "summary_model_id": { - "description": "Summary model ID", - "type": "string" + "description": "Summary model ID. model.list returns the ids. Used for summaries, and as the default for auto-tagging and the AI description.", + "type": "string", + "x-agent": "summary_model_id" }, "tenant_id": { "description": "Workspace ID", "type": "integer" }, "type": { - "description": "Type of the knowledge base (document, faq, etc.)", + "description": "Type of the knowledge base: document, faq or wiki. Empty means document.", "type": "string", + "enum": [ + "document", + "faq", + "wiki" + ], "x-agent": true }, "updated_at": { "description": "Last updated time of the knowledge base", "type": "string", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "vector_store_id": { "description": "VectorStoreID references the VectorStore this knowledge base is bound to.\nWhen nil, the KB falls back to the workspace's effective engines derived from\nthe RETRIEVE_DRIVER environment variable (env store flow).\nThis field is set once at creation time and must not be modified afterwards;\nenforcement lives at the GORM layer (`\u003c-:create`) plus the service-layer\nKB update path, which omits this field from its update DTO.", - "type": "string" + "type": "string", + "x-agent": "vector_store_id" }, "vlm_config": { "description": "VLM config", @@ -26338,7 +26589,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.VLMConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "wiki_config": { "description": "WikiConfig stores wiki-specific configuration (only for wiki type knowledge bases)", @@ -26346,13 +26599,23 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true } } }, "github_com_Tencent_WeKnora_internal_types.KnowledgeBaseConfig": { "type": "object", "properties": { + "asr_config": { + "description": "ASRConfig replaces speech-recognition settings when set. nil means no change.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ASRConfig" + } + ] + }, "auto_tag_config": { "description": "AutoTagConfig controls optional automatic association of existing KB tags.", "allOf": [ @@ -26369,6 +26632,18 @@ } ] }, + "embedding_model_id": { + "description": "EmbeddingModelID changes the embedding model. nil means no change.\nA knowledge base that already has documents cannot switch models.", + "type": "string" + }, + "extract_config": { + "description": "ExtractConfig replaces graph extraction settings when set. nil means no change.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ExtractConfig" + } + ] + }, "faq_config": { "description": "FAQ configuration (only for FAQ type knowledge bases)", "allOf": [ @@ -26401,6 +26676,22 @@ } ] }, + "question_generation_config": { + "description": "QuestionGenerationConfig replaces generated-question settings when set. nil means no change.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig" + } + ] + }, + "storage_backend_id": { + "description": "StorageBackendID rebinds file storage. nil means no change.", + "type": "string" + }, + "summary_model_id": { + "description": "SummaryModelID changes the summary model. nil means no change.", + "type": "string" + }, "wiki_config": { "description": "Wiki configuration (only for wiki-enabled knowledge bases)", "allOf": [ @@ -26472,15 +26763,21 @@ "type": "object", "properties": { "custom_instructions": { - "description": "CustomInstructions is appended to the stable system prompt, e.g. the\naudience the description should address or terms to keep.", - "type": "string" + "description": "CustomInstructions is extra guidance for the description, such as the audience. The format stays fixed.", + "type": "string", + "x-agent": "profile_instructions", + "x-agent-detail": true, + "x-agent-max-bytes": "4000" }, "enabled": { - "type": "boolean" + "description": "Enabled turns the AI knowledge-base description on.", + "type": "boolean", + "x-agent": "profile_enabled" }, "model_id": { - "description": "ModelID overrides the chat model; empty falls back to the KB summary model.", - "type": "string" + "description": "ModelID overrides the summary model. Empty uses summary_model_id.", + "type": "string", + "x-agent": "profile_model_id" } } }, @@ -27346,7 +27643,8 @@ "description": "Markdown content. The assistant may send a full document; the API limit\nis 200000 runes, and x-agent-max-bytes covers that in UTF-8.", "type": "string", "x-agent": true, - "x-agent-max-bytes": "800000" + "x-agent-max-bytes": "800000", + "x-agent-required": true }, "process_config": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeProcessOverrides" @@ -27358,7 +27656,8 @@ "draft", "publish" ], - "x-agent": true + "x-agent": true, + "x-agent-required": true }, "tag_ids": { "type": "array", @@ -29110,15 +29409,23 @@ "type": "object", "properties": { "custom_instructions": { - "description": "CustomInstructions describes the intended audience or question style.\nIt is appended to the stable system question-generation template.", - "type": "string" + "description": "CustomInstructions describes who the questions are for. The question format stays fixed.", + "type": "string", + "x-agent": "question_instructions", + "x-agent-detail": true, + "x-agent-max-bytes": "4000" }, "enabled": { - "type": "boolean" + "description": "Enabled turns question generation on. Generated questions are indexed beside the chunk.", + "type": "boolean", + "x-agent": "question_generation_enabled" }, "question_count": { - "description": "Number of questions to generate per chunk (default: 3, max: 10)", - "type": "integer" + "description": "QuestionCount is how many questions to write per chunk, from 1 to 10.", + "type": "integer", + "maximum": 10, + "minimum": 1, + "x-agent": "question_count" } } }, @@ -31567,22 +31874,30 @@ "type": "string" }, "custom_instructions": { - "description": "CustomInstructions adds KB-specific image interpretation guidance without\nreplacing the system-owned OCR and Markdown output contract.", - "type": "string" + "description": "CustomInstructions adds image-reading guidance. The OCR and Markdown format stay fixed.", + "type": "string", + "x-agent": "vlm_instructions", + "x-agent-detail": true, + "x-agent-max-bytes": "4000" }, "description_language": { - "description": "DescriptionLanguage controls the language used for generated image\ncaptions. Empty means follow the document/request language.", - "type": "string" + "description": "DescriptionLanguage is the language of generated image captions. Empty follows the document language.", + "type": "string", + "x-agent": "vlm_language" }, "enabled": { - "type": "boolean" + "description": "Enabled turns image captions on. Also send vlm_model_id.", + "type": "boolean", + "x-agent": "vlm_enabled" }, "interface_type": { "description": "Interface Type: \"ollama\" or \"openai\"", "type": "string" }, "model_id": { - "type": "string" + "description": "Model that writes image captions. model.list returns the ids.", + "type": "string", + "x-agent": "vlm_model_id" }, "model_name": { "description": "兼容老版本\nModel Name", @@ -32036,20 +32351,32 @@ "type": "object", "properties": { "content_instructions": { - "description": "ContentInstructions controls tone, structure and emphasis for generated\nsummary/entity/index prose. Citation and merge rules remain system-owned.", - "type": "string" + "description": "ContentInstructions sets tone and emphasis for generated Wiki prose. Citations stay fixed.", + "type": "string", + "x-agent": "wiki_content_instructions", + "x-agent-detail": true, + "x-agent-max-bytes": "4000" }, "extraction_granularity": { - "description": "ExtractionGranularity controls how many candidate slugs Pass 0 extracts\nper document. Empty / unknown value is treated as WikiExtractionStandard.", + "description": "ExtractionGranularity is focused, standard or exhaustive. Empty means standard.", + "enum": [ + "focused", + "standard", + "exhaustive" + ], "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiExtractionGranularity" } - ] + ], + "x-agent": "wiki_granularity" }, "extraction_instructions": { - "description": "ExtractionInstructions tells candidate extraction which domain concepts\nto emphasize without replacing the stable JSON/citation protocol.", - "type": "string" + "description": "ExtractionInstructions tells page extraction which concepts to keep. The output format stays fixed.", + "type": "string", + "x-agent": "wiki_extraction_instructions", + "x-agent-detail": true, + "x-agent-max-bytes": "4000" }, "ingest_batch_size": { "description": "IngestBatchSize controls how many pending ops a single batch claims and\nprocesses before scheduling a follow-up. 0 falls back to the hard-coded\ndefault (5). Larger batches amortize per-batch setup and let more docs\nshare the batch-internal Map/Reduce fan-out; smaller batches spread a\nKB's backlog across more concurrent batches (finer scheduling grain).", @@ -32068,12 +32395,16 @@ "type": "integer" }, "max_pages_per_ingest": { - "description": "MaxPagesPerIngest limits pages created/updated per ingest operation (0 = no limit)", - "type": "integer" + "description": "MaxPagesPerIngest limits pages created or updated per ingest. 0 means no limit.", + "type": "integer", + "maximum": 1000, + "minimum": 0, + "x-agent": "wiki_max_pages" }, "synthesis_model_id": { - "description": "SynthesisModelID is the LLM model ID used for wiki page generation and updates", - "type": "string" + "description": "SynthesisModelID is the model that writes Wiki pages. Empty uses summary_model_id.", + "type": "string", + "x-agent": "wiki_synthesis_model_id" } } }, @@ -33249,6 +33580,25 @@ } } }, + "internal_handler.CreateTagRequest": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "color": { + "type": "string" + }, + "name": { + "description": "Tag name, unique in this knowledge base", + "type": "string", + "x-agent": true + }, + "sort_order": { + "type": "integer" + } + } + }, "internal_handler.CurrentUserCapabilities": { "type": "object", "properties": { @@ -34002,6 +34352,9 @@ }, "internal_handler.KnowledgeBaseView": { "type": "object", + "required": [ + "name" + ], "properties": { "asr_config": { "description": "ASR config (Automatic Speech Recognition)", @@ -34009,7 +34362,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ASRConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "auto_tag_config": { "description": "AutoTagConfig controls asynchronous association of existing tags after parsing.", @@ -34017,7 +34372,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.AutoTagConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "capabilities": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KBCapabilities" @@ -34025,7 +34382,8 @@ "chunk_count": { "description": "Chunk count (not stored in database, calculated on query)", "type": "integer", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "chunking_config": { "description": "Chunking configuration", @@ -34033,7 +34391,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ChunkingConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "created_at": { "description": "Creation time of the knowledge base", @@ -34061,8 +34421,9 @@ "x-agent": true }, "embedding_model_id": { - "description": "ID of the embedding model", - "type": "string" + "description": "ID of the embedding model. model.list returns the ids. Cannot change after the knowledge base has documents.", + "type": "string", + "x-agent": "embedding_model_id" }, "extract_config": { "description": "Extract config", @@ -34070,7 +34431,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ExtractConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "faq_config": { "description": "FAQConfig stores FAQ specific configuration such as indexing strategy", @@ -34078,7 +34441,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "generated_profile": { "description": "GeneratedProfile is the machine-generated description: a gist, merged\ntopics, typical questions and the aggregate snapshot they came from. It\nnever overwrites the user-authored Description; both are shown to agents.", @@ -34091,7 +34456,8 @@ "id": { "description": "Unique identifier of the knowledge base", "type": "string", - "x-agent": "knowledge_base_id" + "x-agent": "knowledge_base_id", + "x-agent-response": true }, "image_processing_config": { "description": "Image processing configuration", @@ -34099,7 +34465,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ImageProcessingConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "indexing_strategy": { "description": "IndexingStrategy controls which indexing pipelines are active for this knowledge base.\nPipelines: vector search, keyword search, wiki generation, knowledge graph extraction.", @@ -34108,7 +34476,8 @@ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.IndexingStrategy" } ], - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "is_pinned": { "description": "IsPinned and PinnedAt are computed per-caller from user_kb_pins\n(see migration 000050). They used to be stored on the row itself,\nwhich made pinning a workspace-wide ordering decision gated behind\nthe kb-edit RBAC guard. The columns are still present in legacy\nschemas for rollback safety but are no longer read or written by\nthe application — both fields are tagged `gorm:\"-\"` so GORM\nignores them on every CRUD call and the list handler stamps them\nafter enriching with the caller's pin set.", @@ -34117,7 +34486,8 @@ "is_processing": { "description": "IsProcessing indicates if there is a processing import task (for FAQ type knowledge bases)", "type": "boolean", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "is_temporary": { "description": "Whether this knowledge base is temporary (ephemeral) and should be hidden from UI", @@ -34126,7 +34496,8 @@ "knowledge_count": { "description": "Knowledge count (not stored in database, calculated on query)", "type": "integer", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "my_permission": { "description": "MyPermission is the caller's role on a knowledge base shared from\nanother workspace; GET /knowledge-bases/{id} sets it.", @@ -34141,7 +34512,8 @@ "name": { "description": "Name of the knowledge base", "type": "string", - "x-agent": true + "x-agent": true, + "x-agent-required": true }, "pinned_at": { "description": "PinnedAt records when the current caller pinned this knowledge\nbase; nil when they have not.", @@ -34150,7 +34522,8 @@ "processing_count": { "description": "ProcessingCount indicates the number of knowledge items being processed (for document type knowledge bases)", "type": "integer", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "profile_config": { "description": "ProfileConfig controls automatic generation of the knowledge-base\ndescription from per-document profiles (document knowledge bases only).", @@ -34158,7 +34531,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBaseProfileConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "question_generation_config": { "description": "QuestionGenerationConfig stores question generation configuration for document knowledge bases", @@ -34166,7 +34541,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "share_count": { "description": "ShareCount indicates the number of organizations this knowledge base is shared with (not stored in database)", @@ -34174,7 +34551,8 @@ }, "storage_backend_id": { "description": "StorageBackendID binds this KB to one concrete storage instance. The\nlegacy provider field remains readable during migration only.", - "type": "string" + "type": "string", + "x-agent": "storage_backend_id" }, "storage_config": { "description": "Deprecated: legacy COS config column. Kept for backward compatibility with old data.", @@ -34193,29 +34571,37 @@ ] }, "summary_model_id": { - "description": "Summary model ID", - "type": "string" + "description": "Summary model ID. model.list returns the ids. Used for summaries, and as the default for auto-tagging and the AI description.", + "type": "string", + "x-agent": "summary_model_id" }, "tenant_id": { "description": "Workspace ID", "type": "integer" }, "type": { - "description": "Type of the knowledge base (document, faq, etc.)", + "description": "Type of the knowledge base: document, faq or wiki. Empty means document.", "type": "string", + "enum": [ + "document", + "faq", + "wiki" + ], "x-agent": true }, "updated_at": { "description": "Last updated time of the knowledge base", "type": "string", - "x-agent": true + "x-agent": true, + "x-agent-response": true }, "vector_store_engine_type": { "type": "string" }, "vector_store_id": { "description": "VectorStoreID references the VectorStore this knowledge base is bound to.\nWhen nil, the KB falls back to the workspace's effective engines derived from\nthe RETRIEVE_DRIVER environment variable (env store flow).\nThis field is set once at creation time and must not be modified afterwards;\nenforcement lives at the GORM layer (`\u003c-:create`) plus the service-layer\nKB update path, which omits this field from its update DTO.", - "type": "string" + "type": "string", + "x-agent": "vector_store_id" }, "vector_store_name": { "type": "string" @@ -34232,7 +34618,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.VLMConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true }, "wiki_config": { "description": "WikiConfig stores wiki-specific configuration (only for wiki type knowledge bases)", @@ -34240,7 +34628,9 @@ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiConfig" } - ] + ], + "x-agent": true, + "x-agent-detail": true } } }, @@ -34345,6 +34735,47 @@ } } }, + "internal_handler.KnowledgeTagBatchRequest": { + "type": "object", + "properties": { + "kb_id": { + "description": "Knowledge base the documents belong to.", + "type": "string", + "x-agent": "knowledge_base_id", + "x-agent-required": true + }, + "knowledge_ids": { + "description": "Documents that receive the same tags. Mutually exclusive with updates.", + "type": "array", + "items": { + "type": "string" + }, + "x-agent": true, + "x-agent-maximum": "20", + "x-agent-required": true + }, + "tag_ids": { + "description": "Tags to set on every listed document. An empty list clears them.", + "type": "array", + "items": { + "type": "string" + }, + "x-agent": true, + "x-agent-maximum": "50", + "x-agent-required": true + }, + "updates": { + "description": "Map of knowledge id to the tag ids that replace its current tags.", + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, "internal_handler.ListAgentsResponse": { "type": "object", "properties": { @@ -35000,6 +35431,124 @@ } } }, + "internal_handler.PatchKnowledgeBaseRequest": { + "type": "object", + "properties": { + "asr_config": { + "description": "Speech transcription.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ASRConfig" + } + ] + }, + "auto_tag_config": { + "description": "Automatic tagging.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.AutoTagConfig" + } + ] + }, + "chunking_config": { + "description": "Chunking settings. Only the fields present are changed.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ChunkingConfig" + } + ] + }, + "description": { + "description": "New description. Omit to keep it; an empty string clears it.", + "type": "string", + "x-agent": true + }, + "embedding_model_id": { + "description": "Embedding model. Cannot change after the knowledge base has documents.", + "type": "string", + "x-agent": "embedding_model_id" + }, + "extract_config": { + "description": "Graph extraction. Node types stay in the knowledge base editor.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ExtractConfig" + } + ] + }, + "faq_config": { + "description": "FAQ indexing. Only for an FAQ knowledge base.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FAQConfig" + } + ] + }, + "image_processing_config": { + "description": "Image description settings.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ImageProcessingConfig" + } + ] + }, + "indexing_strategy": { + "description": "Indexing pipelines. A flag left out stays as it is.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.IndexingStrategy" + } + ] + }, + "name": { + "description": "New name. Omit to keep the current one.", + "type": "string", + "x-agent": true + }, + "profile_config": { + "description": "AI description of the knowledge base.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBaseProfileConfig" + } + ] + }, + "question_generation_config": { + "description": "Generated questions for each chunk.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig" + } + ] + }, + "storage_backend_id": { + "description": "Storage instance to bind. Omit to keep the current one.", + "type": "string", + "x-agent": "storage_backend_id" + }, + "summary_model_id": { + "description": "Summary model. model.list returns the ids.", + "type": "string", + "x-agent": "summary_model_id" + }, + "vlm_config": { + "description": "Image captions.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.VLMConfig" + } + ] + }, + "wiki_config": { + "description": "Wiki page settings.", + "allOf": [ + { + "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WikiConfig" + } + ] + } + } + }, "internal_handler.PlaceholderGroups": { "type": "object", "properties": { @@ -36151,6 +36700,22 @@ } } }, + "internal_handler.UpdateTagRequest": { + "type": "object", + "properties": { + "color": { + "type": "string" + }, + "name": { + "description": "New name. Omit to keep the current one.", + "type": "string", + "x-agent": true + }, + "sort_order": { + "type": "integer" + } + } + }, "internal_handler.ValidateTokenResponse": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 5e66b40e..f97ca57c 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1089,12 +1089,18 @@ definitions: github_com_Tencent_WeKnora_internal_types.ASRConfig: properties: enabled: + description: Enabled turns speech transcription on. Also send asr_model_id. type: boolean + x-agent: asr_enabled language: - description: 'optional: language hint for transcription' + description: Language is an optional hint for transcription, such as zh or + en. type: string + x-agent: asr_language model_id: + description: Model that transcribes audio. model.list returns the ids. type: string + x-agent: asr_model_id type: object github_com_Tencent_WeKnora_internal_types.AdminCreateUserRequest: properties: @@ -1499,18 +1505,26 @@ definitions: github_com_Tencent_WeKnora_internal_types.AutoTagConfig: properties: enabled: + description: Enabled turns automatic tagging on. The model picks from tags + that already exist. type: boolean + x-agent: auto_tag_enabled max_tags: + description: MaxTags is how many tags one document may receive, from 1 to + 10. + maximum: 10 + minimum: 1 type: integer + x-agent: auto_tag_max_tags model_id: + description: ModelID overrides the summary model. Empty uses summary_model_id. type: string + x-agent: auto_tag_model_id skip_if_tagged: - description: |- - SkipIfTagged leaves documents that already carry tags untouched, so a - deliberate manual classification is not diluted by model guesses. It is - a pointer because the default is true: rows written before this field - existed decode to nil and must not silently flip to "always append". + description: SkipIfTagged leaves a document alone when it already has tags. + Empty means yes. type: boolean + x-agent: auto_tag_skip_if_tagged type: object github_com_Tencent_WeKnora_internal_types.COSEngineConfig: properties: @@ -1806,31 +1820,43 @@ definitions: description: |- ChildChunkSize is the size of child chunks used for embedding (default: 384). Only used when EnableParentChild is true. + maximum: 10000 + minimum: 1 type: integer + x-agent: true chunk_overlap: - description: Chunk overlap + description: Chunk overlap in characters. + maximum: 5000 + minimum: 0 type: integer + x-agent: true chunk_size: - description: Chunk size + description: Chunk size in characters. Empty on create uses the server default. + maximum: 10000 + minimum: 100 type: integer + x-agent: true enable_parent_child: - description: |- - EnableParentChild enables two-level parent-child chunking strategy. - When enabled, large parent chunks provide context while small child chunks - are used for vector matching. Retrieval matches on child but returns parent content. + description: EnableParentChild splits into large parent chunks and small child + chunks. Search matches a child and returns its parent. type: boolean + x-agent: true languages: - description: |- - Languages hints the heuristic patterns. Empty = auto-detect from content. - Examples: ["de"], ["en", "zh"]. + description: Languages hints the splitter, for example de or zh. Empty detects + the language from the document. items: type: string type: array + x-agent: true + x-agent-maximum: "20" parent_chunk_size: description: |- ParentChunkSize is the size of parent chunks (default: 4096). Only used when EnableParentChild is true. + maximum: 20000 + minimum: 1 type: integer + x-agent: true parser_engine_rules: description: |- ParserEngineRules configures which parser engine to use for each file type. @@ -1842,28 +1868,37 @@ definitions: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ParserEngineRule' type: array separators: - description: Separators + description: Separators, in the order they are tried. items: type: string type: array + x-agent: true + x-agent-maximum: "20" strategy: - description: |- - Strategy selects the adaptive chunking tier. Empty / "legacy" preserves - the historical recursive splitter; "auto" lets a profiler pick between - heading-aware, heuristic and recursive tiers; "heading" / "heuristic" / - "recursive" pin the tier explicitly. + description: 'Strategy selects how documents are split: auto, heading, heuristic, + recursive or legacy. Empty keeps the server default.' + enum: + - auto + - heading + - heuristic + - recursive + - legacy type: string + x-agent: true table_metadata_instructions: - description: |- - TableMetadataInstructions contains optional business guidance used when - generating searchable summaries for CSV/Excel tables. The system-owned - output contract remains fixed; these instructions only add domain context. + description: TableMetadataInstructions is extra guidance for CSV and Excel + summaries. The output format stays fixed. type: string + x-agent: true + x-agent-detail: true + x-agent-max-bytes: "4000" token_limit: - description: |- - TokenLimit caps chunk size in approximate tokens. 0 = use ChunkSize + description: TokenLimit caps chunk size in approximate tokens. 0 uses ChunkSize as a character count. + maximum: 100000 + minimum: 0 type: integer + x-agent: true type: object github_com_Tencent_WeKnora_internal_types.ConnectionConfig: properties: @@ -2673,12 +2708,17 @@ definitions: github_com_Tencent_WeKnora_internal_types.ExtractConfig: properties: custom_instructions: - description: |- - CustomInstructions adds domain-specific extraction guidance while the - system keeps ownership of the structured graph output protocol. + description: CustomInstructions adds domain guidance. The graph output format + stays fixed. type: string + x-agent: extract_instructions + x-agent-detail: true + x-agent-max-bytes: "4000" enabled: + description: Enabled turns graph extraction on. Node and relation types are + edited in the knowledge base editor. type: boolean + x-agent: extract_enabled nodes: items: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.GraphNode' @@ -2688,11 +2728,19 @@ definitions: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.GraphRelation' type: array tags: + description: Tags are the entity labels extraction may use. items: type: string type: array + x-agent: extract_tags + x-agent-maximum: "50" text: + description: Text is the extraction prompt. Required when extraction is on + and no text is saved yet. type: string + x-agent: extract_text + x-agent-detail: true + x-agent-max-bytes: "8000" type: object github_com_Tencent_WeKnora_internal_types.FAQBatchUpsertPayload: properties: @@ -2719,9 +2767,21 @@ definitions: github_com_Tencent_WeKnora_internal_types.FAQConfig: properties: index_mode: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQIndexMode' + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQIndexMode' + description: IndexMode is question_only or question_answer. + enum: + - question_only + - question_answer + x-agent: faq_index_mode question_index_mode: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQQuestionIndexMode' + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQQuestionIndexMode' + description: QuestionIndexMode is combined or separate. + enum: + - combined + - separate + x-agent: faq_question_index_mode type: object github_com_Tencent_WeKnora_internal_types.FAQEntry: properties: @@ -3346,6 +3406,7 @@ definitions: override it per document through KnowledgeProcessOverrides.ImageAttrsEnabled. type: boolean + x-agent: true image_vector_enabled: description: |- ImageVectorEnabled lets a knowledge base whose embedding model takes @@ -3355,9 +3416,12 @@ definitions: and widens vector recall. Existing knowledge bases stay off after an upgrade because the stored JSON has no such key. type: boolean + x-agent: true model_id: - description: Model ID + description: Model ID used when describing images. Empty uses the knowledge + base's caption model. type: string + x-agent: image_model_id type: object github_com_Tencent_WeKnora_internal_types.IndexConfig: properties: @@ -3763,19 +3827,26 @@ definitions: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ASRConfig' description: ASR config (Automatic Speech Recognition) + x-agent: true + x-agent-detail: true auto_tag_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.AutoTagConfig' description: AutoTagConfig controls asynchronous association of existing tags after parsing. + x-agent: true + x-agent-detail: true chunk_count: description: Chunk count (not stored in database, calculated on query) type: integer x-agent: true + x-agent-response: true chunking_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ChunkingConfig' description: Chunking configuration + x-agent: true + x-agent-detail: true created_at: description: Creation time of the knowledge base type: string @@ -3802,17 +3873,23 @@ definitions: type: string x-agent: true embedding_model_id: - description: ID of the embedding model + description: ID of the embedding model. model.list returns the ids. Cannot + change after the knowledge base has documents. type: string + x-agent: embedding_model_id extract_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ExtractConfig' description: Extract config + x-agent: true + x-agent-detail: true faq_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQConfig' description: FAQConfig stores FAQ specific configuration such as indexing strategy + x-agent: true + x-agent-detail: true generated_profile: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBaseProfile' @@ -3824,10 +3901,13 @@ definitions: description: Unique identifier of the knowledge base type: string x-agent: knowledge_base_id + x-agent-response: true image_processing_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ImageProcessingConfig' description: Image processing configuration + x-agent: true + x-agent-detail: true indexing_strategy: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.IndexingStrategy' @@ -3835,6 +3915,7 @@ definitions: IndexingStrategy controls which indexing pipelines are active for this knowledge base. Pipelines: vector search, keyword search, wiki generation, knowledge graph extraction. x-agent: true + x-agent-response: true is_pinned: description: |- IsPinned and PinnedAt are computed per-caller from user_kb_pins @@ -3851,6 +3932,7 @@ definitions: FAQ type knowledge bases) type: boolean x-agent: true + x-agent-response: true is_temporary: description: Whether this knowledge base is temporary (ephemeral) and should be hidden from UI @@ -3859,10 +3941,12 @@ definitions: description: Knowledge count (not stored in database, calculated on query) type: integer x-agent: true + x-agent-response: true name: description: Name of the knowledge base type: string x-agent: true + x-agent-required: true pinned_at: description: |- PinnedAt records when the current caller pinned this knowledge @@ -3873,17 +3957,22 @@ definitions: processed (for document type knowledge bases) type: integer x-agent: true + x-agent-response: true profile_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBaseProfileConfig' description: |- ProfileConfig controls automatic generation of the knowledge-base description from per-document profiles (document knowledge bases only). + x-agent: true + x-agent-detail: true question_generation_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig' description: QuestionGenerationConfig stores question generation configuration for document knowledge bases + x-agent: true + x-agent-detail: true share_count: description: ShareCount indicates the number of organizations this knowledge base is shared with (not stored in database) @@ -3893,6 +3982,7 @@ definitions: StorageBackendID binds this KB to one concrete storage instance. The legacy provider field remains readable during migration only. type: string + x-agent: storage_backend_id storage_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.StorageConfig' @@ -3904,19 +3994,27 @@ definitions: description: 'Storage provider config (new): only stores provider selection; credentials from workspace StorageEngineConfig' summary_model_id: - description: Summary model ID + description: Summary model ID. model.list returns the ids. Used for summaries, + and as the default for auto-tagging and the AI description. type: string + x-agent: summary_model_id tenant_id: description: Workspace ID type: integer type: - description: Type of the knowledge base (document, faq, etc.) + description: 'Type of the knowledge base: document, faq or wiki. Empty means + document.' + enum: + - document + - faq + - wiki type: string x-agent: true updated_at: description: Last updated time of the knowledge base type: string x-agent: true + x-agent-response: true vector_store_id: description: |- VectorStoreID references the VectorStore this knowledge base is bound to. @@ -3926,18 +4024,30 @@ definitions: enforcement lives at the GORM layer (`<-:create`) plus the service-layer KB update path, which omits this field from its update DTO. type: string + x-agent: vector_store_id vlm_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.VLMConfig' description: VLM config + x-agent: true + x-agent-detail: true wiki_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiConfig' description: WikiConfig stores wiki-specific configuration (only for wiki type knowledge bases) + x-agent: true + x-agent-detail: true + required: + - name type: object github_com_Tencent_WeKnora_internal_types.KnowledgeBaseConfig: properties: + asr_config: + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ASRConfig' + description: ASRConfig replaces speech-recognition settings when set. nil + means no change. auto_tag_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.AutoTagConfig' @@ -3947,6 +4057,16 @@ definitions: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ChunkingConfig' description: Chunking configuration + embedding_model_id: + description: |- + EmbeddingModelID changes the embedding model. nil means no change. + A knowledge base that already has documents cannot switch models. + type: string + extract_config: + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ExtractConfig' + description: ExtractConfig replaces graph extraction settings when set. nil + means no change. faq_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQConfig' @@ -3975,6 +4095,17 @@ definitions: description: |- ProfileConfig controls optional automatic knowledge-base description generation. nil means "no change" when updating. + question_generation_config: + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig' + description: QuestionGenerationConfig replaces generated-question settings + when set. nil means no change. + storage_backend_id: + description: StorageBackendID rebinds file storage. nil means no change. + type: string + summary_model_id: + description: SummaryModelID changes the summary model. nil means no change. + type: string wiki_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiConfig' @@ -4026,16 +4157,20 @@ definitions: github_com_Tencent_WeKnora_internal_types.KnowledgeBaseProfileConfig: properties: custom_instructions: - description: |- - CustomInstructions is appended to the stable system prompt, e.g. the - audience the description should address or terms to keep. + description: CustomInstructions is extra guidance for the description, such + as the audience. The format stays fixed. type: string + x-agent: profile_instructions + x-agent-detail: true + x-agent-max-bytes: "4000" enabled: + description: Enabled turns the AI knowledge-base description on. type: boolean + x-agent: profile_enabled model_id: - description: ModelID overrides the chat model; empty falls back to the KB - summary model. + description: ModelID overrides the summary model. Empty uses summary_model_id. type: string + x-agent: profile_model_id type: object github_com_Tencent_WeKnora_internal_types.KnowledgeBaseProfileStats: properties: @@ -4687,6 +4822,7 @@ definitions: type: string x-agent: true x-agent-max-bytes: "800000" + x-agent-required: true process_config: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeProcessOverrides' status: @@ -4696,6 +4832,7 @@ definitions: - publish type: string x-agent: true + x-agent-required: true tag_ids: items: type: string @@ -6074,16 +6211,24 @@ definitions: github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig: properties: custom_instructions: - description: |- - CustomInstructions describes the intended audience or question style. - It is appended to the stable system question-generation template. + description: CustomInstructions describes who the questions are for. The question + format stays fixed. type: string + x-agent: question_instructions + x-agent-detail: true + x-agent-max-bytes: "4000" enabled: + description: Enabled turns question generation on. Generated questions are + indexed beside the chunk. type: boolean + x-agent: question_generation_enabled question_count: - description: 'Number of questions to generate per chunk (default: 3, max: - 10)' + description: QuestionCount is how many questions to write per chunk, from + 1 to 10. + maximum: 10 + minimum: 1 type: integer + x-agent: question_count type: object github_com_Tencent_WeKnora_internal_types.QuestionOrigin: properties: @@ -8002,22 +8147,28 @@ definitions: description: Base URL type: string custom_instructions: - description: |- - CustomInstructions adds KB-specific image interpretation guidance without - replacing the system-owned OCR and Markdown output contract. + description: CustomInstructions adds image-reading guidance. The OCR and Markdown + format stay fixed. type: string + x-agent: vlm_instructions + x-agent-detail: true + x-agent-max-bytes: "4000" description_language: - description: |- - DescriptionLanguage controls the language used for generated image - captions. Empty means follow the document/request language. + description: DescriptionLanguage is the language of generated image captions. + Empty follows the document language. type: string + x-agent: vlm_language enabled: + description: Enabled turns image captions on. Also send vlm_model_id. type: boolean + x-agent: vlm_enabled interface_type: description: 'Interface Type: "ollama" or "openai"' type: string model_id: + description: Model that writes image captions. model.list returns the ids. type: string + x-agent: vlm_model_id model_name: description: |- 兼容老版本 @@ -8373,21 +8524,29 @@ definitions: github_com_Tencent_WeKnora_internal_types.WikiConfig: properties: content_instructions: - description: |- - ContentInstructions controls tone, structure and emphasis for generated - summary/entity/index prose. Citation and merge rules remain system-owned. + description: ContentInstructions sets tone and emphasis for generated Wiki + prose. Citations stay fixed. type: string + x-agent: wiki_content_instructions + x-agent-detail: true + x-agent-max-bytes: "4000" extraction_granularity: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiExtractionGranularity' - description: |- - ExtractionGranularity controls how many candidate slugs Pass 0 extracts - per document. Empty / unknown value is treated as WikiExtractionStandard. + description: ExtractionGranularity is focused, standard or exhaustive. Empty + means standard. + enum: + - focused + - standard + - exhaustive + x-agent: wiki_granularity extraction_instructions: - description: |- - ExtractionInstructions tells candidate extraction which domain concepts - to emphasize without replacing the stable JSON/citation protocol. + description: ExtractionInstructions tells page extraction which concepts to + keep. The output format stays fixed. type: string + x-agent: wiki_extraction_instructions + x-agent-detail: true + x-agent-max-bytes: "4000" ingest_batch_size: description: |- IngestBatchSize controls how many pending ops a single batch claims and @@ -8422,13 +8581,17 @@ definitions: DB connection pool size. Same multiplier caveat as IngestMapParallel. type: integer max_pages_per_ingest: - description: MaxPagesPerIngest limits pages created/updated per ingest operation - (0 = no limit) + description: MaxPagesPerIngest limits pages created or updated per ingest. + 0 means no limit. + maximum: 1000 + minimum: 0 type: integer + x-agent: wiki_max_pages synthesis_model_id: - description: SynthesisModelID is the LLM model ID used for wiki page generation - and updates + description: SynthesisModelID is the model that writes Wiki pages. Empty uses + summary_model_id. type: string + x-agent: wiki_synthesis_model_id type: object github_com_Tencent_WeKnora_internal_types.WikiExtractionGranularity: enum: @@ -9337,6 +9500,19 @@ definitions: user: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.UserInfo' type: object + internal_handler.CreateTagRequest: + properties: + color: + type: string + name: + description: Tag name, unique in this knowledge base + type: string + x-agent: true + sort_order: + type: integer + required: + - name + type: object internal_handler.CurrentUserCapabilities: properties: auto_accept_invitation: @@ -9851,21 +10027,28 @@ definitions: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ASRConfig' description: ASR config (Automatic Speech Recognition) + x-agent: true + x-agent-detail: true auto_tag_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.AutoTagConfig' description: AutoTagConfig controls asynchronous association of existing tags after parsing. + x-agent: true + x-agent-detail: true capabilities: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.KBCapabilities' chunk_count: description: Chunk count (not stored in database, calculated on query) type: integer x-agent: true + x-agent-response: true chunking_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ChunkingConfig' description: Chunking configuration + x-agent: true + x-agent-detail: true created_at: description: Creation time of the knowledge base type: string @@ -9892,17 +10075,23 @@ definitions: type: string x-agent: true embedding_model_id: - description: ID of the embedding model + description: ID of the embedding model. model.list returns the ids. Cannot + change after the knowledge base has documents. type: string + x-agent: embedding_model_id extract_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ExtractConfig' description: Extract config + x-agent: true + x-agent-detail: true faq_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQConfig' description: FAQConfig stores FAQ specific configuration such as indexing strategy + x-agent: true + x-agent-detail: true generated_profile: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBaseProfile' @@ -9914,10 +10103,13 @@ definitions: description: Unique identifier of the knowledge base type: string x-agent: knowledge_base_id + x-agent-response: true image_processing_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ImageProcessingConfig' description: Image processing configuration + x-agent: true + x-agent-detail: true indexing_strategy: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.IndexingStrategy' @@ -9925,6 +10117,7 @@ definitions: IndexingStrategy controls which indexing pipelines are active for this knowledge base. Pipelines: vector search, keyword search, wiki generation, knowledge graph extraction. x-agent: true + x-agent-response: true is_pinned: description: |- IsPinned and PinnedAt are computed per-caller from user_kb_pins @@ -9941,6 +10134,7 @@ definitions: FAQ type knowledge bases) type: boolean x-agent: true + x-agent-response: true is_temporary: description: Whether this knowledge base is temporary (ephemeral) and should be hidden from UI @@ -9949,6 +10143,7 @@ definitions: description: Knowledge count (not stored in database, calculated on query) type: integer x-agent: true + x-agent-response: true my_permission: description: |- MyPermission is the caller's role on a knowledge base shared from @@ -9963,6 +10158,7 @@ definitions: description: Name of the knowledge base type: string x-agent: true + x-agent-required: true pinned_at: description: |- PinnedAt records when the current caller pinned this knowledge @@ -9973,17 +10169,22 @@ definitions: processed (for document type knowledge bases) type: integer x-agent: true + x-agent-response: true profile_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBaseProfileConfig' description: |- ProfileConfig controls automatic generation of the knowledge-base description from per-document profiles (document knowledge bases only). + x-agent: true + x-agent-detail: true question_generation_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig' description: QuestionGenerationConfig stores question generation configuration for document knowledge bases + x-agent: true + x-agent-detail: true share_count: description: ShareCount indicates the number of organizations this knowledge base is shared with (not stored in database) @@ -9993,6 +10194,7 @@ definitions: StorageBackendID binds this KB to one concrete storage instance. The legacy provider field remains readable during migration only. type: string + x-agent: storage_backend_id storage_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.StorageConfig' @@ -10004,19 +10206,27 @@ definitions: description: 'Storage provider config (new): only stores provider selection; credentials from workspace StorageEngineConfig' summary_model_id: - description: Summary model ID + description: Summary model ID. model.list returns the ids. Used for summaries, + and as the default for auto-tagging and the AI description. type: string + x-agent: summary_model_id tenant_id: description: Workspace ID type: integer type: - description: Type of the knowledge base (document, faq, etc.) + description: 'Type of the knowledge base: document, faq or wiki. Empty means + document.' + enum: + - document + - faq + - wiki type: string x-agent: true updated_at: description: Last updated time of the knowledge base type: string x-agent: true + x-agent-response: true vector_store_engine_type: type: string vector_store_id: @@ -10028,6 +10238,7 @@ definitions: enforcement lives at the GORM layer (`<-:create`) plus the service-layer KB update path, which omits this field from its update DTO. type: string + x-agent: vector_store_id vector_store_name: type: string vector_store_source: @@ -10038,11 +10249,17 @@ definitions: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.VLMConfig' description: VLM config + x-agent: true + x-agent-detail: true wiki_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiConfig' description: WikiConfig stores wiki-specific configuration (only for wiki type knowledge bases) + x-agent: true + x-agent-detail: true + required: + - name type: object internal_handler.KnowledgeSearchKnowledgeResponse: properties: @@ -10116,6 +10333,38 @@ definitions: trace: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.SpanTreeNode' type: object + internal_handler.KnowledgeTagBatchRequest: + properties: + kb_id: + description: Knowledge base the documents belong to. + type: string + x-agent: knowledge_base_id + x-agent-required: true + knowledge_ids: + description: Documents that receive the same tags. Mutually exclusive with + updates. + items: + type: string + type: array + x-agent: true + x-agent-maximum: "20" + x-agent-required: true + tag_ids: + description: Tags to set on every listed document. An empty list clears them. + items: + type: string + type: array + x-agent: true + x-agent-maximum: "50" + x-agent-required: true + updates: + additionalProperties: + items: + type: string + type: array + description: Map of knowledge id to the tag ids that replace its current tags. + type: object + type: object internal_handler.ListAgentsResponse: properties: data: @@ -10596,6 +10845,73 @@ definitions: type: boolean x-agent: true type: object + internal_handler.PatchKnowledgeBaseRequest: + properties: + asr_config: + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ASRConfig' + description: Speech transcription. + auto_tag_config: + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.AutoTagConfig' + description: Automatic tagging. + chunking_config: + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ChunkingConfig' + description: Chunking settings. Only the fields present are changed. + description: + description: New description. Omit to keep it; an empty string clears it. + type: string + x-agent: true + embedding_model_id: + description: Embedding model. Cannot change after the knowledge base has documents. + type: string + x-agent: embedding_model_id + extract_config: + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ExtractConfig' + description: Graph extraction. Node types stay in the knowledge base editor. + faq_config: + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FAQConfig' + description: FAQ indexing. Only for an FAQ knowledge base. + image_processing_config: + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ImageProcessingConfig' + description: Image description settings. + indexing_strategy: + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.IndexingStrategy' + description: Indexing pipelines. A flag left out stays as it is. + name: + description: New name. Omit to keep the current one. + type: string + x-agent: true + profile_config: + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeBaseProfileConfig' + description: AI description of the knowledge base. + question_generation_config: + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig' + description: Generated questions for each chunk. + storage_backend_id: + description: Storage instance to bind. Omit to keep the current one. + type: string + x-agent: storage_backend_id + summary_model_id: + description: Summary model. model.list returns the ids. + type: string + x-agent: summary_model_id + vlm_config: + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.VLMConfig' + description: Image captions. + wiki_config: + allOf: + - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WikiConfig' + description: Wiki page settings. + type: object internal_handler.PlaceholderGroups: properties: agent_system_prompt: @@ -11389,6 +11705,17 @@ definitions: etc. by the JSON unmarshaller). Service.encodeForType normalises these against the registry's declared type and rejects mismatches. type: object + internal_handler.UpdateTagRequest: + properties: + color: + type: string + name: + description: New name. Omit to keep the current one. + type: string + x-agent: true + sort_order: + type: integer + type: object internal_handler.ValidateTokenResponse: properties: message: @@ -14991,6 +15318,14 @@ paths: summary: 创建知识库 tags: - 知识库 + x-agent: + id: knowledge_base.create + label_param: name + risk: write + x-agent-hint: Creates a knowledge base owned by the user. Omit type for document. + Omit indexing flags for vector and keyword search. Set embedding_model_id + and summary_model_id from model.list. vector_store_id can be chosen only now. + A field you leave out keeps its default. /knowledge-bases/{id}: delete: consumes: @@ -15002,6 +15337,7 @@ paths: name: id required: true type: string + x-agent: knowledge_base_id produces: - application/json responses: @@ -15027,6 +15363,13 @@ paths: summary: 删除知识库 tags: - 知识库 + x-agent: + id: knowledge_base.delete + label: name + risk: destructive + target: knowledge_base.get + x-agent-hint: Deletes the knowledge base and every document in it. Cannot be + undone. Only the owner can delete it. get: consumes: - application/json @@ -15077,6 +15420,62 @@ paths: risk: read x-agent-hint: Check which indexes are enabled (vector, keyword, Wiki, graph) and whether documents are processing. + patch: + consumes: + - application/json + description: 修改请求里出现的设置。未出现的字段保持不变,包括分块、索引和模型里没写到的项。 + parameters: + - description: 知识库ID + in: path + name: id + required: true + type: string + x-agent: knowledge_base_id + - description: 要修改的字段 + in: body + name: request + required: true + schema: + $ref: '#/definitions/internal_handler.PatchKnowledgeBaseRequest' + produces: + - application/json + responses: + "200": + description: 更新后的知识库 + schema: + allOf: + - $ref: '#/definitions/internal_handler.DataResponse' + - properties: + data: + $ref: '#/definitions/internal_handler.KnowledgeBaseView' + type: object + "400": + description: 请求参数错误 + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' + "403": + description: 无权限 + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' + "404": + description: 知识库不存在 + schema: + $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' + security: + - Bearer: [] + - ApiKeyAuth: [] + summary: 部分更新知识库 + tags: + - 知识库 + x-agent: + id: knowledge_base.update + label: name + risk: write + target: knowledge_base.get + x-agent-hint: Changes the settings you send; a field left out is kept, including + one indexing flag or one chunking field. Model ids come from model.list. embedding_model_id + cannot change after documents exist. vector_store_id cannot be changed. Graph + node types stay in the knowledge base editor. put: consumes: - application/json @@ -16426,8 +16825,8 @@ paths: label: name risk: write target: knowledge_base.get - x-agent-hint: Creates a Markdown document. status=draft (the default) keeps - it out of search; publish indexes it. + x-agent-hint: Creates a Markdown document. Send the full content, and status + draft to keep it out of search or publish to index it. /knowledge-bases/{id}/knowledge/url: post: consumes: @@ -16814,19 +17213,13 @@ paths: name: id required: true type: string + x-agent: knowledge_base_id - description: 标签信息 in: body name: request required: true schema: - properties: - color: - type: string - name: - type: string - sort_order: - type: integer - type: object + $ref: '#/definitions/internal_handler.CreateTagRequest' produces: - application/json responses: @@ -16849,6 +17242,13 @@ paths: summary: 创建标签 tags: - 标签管理 + x-agent: + id: knowledge_base.create_tag + label: name + risk: write + target: knowledge_base.get + x-agent-hint: Creates a tag in the knowledge base. Pass the returned tag id + to knowledge.set_tags. /knowledge-bases/{id}/tags/{tag_id}: delete: consumes: @@ -16860,11 +17260,13 @@ paths: name: id required: true type: string + x-agent: knowledge_base_id - description: 标签ID (UUID或seq_id) in: path name: tag_id required: true type: string + x-agent: tag_id - description: 强制删除 in: query name: force @@ -16895,6 +17297,14 @@ paths: summary: 删除标签 tags: - 标签管理 + x-agent: + id: knowledge_base.delete_tag + label: name + risk: destructive + target: knowledge_base.get + x-agent-hint: Deletes a tag that no document uses. If documents still use it, + this fails; take the tag off them with knowledge.set_tags first. Documents + are not deleted. put: consumes: - application/json @@ -16905,17 +17315,19 @@ paths: name: id required: true type: string + x-agent: knowledge_base_id - description: 标签ID (UUID或seq_id) in: path name: tag_id required: true type: string + x-agent: tag_id - description: 标签更新信息 in: body name: request required: true schema: - type: object + $ref: '#/definitions/internal_handler.UpdateTagRequest' produces: - application/json responses: @@ -16938,6 +17350,13 @@ paths: summary: 更新标签 tags: - 标签管理 + x-agent: + id: knowledge_base.update_tag + label: name + risk: write + target: knowledge_base.get + x-agent-hint: Renames a tag. tag_id comes from knowledge_base.list_tags. A field + left out is kept. /knowledge-bases/copy: post: consumes: @@ -17675,6 +18094,7 @@ paths: name: id required: true type: string + x-agent: knowledge_id - description: 手工知识内容 in: body name: request @@ -17703,6 +18123,14 @@ paths: summary: 更新手工知识 tags: - 知识管理 + x-agent: + id: knowledge.update_manual + label: title + risk: write + target: knowledge.get + x-agent-hint: Replaces the whole Markdown of a document created as manual knowledge. + Send the complete content, not a diff. status draft keeps it out of search; + publish indexes it. Uploaded files cannot be edited this way. /knowledge/move: post: consumes: @@ -17841,14 +18269,14 @@ paths: put: consumes: - application/json - description: 批量更新知识条目的标签。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的空间解析 + description: 批量更新知识条目的标签。传 updates,或传 knowledge_ids 与 tag_ids。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的空间解析 parameters: - - description: 标签更新请求(updates 必填,kb_id 可选) + - description: 标签更新请求 in: body name: request required: true schema: - type: object + $ref: '#/definitions/internal_handler.KnowledgeTagBatchRequest' produces: - application/json responses: @@ -17866,6 +18294,19 @@ paths: summary: 批量更新知识标签 tags: - 知识管理 + x-agent: + id: knowledge.set_tags + items: + as: knowledge_id + label: title + param: knowledge_ids + target: knowledge.get + label: name + risk: write + target: knowledge_base.get + x-agent-hint: Sets the same tags on up to 20 documents in one knowledge base, + replacing the tags they have now. tag_ids come from knowledge_base.list_tags; + an empty tag_ids clears every tag. It does not delete documents. /knowledgebase/{kb_id}/wiki/auto-fix: post: description: Automatically fix fixable wiki issues (broken links, etc.) diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index 144a50c4..2727fd00 100755 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -6396,7 +6396,47 @@ export default { invalidJson: 'Arguments must be valid JSON', submitted: 'Submitted', submitFailed: 'Submit failed', - userRejected: 'User rejected' + userRejected: 'User rejected', + detail: { + type: 'Type', + embeddingModel: 'Embedding model', + summaryModel: 'Summary model', + captionModel: 'Caption model', + speechModel: 'Speech model', + storage: 'Storage', + indexes: 'Indexes', + name: 'Name', + title: 'Title', + status: 'Status', + summary: 'Summary', + model: 'Model', + mode: 'Mode', + url: 'URL', + from: 'From', + to: 'To', + folder: 'Folder', + page: 'Page', + version: 'Version', + documents: 'Documents', + knowledgeBases: 'Knowledge bases', + mcpServices: 'MCP services', + skills: 'Skills', + webSearch: 'Web search', + multiTurn: 'Multi-turn conversation' + }, + value: { + document: 'Document', + faq: 'FAQ', + wiki: 'Wiki', + on: 'On', + off: 'Off', + vector: 'Vector', + keyword: 'Keyword', + graph: 'Graph', + quickAnswer: 'Quick answer', + smartReasoning: 'Smart reasoning', + indexSep: ', ' + } }, mcpOAuth: { waiting: 'Awaiting authorization · {target}', diff --git a/frontend/src/i18n/locales/ja-JP.ts b/frontend/src/i18n/locales/ja-JP.ts index 39c5d000..48fe073a 100644 --- a/frontend/src/i18n/locales/ja-JP.ts +++ b/frontend/src/i18n/locales/ja-JP.ts @@ -6396,7 +6396,47 @@ export default { invalidJson: '引数は有効なJSONである必要があります', submitted: '送信しました', submitFailed: '送信に失敗しました', - userRejected: 'ユーザが拒否しました' + userRejected: 'ユーザが拒否しました', + detail: { + type: '種類', + embeddingModel: '埋め込みモデル', + summaryModel: '要約モデル', + captionModel: '画像説明', + speechModel: '音声認識', + storage: 'ストレージ', + indexes: 'インデックス', + name: '名前', + title: 'タイトル', + status: '状態', + summary: '説明', + model: 'モデル', + mode: 'モード', + url: 'リンク', + from: '移動元', + to: '移動先', + folder: 'フォルダ', + page: 'ページ', + version: 'バージョン', + documents: 'ドキュメント', + knowledgeBases: 'ナレッジベース', + mcpServices: 'MCP サービス', + skills: 'スキル', + webSearch: 'ウェブ検索', + multiTurn: 'マルチターン' + }, + value: { + document: 'ドキュメント', + faq: 'FAQ', + wiki: 'Wiki', + on: 'オン', + off: 'オフ', + vector: 'ベクトル', + keyword: 'キーワード', + graph: 'グラフ', + quickAnswer: 'クイック回答', + smartReasoning: 'スマート推論', + indexSep: '、' + } }, mcpOAuth: { waiting: '認可待ち · {target}', diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts index 25278309..8ff116a0 100755 --- a/frontend/src/i18n/locales/ko-KR.ts +++ b/frontend/src/i18n/locales/ko-KR.ts @@ -1967,7 +1967,47 @@ export default { invalidJson: '유효한 JSON이 아닙니다', submitted: '제출됨', submitFailed: '제출 실패', - userRejected: '사용자 거부' + userRejected: '사용자 거부', + detail: { + type: '유형', + embeddingModel: '임베딩 모델', + summaryModel: '요약 모델', + captionModel: '이미지 설명', + speechModel: '음성 인식', + storage: '스토리지', + indexes: '인덱스', + name: '이름', + title: '제목', + status: '상태', + summary: '설명', + model: '모델', + mode: '모드', + url: '링크', + from: '출발', + to: '도착', + folder: '폴더', + page: '페이지', + version: '버전', + documents: '문서', + knowledgeBases: '지식베이스', + mcpServices: 'MCP 서비스', + skills: '스킬', + webSearch: '웹 검색', + multiTurn: '멀티턴' + }, + value: { + document: '문서', + faq: 'FAQ', + wiki: 'Wiki', + on: '켜짐', + off: '꺼짐', + vector: '벡터', + keyword: '키워드', + graph: '그래프', + quickAnswer: '빠른 답변', + smartReasoning: '스마트 추론', + indexSep: ', ' + } } }, kbSettings: { diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts index c7b416f6..9608ff93 100755 --- a/frontend/src/i18n/locales/ru-RU.ts +++ b/frontend/src/i18n/locales/ru-RU.ts @@ -1967,7 +1967,47 @@ export default { invalidJson: 'Некорректный JSON', submitted: 'Отправлено', submitFailed: 'Ошибка отправки', - userRejected: 'Отклонено пользователем' + userRejected: 'Отклонено пользователем', + detail: { + type: 'Тип', + embeddingModel: 'Модель эмбеддинга', + summaryModel: 'Модель сводки', + captionModel: 'Описание изображений', + speechModel: 'Распознавание речи', + storage: 'Хранилище', + indexes: 'Индексы', + name: 'Название', + title: 'Заголовок', + status: 'Статус', + summary: 'Описание', + model: 'Модель', + mode: 'Режим', + url: 'Ссылка', + from: 'Откуда', + to: 'Куда', + folder: 'Папка', + page: 'Страница', + version: 'Версия', + documents: 'Документы', + knowledgeBases: 'Базы знаний', + mcpServices: 'Сервисы MCP', + skills: 'Навыки', + webSearch: 'Веб-поиск', + multiTurn: 'Многоходовой диалог' + }, + value: { + document: 'Документ', + faq: 'FAQ', + wiki: 'Wiki', + on: 'вкл', + off: 'выкл', + vector: 'Вектор', + keyword: 'Ключевые слова', + graph: 'Граф', + quickAnswer: 'Быстрый ответ', + smartReasoning: 'Умное рассуждение', + indexSep: ', ' + } } }, kbSettings: { diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index 547e846f..384d5220 100755 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -1969,7 +1969,47 @@ export default { invalidJson: '参数不是合法 JSON', submitted: '已提交', submitFailed: '提交失败', - userRejected: '用户拒绝' + userRejected: '用户拒绝', + detail: { + type: '类型', + embeddingModel: '嵌入模型', + summaryModel: '摘要模型', + captionModel: '图片描述', + speechModel: '语音识别', + storage: '存储', + indexes: '索引', + name: '名称', + title: '标题', + status: '状态', + summary: '简介', + model: '模型', + mode: '模式', + url: '链接', + from: '从', + to: '到', + folder: '目录', + page: '页面', + version: '版本', + documents: '文档', + knowledgeBases: '知识库', + mcpServices: 'MCP 服务', + skills: '技能', + webSearch: '联网搜索', + multiTurn: '多轮对话' + }, + value: { + document: '文档', + faq: '问答', + wiki: 'Wiki', + on: '开', + off: '关', + vector: '向量', + keyword: '关键词', + graph: '图谱', + quickAnswer: '快速问答', + smartReasoning: '智能推理', + indexSep: '、' + } } }, kbSettings: { diff --git a/frontend/src/i18n/locales/zh-TW.ts b/frontend/src/i18n/locales/zh-TW.ts index 150fc273..d8c5875b 100644 --- a/frontend/src/i18n/locales/zh-TW.ts +++ b/frontend/src/i18n/locales/zh-TW.ts @@ -1969,7 +1969,47 @@ export default { invalidJson: '參數不是合法 JSON', submitted: '已提交', submitFailed: '提交失敗', - userRejected: '使用者拒絕' + userRejected: '使用者拒絕', + detail: { + type: '類型', + embeddingModel: '嵌入模型', + summaryModel: '摘要模型', + captionModel: '圖片描述', + speechModel: '語音識別', + storage: '儲存', + indexes: '索引', + name: '名稱', + title: '標題', + status: '狀態', + summary: '簡介', + model: '模型', + mode: '模式', + url: '連結', + from: '從', + to: '到', + folder: '目錄', + page: '頁面', + version: '版本', + documents: '文件', + knowledgeBases: '知識庫', + mcpServices: 'MCP 服務', + skills: '技能', + webSearch: '聯網搜尋', + multiTurn: '多輪對話' + }, + value: { + document: '文件', + faq: '問答', + wiki: 'Wiki', + on: '開', + off: '關', + vector: '向量', + keyword: '關鍵詞', + graph: '圖譜', + quickAnswer: '快速問答', + smartReasoning: '智能推理', + indexSep: '、' + } } }, kbSettings: { diff --git a/frontend/src/views/chat/components/ToolApprovalCard.description.test.mjs b/frontend/src/views/chat/components/ToolApprovalCard.description.test.mjs index 0fd1d6bc..16e5faca 100644 --- a/frontend/src/views/chat/components/ToolApprovalCard.description.test.mjs +++ b/frontend/src/views/chat/components/ToolApprovalCard.description.test.mjs @@ -15,12 +15,12 @@ const parse = description => JSON.parse(JSON.stringify(runInNewContext( test('batch approval retains every title in the separate item list', () => { const titles = Array.from({ length: 20 }, (_, i) => `Document ${i + 1}`) const description = ['Delete documents', 'Finance', ...titles.map(title => '- ' + title)].join('\n') - assert.deepEqual(parse(description), { head: 'Delete documents\nFinance', items: titles }) + assert.deepEqual(parse(description), { head: 'Delete documents\nFinance', fields: [], items: titles }) }) test('legacy multiline titles remain readable through the scrollable fallback', () => { const description = 'Delete documents\nFinance\n- First\ncontinued title\n- Last document' - assert.deepEqual(parse(description), { head: description, items: [] }) + assert.deepEqual(parse(description), { head: description, fields: [], items: [] }) assert.match(source, /class="prompt-desc">\{\{ descriptionParts\.head \}\}/) const fallback = styles.match(/\.prompt-desc \{([\s\S]*?)\n\}/)?.[1] assert.ok(fallback) @@ -28,3 +28,26 @@ test('legacy multiline titles remain readable through the scrollable fallback', assert.match(fallback, /overflow-y:\s*auto/) assert.doesNotMatch(fallback, /line-clamp|overflow:\s*hidden/) }) + +test('setting lines render as labeled fields and the title stays the headline', () => { + const description = [ + '创建知识库', + '助手测试', + 'Type: document', + 'Embedding model: builtin-embedding', + 'Summary model: Qwen', + 'Indexes: wiki on', + ].join('\n') + assert.deepEqual(parse(description), { + head: '创建知识库\n助手测试', + fields: [ + { label: 'Type', value: 'document' }, + { label: 'Embedding model', value: 'builtin-embedding' }, + { label: 'Summary model', value: 'Qwen' }, + { label: 'Indexes', value: 'wiki on' }, + ], + items: [], + }) + assert.match(source, /class="prompt-fields"/) + assert.match(styles, /\.prompt-fields \{/) +}) diff --git a/frontend/src/views/chat/components/ToolApprovalCard.vue b/frontend/src/views/chat/components/ToolApprovalCard.vue index 3e433f74..92ad3182 100644 --- a/frontend/src/views/chat/components/ToolApprovalCard.vue +++ b/frontend/src/views/chat/components/ToolApprovalCard.vue @@ -2,6 +2,12 @@