feat(knowledge-base): document list filters and explicit batch-management UX
Add three new optional filters to the document list under a knowledge base detail page — parse status, source/channel, and updated time range — and rework multi-select to no longer cause the card title to jitter on hover. Backend - Introduce types.KnowledgeListFilter to aggregate optional filter dimensions (tag, keyword, file_type, parse_status, source, updated_from/to) and switch ListPagedKnowledgeByKnowledgeBaseID (repository/service/interface) to accept it instead of a growing positional parameter list. - The ListKnowledge HTTP handler accepts new parse_status, source, start_time and end_time query params; time params accept RFC3339, "YYYY-MM-DD HH:MM:SS" and "YYYY-MM-DD". The repository routes source="manual"/"url" onto the type column to stay consistent with file_type semantics; other source values match the channel column. - Update the four other callers (agent_service, initialization) to pass an empty filter struct, preserving prior behavior. Frontend - Add three controls in the doc-filter-bar (status select, source select, date-range picker with future-date disabled) wired through getKnowled / listKnowledgeFiles into the new backend params. - Replace the hover-triggered card checkbox with an explicit "批量管理" mode (mirrors the session list UX): in card view the checkbox only renders while batch mode is on, entered via the per-card "..." menu; the list view keeps its leading checkbox column. Switching from list to grid auto-enables batch mode when something is already selected, so the selection stays visible. - DocumentBatchBar now stays open whenever batch mode or selection > 0, and its "取消选择" button both clears the selection and exits batch mode. API surface sync - Regenerate Swagger artifacts (docs/docs.go / swagger.json / swagger.yaml). - Update docs/api/knowledge.md with the new query parameters. - Add backward-compatible ListKnowledgeWithFilter + KnowledgeListFilter to the Go SDK; the existing ListKnowledge keeps its signature. i18n - New filter labels in zh-CN / en-US / ko-KR / ru-RU; reuse existing menu.batchManage / batchManage.cancel for the multi-select strings.
This commit is contained in:
+11
-7
@@ -258,13 +258,17 @@ curl --location 'http://localhost:8080/api/v1/knowledge-bases/kb-00000001/knowle
|
||||
|
||||
**查询参数**:
|
||||
|
||||
| 字段 | 类型 | 默认 | 说明 |
|
||||
| ----------- | ------- | ---- | ----------------------------------- |
|
||||
| `page` | integer | 1 | 页码(从 1 开始) |
|
||||
| `page_size` | integer | 20 | 每页条数 |
|
||||
| `tag_id` | string | - | 按标签 ID 过滤 |
|
||||
| `keyword` | string | - | 按标题/内容关键词过滤 |
|
||||
| `file_type` | string | - | 按单个文件扩展名过滤(如 `pdf`) |
|
||||
| 字段 | 类型 | 默认 | 说明 |
|
||||
| -------------- | ------- | ---- | --------------------------------------------------------------------------------------------------- |
|
||||
| `page` | integer | 1 | 页码(从 1 开始) |
|
||||
| `page_size` | integer | 20 | 每页条数 |
|
||||
| `tag_id` | string | - | 按标签 ID 过滤 |
|
||||
| `keyword` | string | - | 按标题/内容关键词过滤 |
|
||||
| `file_type` | string | - | 按单个文件扩展名过滤(如 `pdf`);特殊值 `manual` / `url` 命中 `type` 列 |
|
||||
| `parse_status` | string | - | 按解析状态过滤:`pending` / `processing` / `completed` / `failed` |
|
||||
| `source` | string | - | 按来源/渠道过滤:`web` / `api` / `browser_extension` / `feishu` / `notion` / `yuque` / `wechat` 等; 特殊值 `manual` / `url` 命中 `type` 列 |
|
||||
| `start_time` | string | - | 更新时间起点,接受 RFC3339 (`2024-05-01T00:00:00+08:00`) 或 `YYYY-MM-DD HH:MM:SS` / `YYYY-MM-DD` |
|
||||
| `end_time` | string | - | 更新时间终点,格式同 `start_time` |
|
||||
|
||||
**请求**:
|
||||
|
||||
|
||||
+32
-2
@@ -5097,6 +5097,30 @@ const docTemplate = `{
|
||||
"description": "文件类型筛选",
|
||||
"name": "file_type",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "解析状态筛选 (pending/processing/completed/failed)",
|
||||
"name": "parse_status",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "来源/渠道筛选 (web/api/feishu/notion/yuque/wechat/...,或 manual/url 按 type 过滤)",
|
||||
"name": "source",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "更新时间起点,RFC3339 格式",
|
||||
"name": "start_time",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "更新时间终点,RFC3339 格式",
|
||||
"name": "end_time",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -15217,6 +15241,10 @@ const docTemplate = `{
|
||||
"description": "API key for the search provider (encrypted in DB)",
|
||||
"type": "string"
|
||||
},
|
||||
"base_url": {
|
||||
"description": "Base URL for self-hosted search engines (e.g. SearXNG instance URL).\nValidated with utils.ValidateURLForSSRF; private hosts must be added to SSRF_WHITELIST.",
|
||||
"type": "string"
|
||||
},
|
||||
"engine_id": {
|
||||
"description": "Google Custom Search Engine ID (only for Google provider)",
|
||||
"type": "string"
|
||||
@@ -15242,7 +15270,8 @@ const docTemplate = `{
|
||||
"duckduckgo",
|
||||
"tavily",
|
||||
"ollama",
|
||||
"baidu"
|
||||
"baidu",
|
||||
"searxng"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"WebSearchProviderTypeBing",
|
||||
@@ -15250,7 +15279,8 @@ const docTemplate = `{
|
||||
"WebSearchProviderTypeDuckDuckGo",
|
||||
"WebSearchProviderTypeTavily",
|
||||
"WebSearchProviderTypeOllama",
|
||||
"WebSearchProviderTypeBaidu"
|
||||
"WebSearchProviderTypeBaidu",
|
||||
"WebSearchProviderTypeSearxng"
|
||||
]
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.WikiConfig": {
|
||||
|
||||
+32
-2
@@ -5090,6 +5090,30 @@
|
||||
"description": "文件类型筛选",
|
||||
"name": "file_type",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "解析状态筛选 (pending/processing/completed/failed)",
|
||||
"name": "parse_status",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "来源/渠道筛选 (web/api/feishu/notion/yuque/wechat/...,或 manual/url 按 type 过滤)",
|
||||
"name": "source",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "更新时间起点,RFC3339 格式",
|
||||
"name": "start_time",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "更新时间终点,RFC3339 格式",
|
||||
"name": "end_time",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -15210,6 +15234,10 @@
|
||||
"description": "API key for the search provider (encrypted in DB)",
|
||||
"type": "string"
|
||||
},
|
||||
"base_url": {
|
||||
"description": "Base URL for self-hosted search engines (e.g. SearXNG instance URL).\nValidated with utils.ValidateURLForSSRF; private hosts must be added to SSRF_WHITELIST.",
|
||||
"type": "string"
|
||||
},
|
||||
"engine_id": {
|
||||
"description": "Google Custom Search Engine ID (only for Google provider)",
|
||||
"type": "string"
|
||||
@@ -15235,7 +15263,8 @@
|
||||
"duckduckgo",
|
||||
"tavily",
|
||||
"ollama",
|
||||
"baidu"
|
||||
"baidu",
|
||||
"searxng"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"WebSearchProviderTypeBing",
|
||||
@@ -15243,7 +15272,8 @@
|
||||
"WebSearchProviderTypeDuckDuckGo",
|
||||
"WebSearchProviderTypeTavily",
|
||||
"WebSearchProviderTypeOllama",
|
||||
"WebSearchProviderTypeBaidu"
|
||||
"WebSearchProviderTypeBaidu",
|
||||
"WebSearchProviderTypeSearxng"
|
||||
]
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.WikiConfig": {
|
||||
|
||||
@@ -2986,6 +2986,11 @@ definitions:
|
||||
api_key:
|
||||
description: API key for the search provider (encrypted in DB)
|
||||
type: string
|
||||
base_url:
|
||||
description: |-
|
||||
Base URL for self-hosted search engines (e.g. SearXNG instance URL).
|
||||
Validated with utils.ValidateURLForSSRF; private hosts must be added to SSRF_WHITELIST.
|
||||
type: string
|
||||
engine_id:
|
||||
description: Google Custom Search Engine ID (only for Google provider)
|
||||
type: string
|
||||
@@ -3008,6 +3013,7 @@ definitions:
|
||||
- tavily
|
||||
- ollama
|
||||
- baidu
|
||||
- searxng
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- WebSearchProviderTypeBing
|
||||
@@ -3016,6 +3022,7 @@ definitions:
|
||||
- WebSearchProviderTypeTavily
|
||||
- WebSearchProviderTypeOllama
|
||||
- WebSearchProviderTypeBaidu
|
||||
- WebSearchProviderTypeSearxng
|
||||
github_com_Tencent_WeKnora_internal_types.WikiConfig:
|
||||
properties:
|
||||
extraction_granularity:
|
||||
@@ -7478,6 +7485,23 @@ paths:
|
||||
in: query
|
||||
name: file_type
|
||||
type: string
|
||||
- description: 解析状态筛选 (pending/processing/completed/failed)
|
||||
in: query
|
||||
name: parse_status
|
||||
type: string
|
||||
- description: 来源/渠道筛选 (web/api/feishu/notion/yuque/wechat/...,或 manual/url
|
||||
按 type 过滤)
|
||||
in: query
|
||||
name: source
|
||||
type: string
|
||||
- description: 更新时间起点,RFC3339 格式
|
||||
in: query
|
||||
name: start_time
|
||||
type: string
|
||||
- description: 更新时间终点,RFC3339 格式
|
||||
in: query
|
||||
name: end_time
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
||||
Reference in New Issue
Block a user