Commit Graph

3285 Commits (cf079b8dcd3315b46f1a2c848837f851ec61e04c)

Author SHA1 Message Date
Victor Maznyuk cf079b8dcd fix(models): keep Retry-After on HTTPError and honour it in agent LLM retries
Endpoint.Do turns a non-2xx reply into &HTTPError{StatusCode, Body} and
drops the response headers. A caller that retries a 429 or 503 therefore
cannot see the provider's Retry-After and falls back to its own guess: the
agent retry loop waits 1s, 2s, 3s, which against a provider asking for, say,
20s spends every attempt inside the rate-limit window and then fails the
turn.

- HTTPError carries the reply's Header, and RetryAfter() parses the header
  in both forms (delay-seconds and HTTP-date); absent, malformed or past
  values give zero.
- The agent retry loop waits max(linear backoff, Retry-After), with the
  vendor's value capped at 30s so a large Retry-After cannot hold a turn
  indefinitely.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 01:22:15 +08:00
yeliheng-010 15d4845521 fix(rss): 修复全文回退后增量同步不重试 2026-09-29 00:53:27 +08:00
yeliheng-010 b9be7d0d0d fix(notion): 修复页面清空后旧正文残留 2026-09-29 00:52:07 +08:00
linus-liu-web a282d1091e
fix(feishu): 云盘分页补上 #3645 给 wiki 加的重复 page token 防护 (#3770)
ListDriveFilesAllPages 只以 next_page_token 是否为空作为终止条件,既不看
has_more,也没有重复 token 检测;同一文件里同一厂商的 ListWikiSpaces /
ListWikiNodes 已在 #3645 修过,云盘这两条防护都漏了。

厂商返回 has_more=false 但残留非空 token,或返回重复的 page_token 时,循环会
拿同一个 token 反复请求同一页:定时同步任务会在 asynq 的 2h 超时前一直打 API
(scheduler 侧 MaxRetry 5),资源选择器
GET /api/v1/datasources/:id/resources 永不返回,同时 all 每轮 append 不断增长。

按 #3645 的既有写法原样修复:listDriveFiles 透出 has_more,循环改为
if !hasMore || next == "" 才退出,并用 seenPageTokens 记录已用过的 token,重复即
返回 "feishu drive file pagination repeated page token" 错误。正常多页语义不变
(仍返回完整列表),只是不再空转。

测试:TestClientDriveListFilesPagination(drive 包)用 httptest 覆盖重复 token、
has_more=false 带残留 token、正常两页三种情况;注释掉守卫后该用例在 2s 内发出
4 万+ 次请求并以 context deadline exceeded 失败。

