2026-08-06 10:22:10 +00:00
|
|
|
|
# API 参考:分块与标签
|
|
|
|
|
|
|
2026-09-08 02:54:41 +00:00
|
|
|
|
分块(chunk)是检索的最小单元,标签用于给文档分类。两组接口均属于知识库资源,与[知识库与知识](./02-api-knowledge.md)共用同一套权限规则:读为 Viewer+ 且对父 KB 有 read 权限(API key `retrieve`),写为「KB 创建者 OR Admin+」且有 write 权限(API key `ingest`),均受 API key 的 KB 白名单约束。
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
|
|
|
|
|
通用约定(Base URL、认证、错误码、分页)见 [API 总览](./01-api-overview.md)。
|
|
|
|
|
|
|
|
|
|
|
|
## 分块(/api/v1/chunks)
|
|
|
|
|
|
|
|
|
|
|
|
Handler: `internal/handler/chunk.go`。读:Viewer+ 且父 KB read(API key `retrieve`/full);写:KB 创建者 OR Admin+ 且父 KB write(API key `ingest`/full)。
|
|
|
|
|
|
|
|
|
|
|
|
### GET /api/v1/chunks/:knowledge_id
|
|
|
|
|
|
|
|
|
|
|
|
用途:知识的分块列表。
|
|
|
|
|
|
|
|
|
|
|
|
| 查询参数 | 类型 | 必填 | 说明 |
|
|
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
|
|
| `page` | int | 否 | 默认 1 |
|
|
|
|
|
|
| `page_size` | int | 否 | 默认 10,上限 100 |
|
|
|
|
|
|
| `chunk_type` | string | 否 | 可重复,按分块类型过滤 |
|
|
|
|
|
|
|
|
|
|
|
|
响应:200 `{"success":true,"data":[Chunk],"total","page","page_size"}`
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
curl "$BASE/api/v1/chunks/k-1?page=1" -H "Authorization: Bearer $TOKEN"
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### GET /api/v1/chunks/by-id/:id
|
|
|
|
|
|
|
|
|
|
|
|
用途:按 chunk ID 获取单个分块(无需 knowledge_id)。
|
|
|
|
|
|
|
feat(chat): open cited documents at the cited passage (#3700)
* feat(chat): open cited documents at the cited passage
Clicking a citation used to show only the parsed chunk. It now opens the
original file in the references panel, jumps to the cited place and
highlights it, narrowed to the sentence the citation supports.
Parsing records where each chunk sits in the original file
(chunks.source_locators): PDF page and paragraph boxes from the docreader,
MinerU and PaddleOCR-VL layouts; Word paragraphs, slides, sheet rows and
EPUB chapters aligned in Go against any parser engine's Markdown; text
offsets for Markdown/TXT; segment times for audio. Pipeline text rewrites
are followed with a line-diff remapper. Scanned PDF pages get their OCR
text as quotes at search time so a sentence can pick its page.
The frontend renders PDFs with pdf.js and every other previewable type
with the existing preview, then highlights with the CSS Custom Highlight
API in a highlighter yellow that stays visible against the brand green.
* fix(docreader): serialize source blocks outside main so tests import it
test_docx_tables stubs docreader.parser in sys.modules, so importing
docreader.main from a later test failed in the full unittest discover run.
The wire conversion now lives in docreader.source_wire, which needs only
the proto.
* fix(chat): tighten source locators from review
- Remap rewritten-line-for-line stretches by line so scanned PDF pages
no longer drift onto the wrong page.
- Keep the source preview mounted for citations in the file already open.
- Wait for in-flight PDF page renders before looking for the text layer.
- Count image rune offsets in one pass; stream xlsx rows up to maxUnits.
- Start text locators after a UTF-8 BOM, as viewers decode without it.
- Only re-query image children for scanned-page results.
- Seek audio citations without autoplay and drop stale seek listeners.
- Fix the SQLite migration's cross-reference to versioned/000113.
* fix(migrations): renumber chunk source locators after main's chunk_images
main took versioned 000113 and sqlite 000032 for chunk_images, so the
source_locators column moves to versioned 000114 and sqlite 000033.
2026-09-25 05:26:16 +00:00
|
|
|
|
响应:200 `{"success":true,"data":{Chunk}}`。`Chunk.source_locators` 是分块在原始文件中的位置,结构见 [API 概览](01-api-overview.md)中的 `source_locators` 说明。
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
curl $BASE/api/v1/chunks/by-id/c-1 -H "Authorization: Bearer $TOKEN"
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### PUT /api/v1/chunks/:knowledge_id/:id
|
|
|
|
|
|
|
|
|
|
|
|
用途:编辑分块内容或启停状态(migration `000078` 起为带版本的乐观更新)。
|
|
|
|
|
|
|
|
|
|
|
|
| 字段 | 类型 | 必填 | 说明 |
|
|
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
|
|
| `content` | string | 否 | 新内容,去除首尾空白后不得为空,长度上限 200000 字节 |
|
|
|
|
|
|
| `is_enabled` | bool | 否 | 启用/停用该分块 |
|
|
|
|
|
|
| `expected_revision` | int | 否 | 期望的 `content_revision`,用于乐观并发控制 |
|
|
|
|
|
|
|
|
|
|
|
|
约束与副作用:
|
|
|
|
|
|
|
|
|
|
|
|
- 仅 `text` 类型分块可编辑,其它类型返回 400;
|
|
|
|
|
|
- `expected_revision` 与当前 `content_revision` 不一致时返回 **409**(`Chunk was modified by another user; refresh and retry`);
|
|
|
|
|
|
- 不允许在编辑中引入源内容里没有的图片 URL;删除 Markdown 图片会同步停用对应的 OCR/caption 子分块;
|
|
|
|
|
|
- 编辑成功后 `content_revision` +1,旧版本写入 `chunk_revisions` 表,`index_status` 依次经历 `processing` → `ready`;重建检索索引失败时行仍保存但 `index_status = failed`,可再次提交同样内容触发重试;
|
|
|
|
|
|
- 子分块编辑会按偏移量回写父分块内容(父分块的 `source_content` 保持不可变);
|
|
|
|
|
|
- 内容或启停状态变化会入队一次文档摘要刷新。
|
|
|
|
|
|
|
|
|
|
|
|
响应:200 `{"success":true,"data":{Chunk},"summary_status":"pending","description":"..."}`
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
curl -X PUT $BASE/api/v1/chunks/k-1/c-1 -H "Authorization: Bearer $TOKEN" \
|
|
|
|
|
|
-H 'Content-Type: application/json' -d '{"content":"修正后的内容","expected_revision":2}'
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### GET /api/v1/chunks/:knowledge_id/:id/revisions
|
|
|
|
|
|
|
|
|
|
|
|
用途:分块的历史版本列表(`chunk_revisions` 表,按 revision 倒序)。
|
|
|
|
|
|
|
|
|
|
|
|
响应:200 `{"success":true,"data":[{ChunkRevision}]}`,单条包含 `revision`、`content`、`is_enabled`、`editor_id`、`edit_source`、`edited_at`。
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
curl $BASE/api/v1/chunks/k-1/c-1/revisions -H "Authorization: Bearer $TOKEN"
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### POST /api/v1/chunks/:knowledge_id/:id/revert
|
|
|
|
|
|
|
|
|
|
|
|
用途:回滚到某个历史版本。回滚本身也是一次新编辑:`content_revision` 继续递增,当前内容会被存为新的历史版本。
|
|
|
|
|
|
|
|
|
|
|
|
| 字段 | 类型 | 必填 | 说明 |
|
|
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
|
|
| `revision` | int | 是 | 目标历史版本号(非负) |
|
|
|
|
|
|
| `expected_revision` | int | 否 | 乐观锁,语义同上,冲突返回 409 |
|
|
|
|
|
|
|
|
|
|
|
|
响应:200 `{"success":true,"data":{Chunk},"summary_status":"...","description":"..."}`
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
curl -X POST $BASE/api/v1/chunks/k-1/c-1/revert -H "Authorization: Bearer $TOKEN" \
|
|
|
|
|
|
-H 'Content-Type: application/json' -d '{"revision":1}'
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### DELETE /api/v1/chunks/:knowledge_id/:id
|
|
|
|
|
|
|
|
|
|
|
|
用途:删除单个分块。
|
|
|
|
|
|
|
|
|
|
|
|
响应:200 `{"success":true,"message":"Chunk deleted"}`
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
curl -X DELETE $BASE/api/v1/chunks/k-1/c-1 -H "Authorization: Bearer $TOKEN"
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### DELETE /api/v1/chunks/:knowledge_id
|
|
|
|
|
|
|
|
|
|
|
|
用途:删除知识下全部分块。
|
|
|
|
|
|
|
|
|
|
|
|
响应:200 `{"success":true,"message":"All chunks under knowledge deleted"}`
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
curl -X DELETE $BASE/api/v1/chunks/k-1 -H "Authorization: Bearer $TOKEN"
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### DELETE /api/v1/chunks/by-id/:id/questions
|
|
|
|
|
|
|
|
|
|
|
|
用途:删除该分块下某条生成的问题。请求体:`{"question_id":"..."}`(`binding:"required"`)。
|
|
|
|
|
|
|
|
|
|
|
|
响应:200 `{"success":true,"message":"Generated question deleted"}`
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
curl -X DELETE $BASE/api/v1/chunks/by-id/c-1/questions -H "Authorization: Bearer $TOKEN" \
|
|
|
|
|
|
-H 'Content-Type: application/json' -d '{"question_id":"q-1"}'
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### PUT /api/v1/chunks/by-id/:id/questions
|
|
|
|
|
|
|
|
|
|
|
|
用途:新增或修改该分块的一条生成问题。请求体:`{"question":"...","question_id":"..."}`,`question` 必填;`question_id` 留空表示新增。
|
|
|
|
|
|
|
|
|
|
|
|
响应:200 `{"success":true,"data":{GeneratedQuestion}}`
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
curl -X PUT $BASE/api/v1/chunks/by-id/c-1/questions -H "Authorization: Bearer $TOKEN" \
|
|
|
|
|
|
-H 'Content-Type: application/json' -d '{"question_id":"q-1","question":"WeKnora 如何配置向量库?"}'
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### POST /api/v1/chunks/by-id/:id/questions/regenerate
|
|
|
|
|
|
|
|
|
|
|
|
用途:基于分块当前内容重新生成检索问题。内容编辑后原有问题不会被删除,而是标记为「过期」(revision 与当前正文不匹配),可用本接口刷新。
|
|
|
|
|
|
|
|
|
|
|
|
响应:200 `{"success":true,"data":[{GeneratedQuestion}]}`
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
curl -X POST $BASE/api/v1/chunks/by-id/c-1/questions/regenerate -H "Authorization: Bearer $TOKEN"
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## 标签(/api/v1/knowledge-bases/:id/tags)
|
|
|
|
|
|
|
|
|
|
|
|
Handler: `internal/handler/tag.go`。读:Viewer+ + KB read(API key `retrieve`/full);写:KB 创建者 OR Admin+ + KB write(API key `ingest`/full)。
|
|
|
|
|
|
|
|
|
|
|
|
### GET /api/v1/knowledge-bases/:id/tags
|
|
|
|
|
|
|
|
|
|
|
|
用途:标签列表。查询参数:`page`、`page_size`、`keyword`(均可选)。
|
|
|
|
|
|
|
|
|
|
|
|
响应:200 `{"success":true,"data":[KnowledgeTag]}`
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
curl $BASE/api/v1/knowledge-bases/kb-1/tags -H "Authorization: Bearer $TOKEN"
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### POST /api/v1/knowledge-bases/:id/tags
|
|
|
|
|
|
|
|
|
|
|
|
用途:创建标签。
|
|
|
|
|
|
|
|
|
|
|
|
| 字段 | 类型 | 必填 | 说明 |
|
|
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
|
|
| `name` | string | 是(`binding:"required"`) | 标签名 |
|
|
|
|
|
|
| `color` | string | 否 | 颜色 |
|
|
|
|
|
|
| `sort_order` | int | 否 | 排序 |
|
|
|
|
|
|
|
|
|
|
|
|
响应:200 `{"success":true,"data":{KnowledgeTag}}`
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
curl -X POST $BASE/api/v1/knowledge-bases/kb-1/tags -H "Authorization: Bearer $TOKEN" \
|
|
|
|
|
|
-H 'Content-Type: application/json' -d '{"name":"售后"}'
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### PUT /api/v1/knowledge-bases/:id/tags/:tag_id
|
|
|
|
|
|
|
|
|
|
|
|
用途:更新标签(`tag_id` 支持 UUID 或整数 seq_id)。请求体:`name`/`color`/`sort_order`(指针字段,均可选)。
|
|
|
|
|
|
|
|
|
|
|
|
响应:200 `{"success":true,"data":{KnowledgeTag}}`
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
curl -X PUT $BASE/api/v1/knowledge-bases/kb-1/tags/t-1 -H "Authorization: Bearer $TOKEN" \
|
|
|
|
|
|
-H 'Content-Type: application/json' -d '{"name":"售后支持"}'
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### DELETE /api/v1/knowledge-bases/:id/tags/:tag_id
|
|
|
|
|
|
|
2026-10-15 15:54:14 +00:00
|
|
|
|
用途:删除标签。查询参数:`force`(bool,连同仍引用该标签的文档或 FAQ 条目一起删除)、`content_only`(bool,仅删除标签下的内容、保留标签)。请求体(可选):`{"exclude_ids":[int64]}`,列出删除时保留的 FAQ 条目 seq_id。不传 `force` 时,仍有知识或 FAQ 引用该标签会返回 400,文档不会被删除。
|
docs: sync website-docs, homepage and changelog for v0.8.2 (#3632)
* docs: sync website-docs with changes since v0.8.0
Audit every change between v0.8.0 and the v0.8.2 release against the
documentation site, adding what users and operators need and correcting
statements that no longer match the code.
- Add local browser (BrowserSkill), built-in MCP Server endpoints, the
toolbox, conversation steer/fork/rewind and reasoning effort, the
artifacts library, sandbox terminal and desktop, the Lite host sandbox,
the rebuilt model catalog (including a protocol-compat field reference),
Confluence and DingTalk Docs sources, Bocha/Serply search, per-channel IM
locale, whitelist-only outbound, admin user creation, new configuration
variables and migrations 000091-000110.
- Fix wrong API examples and parameters (model type values, knowledge
search params, FAQ match_count cap, Notion credentials), tenant deletion
semantics, default timeouts, parser engine claims, removed tables and
commands, stale navigation paths, and route locations after the router
split into routes_*.go.
- Add screenshots for the new pages and refresh outdated ones.
* fix(frontend): link the protocol-compat field to its documentation
The model editor told users to read catalog/compat.go on the backend, a
path that no longer exists after the model catalog refactor. The hint now
says when the override is needed and links to the field reference in
website-docs/03-features/06-models.md; the config examples and the API
type comment point to the same place.
* feat(website): showcase v0.8.2 on the homepage
- Add a v0.8.2 section for the local browser (BrowserSkill), the built-in
MCP Server and conversation control, and turn the v0.8.0 release block
into a standing skills & sandbox topic with the sandbox desktop and
terminal.
- Replace the three-up galleries with a feature list beside one large
screenshot: every item's text stays visible, clicking an item or one of
its views switches the image with a cross-fade, and the list plays itself
while on screen until the visitor picks something.
- Add Confluence, DingTalk, BrowserSkill and more model vendors to the
integrations, bump the header badge to v0.8.2 and link the changelog.
- check-site reports missing docs screenshots as pending instead of
failing, since the Screenshot component renders a placeholder for them.
* docs(changelog): add v0.8.2 release notes
* docs(website): add per-version release notes pages
Add a "版本发布" docs section with one page per release, starting with
v0.8.2 and a backfilled v0.8.0. Each page walks through the highlights
with the existing product screenshots, the other improvements and fixes,
and an upgrade checklist with the actions each breaking change needs.
The sidebar orders these pages by version, newest first; the docs header
gains a 版本 entry, and the homepage's v0.8.2 section now links to the
release notes page instead of the raw CHANGELOG.
* feat(website): let the site image listen on a configurable port
The Docker image hard-coded `listen 80`, so running it with host
networking or on a platform that assigns the container port required
editing the Nginx config and rebuilding. The image now renders its
config from the official nginx template directory at startup and reads
the listen port from `PORT` (default 80); deploy/nginx.conf stays a plain
config for static deployments.
test-docker starts a second container with PORT=8080 and checks the
rendered config and that the site answers on that port; the README
documents the variable.
* fix(website): namespace the nginx listen port variable
* fix(website): support bash-wrapped container startup
* fix(website): align nginx startup with frontend entrypoint
* fix(website): pin nginx runtime for older host compatibility
* fix(website): bake the configured nginx port into the image
2026-09-24 03:26:34 +00:00
|
|
|
|
|
|
|
|
|
|
请求体格式不合法或 ID 非正整数返回 400;ID 不存在返回 404;ID 不属于当前知识库的 FAQ 条目返回 403。
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
|
|
|
|
|
响应:200 `{"success":true}`
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-10-15 15:54:14 +00:00
|
|
|
|
curl -X DELETE $BASE/api/v1/knowledge-bases/kb-1/tags/t-1 -H "Authorization: Bearer $TOKEN"
|
2026-08-06 10:22:10 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## 分块调试
|
|
|
|
|
|
|
|
|
|
|
|
### POST /api/v1/chunker/preview
|
|
|
|
|
|
|
|
|
|
|
|
用途:无状态分块预览(KB 编辑器调试面板)。权限:Viewer+;API key `retrieve`/`ingest`/full。Handler: `internal/handler/chunker_debug.go`
|
|
|
|
|
|
|
|
|
|
|
|
| 字段 | 类型 | 必填 | 说明 |
|
|
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
|
|
| `text` | string | 是(代码校验非空,≤64k 字符) | 样例文本 |
|
|
|
|
|
|
| `chunking_config.chunk_size` | int | 否 | 分块字符数 |
|
|
|
|
|
|
| `chunking_config.chunk_overlap` | int | 否 | 重叠 |
|
|
|
|
|
|
| `chunking_config.separators` | []string | 否 | 分隔符 |
|
|
|
|
|
|
| `chunking_config.strategy` | string | 否 | `auto/heading/heuristic/recursive/legacy` |
|
|
|
|
|
|
| `chunking_config.token_limit` | int | 否 | token 上限 |
|
|
|
|
|
|
| `chunking_config.languages` | []string | 否 | 语言提示 |
|
|
|
|
|
|
| `chunking_config.enable_parent_child` | bool | 否 | 按父子分块试切,返回的是子块(与检索粒度一致) |
|
|
|
|
|
|
| `chunking_config.parent_chunk_size` / `child_chunk_size` | int | 否 | 父/子块大小,缺省 4096 / 384 |
|
|
|
|
|
|
|
docs: sync website-docs, homepage and changelog for v0.8.2 (#3632)
* docs: sync website-docs with changes since v0.8.0
Audit every change between v0.8.0 and the v0.8.2 release against the
documentation site, adding what users and operators need and correcting
statements that no longer match the code.
- Add local browser (BrowserSkill), built-in MCP Server endpoints, the
toolbox, conversation steer/fork/rewind and reasoning effort, the
artifacts library, sandbox terminal and desktop, the Lite host sandbox,
the rebuilt model catalog (including a protocol-compat field reference),
Confluence and DingTalk Docs sources, Bocha/Serply search, per-channel IM
locale, whitelist-only outbound, admin user creation, new configuration
variables and migrations 000091-000110.
- Fix wrong API examples and parameters (model type values, knowledge
search params, FAQ match_count cap, Notion credentials), tenant deletion
semantics, default timeouts, parser engine claims, removed tables and
commands, stale navigation paths, and route locations after the router
split into routes_*.go.
- Add screenshots for the new pages and refresh outdated ones.
* fix(frontend): link the protocol-compat field to its documentation
The model editor told users to read catalog/compat.go on the backend, a
path that no longer exists after the model catalog refactor. The hint now
says when the override is needed and links to the field reference in
website-docs/03-features/06-models.md; the config examples and the API
type comment point to the same place.
* feat(website): showcase v0.8.2 on the homepage
- Add a v0.8.2 section for the local browser (BrowserSkill), the built-in
MCP Server and conversation control, and turn the v0.8.0 release block
into a standing skills & sandbox topic with the sandbox desktop and
terminal.
- Replace the three-up galleries with a feature list beside one large
screenshot: every item's text stays visible, clicking an item or one of
its views switches the image with a cross-fade, and the list plays itself
while on screen until the visitor picks something.
- Add Confluence, DingTalk, BrowserSkill and more model vendors to the
integrations, bump the header badge to v0.8.2 and link the changelog.
- check-site reports missing docs screenshots as pending instead of
failing, since the Screenshot component renders a placeholder for them.
* docs(changelog): add v0.8.2 release notes
* docs(website): add per-version release notes pages
Add a "版本发布" docs section with one page per release, starting with
v0.8.2 and a backfilled v0.8.0. Each page walks through the highlights
with the existing product screenshots, the other improvements and fixes,
and an upgrade checklist with the actions each breaking change needs.
The sidebar orders these pages by version, newest first; the docs header
gains a 版本 entry, and the homepage's v0.8.2 section now links to the
release notes page instead of the raw CHANGELOG.
* feat(website): let the site image listen on a configurable port
The Docker image hard-coded `listen 80`, so running it with host
networking or on a platform that assigns the container port required
editing the Nginx config and rebuilding. The image now renders its
config from the official nginx template directory at startup and reads
the listen port from `PORT` (default 80); deploy/nginx.conf stays a plain
config for static deployments.
test-docker starts a second container with PORT=8080 and checks the
rendered config and that the site answers on that port; the README
documents the variable.
* fix(website): namespace the nginx listen port variable
* fix(website): support bash-wrapped container startup
* fix(website): align nginx startup with frontend entrypoint
* fix(website): pin nginx runtime for older host compatibility
* fix(website): bake the configured nginx port into the image
2026-09-24 03:26:34 +00:00
|
|
|
|
样例文本中的内联 HTML `<table>` 会先转换为 Markdown 表格,与入库时的处理一致。
|
|
|
|
|
|
|
2026-08-06 10:22:10 +00:00
|
|
|
|
响应:200 `{"success":true,"data":{"selected_tier","tier_chain","rejected","profile","chunks":[...],"stats":{count,avg_chars,min_chars,max_chars,stddev_chars,truncated_to}}}`;文本超长 413;分块超时(5s)504。
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
curl -X POST $BASE/api/v1/chunker/preview -H "Authorization: Bearer $TOKEN" \
|
|
|
|
|
|
-H 'Content-Type: application/json' -d '{"text":"# 标题\n正文...","chunking_config":{"chunk_size":512}}'
|
|
|
|
|
|
```
|
2026-09-08 02:54:41 +00:00
|
|
|
|
|
|
|
|
|
|
## 实现参考
|
|
|
|
|
|
|
|
|
|
|
|
路由注册:`internal/router/routes_knowledge.go` 的 `RegisterChunkRoutes`、`RegisterKnowledgeTagRoutes`、`RegisterChunkerDebugRoutes`。
|