12 Commits
Author SHA1 Message Date
IronMurphy e084e9c68a fix(knowledge): tell the user a restart is what the install needs (#1493)
* fix(knowledge): tell the user a restart is what the install needs

When the local embedding packages land in pip's user site, CPython only puts that
directory on sys.path if it existed at interpreter startup, so a long-running
server can never import them. ensure_local_embedding_deps() already raises with
'Restart the server and try again', but _map_knowledge_error() matched the text on
'embedding'/'component' and replaced it with the generic prerequisites error, so
the user retried a download that could not succeed. Map that case to its own code
and message.

* test(i18n): register the new code in the dashboard locales too

tests/unit/i18n/test_errors.py asserts the dashboard apiErrors keys equal the
backend ErrorCode set, so the new restart-required code has to be listed there
as well.
2026-10-16 11:27:50 +08:00
jubaoliangandCursor 5e34c8a001 fix: connectors empty layout and restore prior control-plane behaviors
Apply the remaining working-tree changes: connectors empty-state layout,
plus the knowledge, HITL, captcha, workspace, user-cache, and SSRF
adjustments with matching tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-24 22:40:47 +08:00
4e09aeb956 fix(knowledge): map per-base document cap to KNOWLEDGE_DOC_LIMIT (#1013)
`_map_knowledge_error` matched the literal "at most 100" to classify the
document-cap error, but `KnowledgeRepo.create_document` interpolates the
per-base `max_documents`, which has been user-configurable since 90b8ca25.
Any cap other than the default 100 therefore fell through to the base-cap
branch (the repo message also contains "knowledge bases") and the user was
told they had created too many knowledge bases.

Classify both caps by the stable wording of their own messages instead of
a magic number, and drive the mapping from the real repo in a regression
test so the wording coupling cannot silently rot again.

Co-authored-by: sxh <sunxianhong@ncti-gba.cn>
Co-authored-by: sxh313 <sxh313@users.noreply.github.com>
Co-authored-by: jubaoliang <jubaoliang@tencent.com>
2026-09-24 15:11:19 +08:00
Xinmin Zeng f7124f31ac fix(db): ensure knowledge_bases max_documents column in PostgreSQL (#755)
- Add max_documents to 010_thread_message_projection.pg.sql via ADD COLUMN IF NOT EXISTS
- Invoke _ensure_knowledge_bases_schema across dialects at the end of run_migrations
- Distinguish prerequisites errors in _map_knowledge_error instead of masking unclassified errors as 409
- Add PostgreSQL integration test for knowledge_bases max_documents column and CRUD
- Add unit tests verifying _map_knowledge_error behavior on unclassified errors
2026-09-17 20:17:09 +08:00
HUANG Chengandjubaoliang 985c3eb887 feat(knowledge): download originals and rich document preview (#591) (#612)
* feat(knowledge): download originals and rich document preview (#591)

Add file download/inline endpoints with has_original, shared DocumentPreviewCore
for PDF/DOCX/PPTX/XLSX, markdown preview, drag-drop upload, and DOCX layout
sanitization for corrupt spacing metrics.

* feat(dashboard): render PDF previews with PDF.js instead of iframe

Replace Chrome's built-in PDF iframe with react-pdf for consistent
in-app pages, zoom controls, and cross-browser look (#591).

---------

Co-authored-by: jubaoliang <jubaoliang@gmail.com>
2026-09-09 17:46:23 +08:00
jubaoliangandCursor 8401f892da feat(knowledge): expand document formats, add optional OCR, and show upload progress
Parse more text and spreadsheet types, add optional local/remote OCR for images and scanned PDFs, and surface upload progress so indexing no longer appears stuck.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-03 20:03:21 +08:00
chujieHong 90b8ca2560 feat(knowledge): 支持按知识库配置文档数量上限 (#427)
- schema v10: knowledge_bases 新增 max_documents 列(默认 100,0=不限制,上限 10000)
- 上传时按 KB 自身上限在 SQL 事务内原子拦截,第 N+1 个文档被拒绝
- 前端编辑模态框在"描述"与"图标"之间新增"文档数量上限"输入项,保存即同步
- 详情面板"X/Y 文档"文本、上限 Alert、上传按钮均改用该 KB 自身上限
- SQLite 通过启动兜底加列,PostgreSQL 使用 ADD COLUMN IF NOT EXISTS 幂等迁移
2026-08-27 15:38:05 +08:00
chujieHong 76db0e1752 feat(knowledge): 支持知识库文件夹重命名 (#417)
* feat(knowledge): 支持文件夹重命名

- repo: 新增 rename_document,使用 path_parent + normalize_kb_path 计算新路径,
  对文件夹执行基于 substr 的精确前缀匹配(替代 LIKE,避免 _/% 通配符误匹配),
  同步重写所有后代文档的 path 字段
- service: 新增 rename_document,处理权限、名称校验、幂等性与重名冲突,
  同名重命名直接返回避免无谓写库
- api: 新增 POST /{kb_id}/documents/{doc_id}/rename,新增 KNOWLEDGE_NAME_INVALID
  错误码(400)与 KNOWLEDGE_NAME_TAKEN 错误码(409)路由映射
- 前端: KnowledgeBases 文件夹行删除按钮左侧新增重命名按钮(type=text size=small),
  弹窗复用 Modal + Input,名称未变时直接关闭、不发请求
- i18n/locales: 新增 KNOMEDGE_NAME_INVALID 错误消息及重命名成功/失败提示
- tests: 新增 4 个 repo 测试、5 个 service 测试、2 个 api 错误映射测试,
  覆盖后代路径改写、跨根/嵌套文件夹、重名冲突、含分隔符拒绝、幂等、ACL 拒绝

* fix(knowledge): remove stray SKILL_DETAILS_PROTECTED error code

The folder-rename PR accidentally carried SKILL_DETAILS_PROTECTED from an
unrelated feature branch into ErrorCode and _DEFAULT_STATUS without its
i18n entries, failing test_dashboard_api_errors_match_backend and
test_every_error_code_has_i18n_entry in CI. Drop it here; the
published-expert skill-details feature ships it separately with locales.
2026-08-26 10:28:48 +08:00
e07824e6a9 Fix/agent env usage workspace (#351)
* fix: inject Admin env into running agents and sum turn token usage

Running shells and Docker sandboxes now pick up ~/.octop/env (and workspace .env) without a full reload; MCP stdio no longer inherits the entire host environment. Usage accounting adds every model call in the turn, and workspace I/O survives the harness rebuild window.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: schema v7 identity, expert profiles, chat artifacts, and KB citations (#346)

* feat: schema v7 identity, expert profiles, chat artifacts, and KB citations

Fold integer PKs plus public string ids, document folders, agent profile columns, and thread artifacts into v7 SQL (not only Python helpers). Experts get workspace avatars and a single welcome_message; chat keeps file changes across sessions, shows knowledge citations, and can drag workspace files.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore: drop cron JobDrawer UX from the schema v7 PR

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: prefer tool-arg paths when recording chat artifacts

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: jubaoliang <jubaoliang@tencent.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: jubaoliang <jubaoliang@tencent.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-20 10:17:39 +08:00
jubaoliangandCursor 8b15af47e6 feat: harden knowledge embedding setup and settings ACL
Separate instance KB toggle from page CRUD with knowledge_settings, probe
embedding endpoints correctly, and polish ONNX download/settings UX.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-15 11:43:02 +08:00
jubaoliangandCursor 1af14b8031 chore: wire shared agents, SSO, experts, ONNX, and knowledge into the app
Register routers/repos/migrations, OpenAPI tags, i18n/error codes, sidebar routes, and docs for the new platform capabilities.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-12 18:56:23 +08:00
jubaoliangandCursor e8a824bb1e feat(knowledge): add knowledge bases with chat retrieval
Introduce document indexing, embedding (ONNX/remote), and chat/IM injection with default-open selection in the dashboard composer.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-12 18:56:23 +08:00