Co-authored-by: linus-liu-web <11640009+linus-liu-web@users.noreply.github.com>
2026-09-29 00:51:19 +08:00
yeliheng-010 72e105f46a fix(gitlab): 按提交快照比较增量同步变更 2026-09-29 00:50:05 +08:00
linus-liu-web 7d1d71e50d
fix(datasource/dingtalk): 块级渲染不再静默丢内容(列表按线上真实形状渲染 + 未建模块类型可见) (#3822)
* fix(datasource/dingtalk): 块级渲染不再静默丢内容(列表按契约渲染 + 未建模块类型可见)

渲染器有三处会无声地丢正文:

- 列表块只在 inline 子节点渲染结果为空时才递归子块,于是 children 里既有
  inline 又有块级元素时,块级子节点的文本永远不渲染 —— 而且连 unknown 标记
  都不设,完全无痕;块级列表项还会被 strings.Fields 折叠进同一个 bullet 行;
- 未建模的块类型(code / attachment / slot / sheet / unknown …)payload 解析
  不出来,正文整块丢失,只剩类型名写进文档 metadata,全仓没有一行日志;
- 未建模的 inline 元素类型(slot 等,官方文档里文本放在 children)在默认分支
  只写 text 字段,children 里的正文直接消失。

改动:

- 列表按官方契约渲染:一个列表块 = 一个列表项,缩进用 list.level(0-based),
  同一列表的多项是共享 listId 的兄弟块(扁平模型),不假设结构嵌套;契约外的
  块级子节点仍然逐个渲染,作为防御,不再二选一、不再塌行;
- 未建模的 inline 元素在自身没有文本时渲染 children,避免整段消失;
- 未建模块类型在 Fetch 路径上显式暴露(这一层同时拿得到 ctx 与节点身份):
  collectUnknownBlockTypes 产出可测值,同时喂给 logger.Warnf 与
  common.PipelineWarn;文档 metadata 保持不变。

code / attachment / sheet / slot 的正文渲染不在本次范围:它们的块级 JSON 形状
仍无可靠证据(官方与公开 CLI 参考的键名互相冲突),先靠告警把真实 payload
找出来再按形状补,免得用猜测的字段把"可见的丢失"变回"静默的丢失"。

* fix(datasource/dingtalk): 按实测形状补 code / attachment / unknown 三类块的渲染

只读探针在真实 adoc 文档上取到的形状(不再依赖公开参考里互相冲突的键名):

- code: {"syntax":"bash","text":"...","title":"..."},title 有时缺;语言键是
  syntax 而不是 language;
- attachment: {"name":..,"size":..,"type":..,"viewType":..,"resourceId":..},
  resourceId 有时缺,payload 里没有任何下载 URL;
- unknown: {"rawType":"..."},只有真实类型名,没有正文;
- table.cells 的读取路径与实测一致,未改动。

改动:

- code 渲染成围栏代码块:语言取 syntax(含反引号或换行这类无法作为 info string
  的值时省略),围栏长度取 max(3, 正文最长反引号串+1),避免正文自带的围栏把代码块
  提前截断;title 非空时在围栏前输出一行加粗标题;text 为空不输出空围栏,仍按未建模
  类型记录并告警;
- attachment 渲染成一行纯文本 Attachment: <name> (<size>):名称做 Markdown 转义,
  size 按 1024 进制保留一位小数(B/KB/MB/GB),size<=0 时省略括号;payload 没有可
  解析的下载地址,因此不拿 resourceId 拼任何链接;名称为空不输出,仍按未建模类型
  记录并告警;
- unknown:default 分支在 rawType 非空时把标记写成 "unknown:"+rawType,使
  unknown_block_types metadata 与 warnUnknownBlockTypes 的日志/pipeline 事件直接
  带真实类型名,而不是无信息量的 "unknown"(字段名、签名与调用位置均未动),
  children 仍逐层递归。

既有普通块(段落/标题/引用/表格/列表)的输出逐字节不变,回归用例
TestRenderDocumentKeepsOrdinaryBlocksStable 未修改即通过。原先拿 code/attachment
当“未建模”夹具的两个用例改用空载荷的同类块与带 rawType 的 unknown 块,覆盖新的
“渲染不出内容仍要告警”语义。

* fix(datasource/dingtalk): 列表按线上真实形状渲染(块自带 text)

线上 Blocks API 返回的是一个列表项一个块,正文在块自带的 text 字段里,
没有 children、没有 list.level、也没有 listId。列表是唯一一类没有回退到
「块自带 text」的正文块 —— paragraph / heading / blockquote 都有
renderInlines(children) 取不到就取自身 text 的回退,列表直接进
renderListBlock,而那个函数只遍历 children,于是列表正文被整条丢弃;
又因为 blockType 是已知类型,switch 命中了它,连 unknown_block_types
都不会记一笔。

同一形状问题还影响 unknown:sdt 块(文档目录)的正文就在 unknown.text 里,
此前只写标记不渲染正文。

夹具取自线上 payload(markdown_live_shape_test.go),不按转述的契约自造。

---------

Co-authored-by: linus-liu-web <11640009+linus-liu-web@users.noreply.github.com>
2026-09-29 00:48:20 +08:00
linus-liu-web 08f7e702cf fix(datasource/dingtalk): 跳过不再静默,展开叶子不再报错
同步过去只保留能读的内容:没有 ingest 路径的节点被直接丢掉,日志里
一个字都没有,一个 19 个文件的库只同步出 14 个也无从得知。现在

- scanWorkspace 把「看到了但读不了」的节点一并以 skipped 返回,
  sync 逐个打印身份与原因(视频/媒体是刻意不下载,原生类型是还没实现),
  每个 scope 再补一行 total/synced/skipped/failed 汇总,partial sync
  再也装不成一次干净的运行;
- 可重试的失败仍按失败计(不计入 skipped),并显式记一条 warn,
  与确定性跳过区分开;
- 资源选择器展开一个其实没有子节点的条目(document)时返回空列表而不是
  ErrResourceNotFound:叶子本来就没有子节点,而前端把 error 渲染成
  展开失败的气泡,会让一次同步完全正常的操作看起来出错。前端
  DataSourceEditorDialog 收到空列表后会把该行 has_children 置 false 并
  保留,因此第二次展开不会再发一次空请求(该逻辑已在上游 main 中)。

跳过只在日志里报告:FetchedItem 没有 skip 字段,也不打算为它新增。
2026-09-29 00:47:02 +08:00
Fei.Chen ec0ca46334
fix(server): run ResourceCleaner on signal shutdown instead of racing Fatalf exit (#3804)
* fix(server): signal shutdown raced Fatalf exit before ResourceCleaner ran

The signal goroutine closed the listener before calling server.Shutdown,
so Serve returned the raw accept error ('use of closed network connection')
instead of ErrServerClosed. The invoke error path then hit logger.Fatalf
(os.Exit(1)) in the same millisecond, killing the process before the
shutdown goroutine reached resourceCleaner.Cleanup. Every registered
cleaner — BrowserSkill daemon, sandbox reapers, IMService, AntsPool,
Langfuse — was skipped on every SIGTERM/SIGINT, leaking the shared bsk
daemon process and its temp home on each restart.

Two changes:
- Drop the manual listener.Close(): Shutdown closes all listeners as its
  first step, releasing the port just as fast without racing Serve.
- Give resourceCleaner.Cleanup its own fresh timeout context so a slow
  connection drain cannot leave Cleanup with an already-expired context,
  which made it skip every entry without running any.

* fix(server): keep signal cleanup inside one grace period

Desktop quit still closed the listener before Shutdown and returned
before ResourceCleaner finished, so Fatalf could skip every hook.
Share ShutdownTimeout between drain and cleanup, run BrowserSkill
first, and do not drop later hooks when the deadline expires.

* fix(server): satisfy errcheck and line-length lint

---------

Co-authored-by: vicfei <vicfei@users.noreply.github.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-28 23:37:36 +08:00
wizardchen c819abd958 fix(wiki): bound outstanding follow-up tasks 2026-09-28 22:02:07 +08:00
Duke 4ba85e2edf fix(wiki): fan out follow-up triggers so backlogs drain at ingest_max_inflight
Since Phase 3 the consumption side (disjoint claiming, per-slug locks,
the inflight cap) fully supports concurrent batches, but nothing created
more than one trigger per completed batch: once uploads stopped, a KB
with a standing backlog drained at 1 batch x batch-size per cycle
regardless of ingest_max_inflight, leaving the wiki pool and the model
server idle.

followUpTriggerCount now re-arms min(batches the remaining rows still
need, slots that could be free when the triggers fire). The caller's
own slot releases right after scheduleFollowUp returns, hence the +1.
activeInflightSlots is a read-mostly Lua companion to the reserve
script (purge expired, then ZCARD); -1 means unknown (no Redis / Redis
error) and collapses to a single follow-up, as do maxInflight <= 1 and
Lite mode (liteLocks serialize per KB anyway). Fan-out is deliberately
skipped on a rate-limited exit so a 429 storm is not amplified.

Over-issued triggers are harmless: the ones that cannot get a slot are
acked and coalesced by scheduleCappedRetry's fixed TaskID. The slot
count renders as "unknown" in the log when it was not consulted.
2026-09-28 22:02:07 +08:00
Victor Maznyuk bad7afa6ae fix(sandbox): pass desktop slot timing to the renew goroutine
renewDesktopSlot read desktopSlotRenew and desktopSlotLease from its own
goroutine. release() stops that goroutine without waiting for it, so the
read is unordered with the test cleanup that restores the values, and
`go test -race ./internal/handler/session/` fails in
TestDesktopSlotCancelsHoldWhenKeyExpires on every run.

acquireDesktopSlot now reads both durations before starting the goroutine
and passes them in; the go statement orders the reads, and the renew loop
no longer touches the package variables. Behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 22:01:39 +08:00
Perfecto 675b06addc test: consolidate table summary regressions 2026-09-28 21:24:02 +08:00
Perfecto d270a844ac fix: reject empty table-summary model responses 2026-09-28 21:24:02 +08:00
Perfecto d528d1fc3c fix: skip table-summary tasks for missing documents 2026-09-28 21:22:45 +08:00
bigdu332 bdad5eea2b fix(chat): clear stale KB scope on session restore 2026-09-28 21:20:12 +08:00
Victor Maznyuk 157fb4d3c1 fix(frontend): label host-sandbox skill secret cards like the sandbox cards
The sandbox cards on the environment-variable settings page already pass the
localized host label to configLabel, so the host config shows as "This
computer". The skill secret cards call configLabel without it and show the
raw backend name of the host config instead (本机), in every locale.

skillSecretCards now takes the same optional hostLabel and forwards it;
EnvVarSettings passes t('settings.skills.hostTarget') as it does for the
sandbox cards. Without a label the behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 21:10:02 +08:00
kwsYegar 9cab226853 docs: extract active tenant ID in the API quickstart 2026-09-28 21:08:33 +08:00
Victor Maznyuk 0b463e459a test(skills): wait for the host install to release its lock before asserting
TestHostInstallActivatesVersionAndMarksReady waited for the row to reach
ready and then read the fake tree and installer. runHostInstall records
ready while it still holds the skill lock; pruning old versions, unbinding
the install session and unlocking come after, so the test could observe
tree.pruned as nil or installer.bound still populated, and the race
detector reported the unsynchronised reads.

The fake tree now counts runs between Lock and unlock, and the wait
helpers block until no run holds it. The run unlocks last, so everything
it wrote is visible once the wait returns. waitRemoveDone had the same
gap (the row is deleted before the stale marks are recorded) and uses the
same wait.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 21:07:04 +08:00
Victor Maznyuk 5bf2ae1cc2 fix(faq): actually clean FAQ entry payloads before validation and storage
sanitizeFAQEntryPayload called meta.Normalize() and discarded the result.
Normalize returns a normalized copy for hashing and indexing and does not
touch its receiver, so no cleaning happened: blank, whitespace-only and
duplicate similar/negative questions and answers were stored as sent, two
empty similar questions were reported as a duplicate, and answers: ["  "]
passed the "at least one answer" check.

Call meta.Sanitize(), the in-place method meant for storage (trim, drop
empties, de-duplicate, keep the original text).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 20:29:29 +08:00
linus-liu-web a570dffcfa test(wiki): 表格夹具改用合成数据
`certLedgerRow` / `certLedgerBlock` 里的机构名、页面标题与行数都取自某一份具体
数据,而回归测试需要的只是形状:一张有很多行的 markdown 表格 + 表头 + 分隔行。
取值换成中性的示例数据 —— 机构名 `示例科技有限公司`、行标识 `成员 N`、标题
`证书台账`、行数 90(切 1..61 + 62..90),断言里的 92 = 90 行 + 表头 + 分隔行。

断言逻辑一行未动,5 个续写/上限/哨兵用例全 PASS。
2026-09-28 20:19:52 +08:00
lyingbug 9114e4e4f9
fix(citations): 修复原文定位、高亮范围与 DocReader 启动失败 (#3794)
* fix(citations): verify source locations and recover document previews

* chore: exclude local research notes from pull request
2026-09-27 20:32:26 +08:00
wizardchen 4df7ccbb4f fix(chat): drop stale minimap-target class binding
The question-outline flash (minimapTargetId, its timer and CSS) was
removed in #3427, but #3469 brought back the :class binding on user
message rows. Vue then warned that minimapTargetId was accessed during
render on every render. data-message-id stays: the minimap uses it to
find jump targets.
2026-09-26 19:07:54 +08:00
wizardchen 9fcc2c6743 fix(dev): propagate dev.sh exit status and pull MinIO from pgsty/minio
scripts/dev.sh ended with an unconditional `exit 0`, so a failed
`make dev-start` (e.g. an image pull error) printed "服务启动失败" but still
reported success to callers and CI. Drop it so the script exits with the
status of the dispatched command; help still exits 0, unknown commands 1.

MinIO closed anonymous pulls on quay.io on 2026-09-24 (Docker Hub was
already gone), so quay.io/minio/minio now answers 401 for every tag and a
fresh `dev-start` fails. No registry serves RELEASE.2025-09-07T16-13-09Z
anonymously any more. Switch compose and Helm to the community rebuild
pgsty/minio, pinning RELEASE.2026-08-04T00-00-00Z where a tag was pinned
before, and update the docs that named quay.io.
2026-09-26 15:30:27 +08:00
wizardchen 6c83d7ab47 revert: take the plugin system back out of main
Reverts the eleven plugin system PRs merged on 2026-09-26 so they can be
reviewed before landing:

* a829d7cc9 agent tools served by plugins (#3733)
* 4f5d475c3 Jira example plugin (#3730)
* 01222aac8 dynamic form options, OAuth connections and resource limits (#3729)
* cf502ba46 event delivery and webhooks (#3728)
* 996696057 sandboxed plugin pages (#3727)
* da4ef68d9 standalone plugin hosts (#3725)
* 728007ada remote runtime, Python SDK (#3724)
* ff49f9491 Host API and document parsers (#3721)
* 4328ab26a code plugins (#3720)
* ed63e35cc declarative plugins (#3716)
* c91a8d11f plugin system foundation (#3711)

The tree is back to 47773b5bd, migrations included: no environment ran
the plugin migrations (versioned 000115-000119, sqlite 000034-000038).
2026-09-26 14:58:18 +08:00
lyingbug a829d7cc9c
feat(plugin): agent tools served by plugins, with result views (P2 batch 8) (#3733)
* feat(plugin): agent tools served by plugins, with result views
* fix(plugin): expand plugin tool views in place in the agent stream
2026-09-26 14:48:37 +08:00
lyingbug 4f5d475c3e
feat(examples): Jira Cloud plugin with OAuth, dynamic options and a skill (#3730)
* feat(examples): Jira Cloud plugin with OAuth, dynamic options and a skill
2026-09-26 14:48:00 +08:00
lyingbug 01222aac8e
feat(plugin): dynamic form options, OAuth connections and resource limits (P2 batch 7) (#3729)
* feat(plugin): dynamic form options, OAuth connections and resource limits
* fix(plugin): show what an options list waits for as a hint, not an error
2026-09-26 14:47:37 +08:00
lyingbug cf502ba46a
feat(plugin): event delivery and webhooks for plugins (P2 batch 6) (#3728)
* feat(plugin): event delivery and webhooks for plugins
2026-09-26 14:47:13 +08:00
lyingbug 996696057f
feat(plugin): sandboxed plugin pages and the @weknora/plugin-ui bridge (P2 batch 5) (#3727)
* feat(plugin): sandboxed plugin pages and the @weknora/plugin-ui bridge
* ci(pluginsdk): run the Python job's steps in bash on Windows too
2026-09-26 14:46:49 +08:00
lyingbug da4ef68d9d
feat(plugin): standalone plugin hosts with Redis discovery (P2 batch 4) (#3725)
* feat(plugin): standalone plugin hosts with Redis discovery
2026-09-26 14:46:26 +08:00
lyingbug 728007ada9
feat(plugin): remote runtime, Python SDK and python host plugins (P2 batch 3) (#3724)
* feat(plugin): remote runtime
* feat(plugin): Python SDK and python host plugins
* fix(pluginsdk): skip reverse DNS when a Python plugin binds
2026-09-26 14:46:03 +08:00
lyingbug ff49f9491d
feat(plugin): Host API with a key-value store, and document parsers from plugins (#3721)
* feat(plugin): Host API with plugin tokens and a key-value store
* feat(plugin): document parsers from code plugins
* docs(pluginsdk): parsers and the Host API
2026-09-26 14:45:39 +08:00
lyingbug 4328ab26a9
feat(plugin): code plugins — extension protocol, Go SDK, plugin host, web search and data source adapters (#3720)
* feat(pluginsdk): extension protocol v1, Go SDK and conformance suite
* feat(plugin): run code plugins in an embedded plugin host
* feat(plugin): remote adapters for web search and data sources
* fix(plugin): show plugin errors by their message
* feat(frontend): plugin connectors and web search providers in the UI
* docs(pluginsdk): how to write, package, test and install a plugin
* fix(plugin): gofmt two files and read openapi.yaml line-ending agnostic
* fix(plugin): mark a host plugin ready before Activate returns
2026-09-26 14:45:15 +08:00
lyingbug ed63e35cc7
feat(plugin): install declarative plugins — MCP servers, skills and model vendors (#3716)
* feat(plugin): install declarative plugin packages across nodes
* feat(plugin): serve installed plugins' MCP servers in each workspace
* feat(plugin): let installed plugins contribute skills and model vendors
* feat(plugin): register plugin skills into the workspace skill catalog
* feat(frontend): manage installed plugins and their configuration
* test(weaviate): read the class state before the probe barrier
* fix(plugin): keep MCP tool directories reachable behind the plugin wrapper
* test(plugin): wrap a long line
2026-09-26 14:44:34 +08:00
lyingbug c91a8d11f8
feat(plugin): plugin system foundation — builtin plugins, config schemas and workspace switches (#3711)
* feat(plugin): add plugin manifest, registry and builtin catalog
* feat(plugin): add config schemas with unified secret handling
* feat(frontend): render config schemas with SchemaForm
* feat(datasource): serve connector credential forms from the backend
* feat(im): describe IM platforms and credentials from the backend
* feat(frontend): render model vendor extra fields from the config schema
* feat(frontend): build the settings modal from an extension registry
* refactor(agent): register builtin tools and their chat views
* feat(plugin): let workspaces enable and disable plugins
* feat(plugin): add the runtime driver interface and gather builtins
2026-09-26 14:43:28 +08:00
wizardchen 47773b5bd1 fix(frontend): initialize chat citation popover after botmsg props
useCitationPopover watches its cache-scope getter, so Vue evaluates the
sessionId getter synchronously during setup. botmsg.vue called
useChatCitationPopover above defineProps, hitting the TDZ on `props` and
logging "Cannot access 'props' before initialization" whenever an
existing chat session rendered assistant messages.

Move the call below defineProps and add a test that compiles every SFC
calling a citation popover composable and runs its setup against the
real popover chain, so a caller reading props too early fails in CI.
2026-09-26 13:34:43 +08:00
niannian 4364e61afa
feat(datasource/yuque): preserve TOC folder hierarchy for synced documents (#3476)
* feat(datasource/yuque): preserve TOC folder hierarchy for synced documents

The Yuque connector emitted a bare "<title>.md" file name, and folder_path
is derived from FileName alone (SplitKnowledgeRelativePath ->
NormalizeKnowledgeFolderPath). With no "/" in the name the derived folder is
always empty, so every synced document landed at the knowledge base root no
matter where the book's TOC places it.

Read the book's TOC once per sync, fold it into a per-document path by walking
parent_uuid upward, and prepend the result to FileName. The GitLab connector
already works this way; this supplies the missing input rather than changing
the FileName -> folder_path machinery.

Three optional settings, all defaulting to the previous behaviour so the
emitted FileName stays byte-for-byte identical unless folder_mode is set to
"toc". A TOC failure degrades to flat names rather than failing the sync, and
the toc_only filter is skipped entirely when no TOC was fetched.

* feat(datasource/yuque): make toc_only an admission filter, drop include_book_title

Review follow-ups for the TOC folder hierarchy change.

toc_only used to run before the document was recorded for deletion detection,
so a document that was present in the source but not admitted came back as
IsDeleted — and with sync_deletions on, the sync service then deleted it from
the knowledge base. That is the wrong semantics for a key named after
filtering, and on Yuque it is unusually damaging: the web UI does not show
documents created through the API that were never attached to the TOC, so a
knowledge base is often the only place such a document can be reached at all.
A filtered document is now recorded as seen but not ingested, so enabling the
filter removes nothing. It is deliberately kept out of the cursor so that
admitting it later — by attaching it to the TOC, or by switching the filter
off — ingests it instead of dismissing it as unchanged.

include_book_title is removed. Leaving the book segment out silently merges
same-named top-level groups from different books, and the "which book"
dimension has no other carrier: the automatic tag granularity is one tag per
data source, not one per book. Under folder_mode=toc the book segment is now
unconditional; a source still carrying the key keeps syncing with the value
ignored.

Also supplies the UI the feature was missing — a Yuque-only folder_mode select
in the sync-strategy step, with newly created sources opting into the TOC
layout and existing ones left untouched — and documents both settings in the
Yuque section of the datasource guide.

* feat(datasource/yuque): expose the TOC admission filter in the datasource editor

UI follow-ups from review.

The folder-layout control now uses the pill-button group that the neighbouring
sync-mode and conflict-strategy settings already use, instead of a select — a
two-way choice was the only thing on that step rendered as a dropdown.

toc_only is exposed beside it, disabled unless the TOC layout is selected: the
connector only fetches the table of contents under folder_mode=toc, so the flag
does nothing in the flat layout, and the control says so. Its label names the
documents it admits as the ones visible in the Yuque table of contents, which
is what separates them from documents created through the API that were never
attached to one.

Drops the include_book_title paragraph from the datasource guide. That key was
never in a released build, so describing it as removed documents a history no
reader has; the tolerance test for unknown settings keys stays, without the
retired-key framing.

* docs(datasource): note Yuque folder-mode sync limitations

---------

Co-authored-by: niannian <10008660+RichardChengshaojin@users.noreply.github.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
Co-authored-by: lyingbug <xiayula2014@gmail.com>
2026-09-25 22:33:48 +08:00
Captain 1dd3fe867e
fix(docreader): drop data validation ranges openpyxl cannot parse instead of failing the sheet (#3599) (#3608)
* fix(docreader): drop data validation ranges openpyxl cannot parse instead of failing the sheet (#3599)

A Feishu sheet/bitable exported as .xlsx could fail to ingest with
"TypeError: expected <class 'openpyxl.worksheet.cell_range.MultiCellRange'>".
openpyxl reads a data validation's `sqref`, and a scenario list's, through a
converter that turns the real range-parse ValueError into that message and
aborts the whole workbook — in load_workbook (used by fill_merged_cells_xlsx)
and in pandas alike.

Measured on openpyxl 3.1.5, the version docreader locks: a whole column
(`C:C`), a whole row (`1:1`), a comma-separated list, `#REF!` and an
out-of-bounds range each raise it. Conditional formatting goes through the
same converter, but openpyxl already catches it there and drops the rule
with a warning, so it is left alone.

strip_unreadable_ranges_xlsx sits next to repair_xlsx_bytes and follows the
same contract: it returns rewritten bytes only when some range would fail
openpyxl's own MultiCellRange constructor — the exact step that raises — and
removes just those elements, logging how many. Every other workbook passes
through byte for byte. Neither element changes a cell's value, so dropping
one costs text extraction nothing, while keeping it cost the document.

* fix(docreader): strip unreadable ranges on the MarkItDown xlsx path too

MarkItDown reads spreadsheets through pandas/openpyxl, so a whole-column
data validation still failed that engine with FileConversionException
after the builtin engine was fixed (#3599). Run the same
strip_unreadable_ranges_xlsx pre-step before handing .xlsx to MarkItDown.

---------

Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-25 22:29:27 +08:00
Fei.Chen a7ac21ce76
fix(docreader): sanitize non-conforming styles.xml fills before openpyxl loads (#3637) (#3638)
* fix(docreader): sanitize non-conforming styles.xml fills before openpyxl loads

openpyxl raises TypeError('expected ... Fill') on <fill> elements with no
patternFill/gradientFill child — cloud-doc exporters, LabView and Acumatica
ERP emit these, upstream treats the workbooks as non-conformant, and both
parse engines died on files Excel opens fine (#3637).

Extend the zip-level repair module with sanitize_xlsx_styles: scan
xl/styles.xml, replace each malformed fill in place with a no-op
patternFill (index-preserving, so cellXf fillId references stay valid),
rewrite the zip only when something needed fixing. The builtin chain
retries the merge-cell prefill once on sanitized bytes; the markitdown
chain sanitizes xlsx/xlsm before MarkItDown sees them. Fixes #3637.

* fix(docreader): log sanitized fill count and never raise from the sanitizer

Fold review feedback into the styles sanitizer: a structured log line on
every repair (count included, doubling as the recurrence meter for #3637,
mirroring the sharedStrings repair log) and a never-raise wrapper so an
internal sanitizer failure passes the original bytes through instead of
trading the caller's error for its own.

* fix(docreader): read the workbook stylesheet by its exact part name

The styles sanitizer picked its part with a suffix match over a set of
zip member names, so a workbook that also carries
xl/richData/richStyles.xml (Excel 365 in-cell images / data types) got
the wrong part on some PYTHONHASHSEED values and skipped the repair.
Read xl/styles.xml, the one stylesheet openpyxl loads.

---------

Co-authored-by: vicfei <vicfei@users.noreply.github.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-25 22:23:57 +08:00
jacentsao e7c27ccc9e
feat(confluence): add directory sync and private image assets (#3319)
* feat(confluence): support page subtree selection

* feat(confluence): add private image asset resolver

* fix(confluence): preserve pages during partial syncs

* fix(confluence): cap total inlined image bytes per page

Up to 30 images of 10 MB each could be inlined as base64, and every
downstream conversion copies the page again, so one extreme page could
peak above 1 GB. Cap the data URIs a page holds, in the download cache
and the rewritten HTML, at 50 MB; images past the budget keep their
original src like any other skipped image.

---------

Co-authored-by: wizardchen <wizardchen@tencent.com>
Co-authored-by: lyingbug <xiayula2014@gmail.com>
2026-09-25 22:23:48 +08:00
quan020406 a7fc9e13da
fix(client): accumulate multiline SSE data (#2122)
* fix(client): accumulate multiline SSE data

* fix(client): skip empty SSE data frames and clear lint findings

Accumulating data lines turned a bare "data:" frame into an empty JSON
payload that aborted the stream; the old parser skipped it. Skip frames
whose joined payload is empty. Also use strings.TrimPrefix in
appendSSEDataLine and check Fprint results / drop unused params in the
new streaming tests.

---------

Co-authored-by: wizardchen <wizardchen@tencent.com>
Co-authored-by: lyingbug <xiayula2014@gmail.com>
2026-09-25 22:23:38 +08:00
xiaojunxiang 0bf105499b
fix(knowledge): reject invalid JSON uploads before async parse (#3360)
* fix(knowledge): reject invalid JSON uploads before async parse

Validate .json payloads at HTTP upload/replace time with the same gate used
by the simple JSON reader, so JSONC or truncated files fail with HTTP 400
instead of after document-process retries. CreateKnowledgeFromFile itself
skips the gate so datasource sync and IM still create a knowledge row that
fails in async parse.

Signed-off-by: xiaojunxiang <xiaojunxiang@kingsoft.com>

* fix(knowledge): localize JSON upload validation messages

The upload queue shows the backend message verbatim and the rest of the
upload handler speaks Chinese. Map ValidateJSONContent's errors (now
sentinels with unchanged text, still shared with the async JSON reader)
to Chinese messages at the upload/replace boundary.

---------

Signed-off-by: xiaojunxiang <xiaojunxiang@kingsoft.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
Co-authored-by: lyingbug <xiayula2014@gmail.com>
2026-09-25 22:23:27 +08:00
Perfecto 00e6366fd2
fix(datasource): validate cron schedules and persist manual-only mode (#3653)
* fix(datasource): preserve schedule state on invalid updates

* docs(datasource): document PUT /datasource/:id as a full replace

The update now always persists sync_schedule, so a partial body clears
the schedule. Show a full-object example and state that omitted fields
are reset rather than preserved.

---------

Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-25 22:23:18 +08:00
DerrickLinus a9d71038b6
fix(models): stop advertising graded thinking levels the wire format drops (#3552)
* fix(models): stop advertising graded thinking levels the wire format drops

A generic-provider row (relays, self-hosted runtimes — the default for
uncatalogued models) resolves an empty ThinkingLevelMap, whose missing-key
semantics report every graded rung as supported. Capabilities() then hands
minimal/low/medium/high to the frontend, which renders a selector whose
choice applyThinking silently discards: the chat-template-kwargs branch
sends only the enable_thinking boolean and no reasoning_effort is computed.
Same defect class as the two NVIDIA NIM entries fixed in #3489, but there
is no catalog entry to repair here.

Collapse Capabilities() to the levels the wire can actually express for a
boolean-only switch (off/auto) unless the settings opt into
supports_reasoning_effort. The vendor map itself is untouched, so vendors
that do carry effort keep their ladders.

* fix(models): carry reasoning_effort through the chat-template switch when opted in

The Capabilities() guard kept a vendor's ladder when it opts into
supports_reasoning_effort, but applyThinking's chat-template-kwargs branch
wrote only the enable_thinking boolean and dropped the already-computed
effort — so the opt-in combination still sent byte-identical bodies for
every graded rung (#3551's defect, alive in exactly the shape the review
flagged). Mirror the enable_thinking dialect: write reasoning_effort on
top of the switch when one was computed. A golden case pins the opt-in
combination; the no-opt-in guard case keeps asserting the level is
dropped.

* style(models): wrap long Resolve call in thinking-levels test

---------

Co-authored-by: wizardchen <wizardchen@tencent.com>
Co-authored-by: lyingbug <xiayula2014@gmail.com>
2026-09-25 22:23:08 +08:00
MercuialC c7601b2d2a
feat(wiki): 增加跨知识库 Wiki 搜索 POST /wiki-search (#3535)
* feat(wiki): add cross-KB wiki search POST /wiki-search

Give external callers a knowledge-search counterpart for wiki pages: one
SQL IN query ranked by title/slug/summary/content, slim hits with
match_snippet, and Viewer retrieve auth including shared KBs.

* fix(wiki): satisfy golangci-lint on cross-KB wiki search

Check c.Error returns, wrap lines over 120 columns, and use wikiDialect
instead of the embedded Dialector selector.

* fix(wiki): address review on cross-KB search helpers

Share KB viewer auth and snippet extraction, keep ID limits in the
service layer, and escape SQLite LIKE wildcards.

* fix(lint): wrap knowledge span fixtures over 120 columns

Go Lint still diffs from the original PR base, so later main tests
in knowledge_spans_test.go were reported as new line-length issues.

* fix(wiki): authorize KB access before checking wiki enablement in cross-KB search

Checking IsWikiEnabled before AuthorizeKBAccess let a caller tell apart a
foreign KB with wiki disabled (400) from one it cannot see (404), leaking
the KB's existence and settings. Run the access check first.

---------

Co-authored-by: root <root@localhost.localdomain>
Co-authored-by: wizardchen <wizardchen@tencent.com>
Co-authored-by: lyingbug <xiayula2014@gmail.com>
2026-09-25 22:22:58 +08:00
lyingbug 745a22d066
refactor(frontend): drop TTL resource caches and remove duplicate startup requests (#3562)
* refactor(frontend): drop TTL resource caches and remove duplicate startup requests

Space-level resource stores (chatResources / editorResources / organization)
cached lists for 60s. Pages that own the data bypassed the cache with force,
while side consumers (chat input bar, selectors) read stale values and relied
on a web of indirect refresh signals. Replace the TTL with in-flight
deduplication plus explicit invalidation:

- add stores/resourceCache.ts: createCachedResource (one request in flight
  per resource, force queues behind it, invalidate/markLoaded discard stale
  responses) and createKeyedSnapshotCache for per-id details
- rebuild chatResources / editorResources on those primitives; organization
  store drops its loadedAt timestamps and uses the request coordinator only
- isFresh -> isLoaded (only "has a snapshot" is meaningful now)

Fix concrete duplicates found on the way:

- /auth/me was fetched twice on every cold load (main.ts + UserMenu); auth
  store now dedupes in-flight calls and exposes ensureAuthMe, router hydrate
  reuses refreshFromAuthMe instead of a second copy of the persist logic
- /system/info was fetched by menu.vue directly next to editorResources
- /platform/settings rendered Settings.vue as the route component while the
  platform layout already mounts it, so two modals were visible and every
  settings panel request ran twice; the route now renders an empty view
- components that called listKnowledgeBases / listAgents / getParserEngines /
  getPromptTemplates directly now go through the stores
- Input-field no longer force-refreshes models and web-search providers on
  "settings closed" / "left settings route"; WebSearchSettings writes back to
  the shared snapshot and useTenantModelReadiness derives from the store

Measured with a mock backend: cold load 19 -> 18 requests (/auth/me once),
settings model panel 3 -> 2 (one modal), route changes now refetch lists
(creatChat 3 -> 9, back to KB list 0 -> 4) instead of serving 60s-old data.

* fix(frontend): fence stale responses in the resource caches and /auth/me refresh

Review follow-ups on the TTL removal:

- createKeyedSnapshotCache tracks a per-key revision; invalidate() and a
  force read both advance it, so a response that lands after invalidation
  or behind a newer request is handed to its caller but never written back
  into the snapshot. Previously a KB detail read still in flight during
  save could re-pin the pre-save detail until the next explicit invalidate.
- ensureKnowledgeBases / ensureAgents no longer reject when the shared
  resource fetch fails; the own list is already applied and the previous
  shared snapshot is kept. Callers migrated onto the store (manual editor,
  KB selector, FAQ manager, API integration page) had independent failure
  handling before. McpServerIntegrationSettings shows empty lists on
  failure instead of the last snapshot.
- /auth/me refresh is sequenced via a new createSequencedRefresh helper:
  refreshFromAuthMe() always resolves on a request issued after the call
  (queued behind an in-flight one), ensureAuthMe() shares in-flight, and
  logout() invalidates so a late response cannot re-apply the old session.

Tests: keyed cache invalidate-during-flight and force-overlap; sequencer
refresh ordering, invalidate after logout, and recovery after a failed
in-flight request.

* fix(frontend): refetch models after publishing a catalog change

invalidate() no longer triggers a refetch and the chat input stopped
reloading models when settings close, so the reasoning-level selector kept
stale capabilities after a catalog publish. Force-refresh the snapshot.
2026-09-25 22:22:48 +08:00
wizardchen 508048aee9 fix(frontend): mount the settings modal only once on /platform/settings
The platform shell always renders <Settings /> and opens it when the path is
/platform/settings, but the settings route also rendered Settings.vue into
the router outlet. Loading that URL mounted two independent modals: both
fetched their data, and a change saved in one left the other stale.

Keep the route for bookmarks, redirects and the close behaviour, but give it
a component that renders nothing.
2026-09-25 22:06:01 +08:00
wizardchen 22404e92b7 style(files): wrap long test case to satisfy lll 2026-09-25 21:46:12 +08:00
dafyy321-pixel 4668447aa6
fix(helm): pin application images to chart version (#3669)
Co-authored-by: dafyy321-pixel <dafyy321-pixel@users.noreply.github.com>
2026-09-25 18:52:02 +08:00
dvd233 0cb1e57fae
fix(container): propagate host project lookup errors (#3611) 2026-09-25 18:51:54 +08:00