Repository navigation
Conversation
A provider card counted as "configured" only when an API key was present, so a self-hosted MinerU endpoint that runs anonymously could never reach the backend selects: the config persisted, the probe never ran, and Save failed silently with no feedback. Gate the backend selects and the probe on a shared readiness check instead: a key, or - for providers that expose the self-hosted option - a self-hosted endpoint with a base URL. The Host already supports that case (resolve_target leaves the Authorization header empty when no key is stored), so this stays a frontend change. Probe failures now carry the Host message, so a rejected token or an unreachable endpoint no longer hides behind a silent grey dot. Also name the button Save instead of Confirm (it commits an inline form, not a dialog), explain the ordering where users look first - the backend menus only list configured providers - and point self-hosted users at Settings from the onboarding step. Refs poco-ai#1060
`biome ci .` has been failing on main since 2026-11-10 because two lines in scripts/rewrite-updater-json.mjs exceed the formatter width (the file was last touched by 46c6155 and never re-formatted). Formatting only, no behaviour change. Kept as a separate commit so it can be dropped if you would rather fix it on its own.
ttxl314
marked this pull request as ready for review
November 10, 2026 17:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
设置页里一个服务商只有填了 API Key 才算「已配置」,所以无鉴权的自建 MinerU 永远进不了上方「解析方式 / 正文解析引擎」下拉:配置存得下、探针不跑、点「保存」没有任何反馈。本 PR 用统一的就绪判定(有 key,或自建 + Base URL)同时决定下拉是否可选与是否探针,并让探针失败把 Host 的原因显示出来。
Closes #1060
类型
场景
docs/frontend/pdf-layout-analysis.md:159已经写明「自建 4.0 的 Token 由服务端--api-key决定(匿名部署可留空)」,但配置页把「有 key」等同于「已配置」:isProviderConfigured()与卡片里的configured都只判apiKey.trim().length > 0,persistConfig()在 key 为空时直接 early-return,探针因此从不执行。后果就是 #1060 的复现:Base URL 指向
http://127.0.0.1:8012、打开「自建 API」、Key 留空 → 点按钮无反应,下拉里没有 MinerU;只能随便填一个字符强行通过,而那个假值会进入Authorization头。Host 侧本来不需要这个限制:
resolve_target()在self_hosted且无 key 时返回空 auth,authed()在 auth 为空时不发Authorization。所以本 PR 是纯前端 + 文案,Rust 零改动。顺带补一个发现性问题:下拉为空时界面没有任何解释,用户会以为「这个 app 不支持 MinerU」。
主要改动
src/lib/pdf/layout/providers.tsisProviderReady(card, config)(有 key,或自建 + Base URL)与hasReadyProvider(cards, configs)src/lib/pdf/layout/provider-config.tspersistLayoutProviderConfig({ ready }),不传时保持「key 非空」旧语义;probeLayoutProvider返回{ ok, error }src/components/settings/panes/layout-pane.tsxisProviderReady;探针失败弹 toast 显示 Host 原因;下拉下方条件提示src/components/onboarding/steps/layout-step.tsxsrc/i18n/locales/{zh-CN,en}/settings.jsonlayout.menusHintsrc/i18n/locales/{zh-CN,en}/onboarding.jsonlayout.selfHostedHinttest/layout-provider-ready.test.tsisProviderReady6 条 +hasReadyProvider3 条)判定顺序是刻意的:有 key 即就绪(云服务行为完全不变)→ 无 key 才看自建开关 → 自建还必须给得出 base URL,因为
resolve_target()只认base_url,没地址一定失败。提示的显示条件是「一个远程服务商都没就绪」:它是冷启动引导,用户配好任意一个之后就已经掌握了「先配、再保存、才会出现」这条规则,届时收起避免常驻噪音。「配了 Paddle 但 MinerU 仍未配」这一情形不提示,属于有意取舍,并由单测锁定。
截图(UI / 功能改动必填)
answered neither /v1/health (4.x) nor /health (3.x)),而不是笼统的「不可用」备注:「之前」的引导截图取自 v0.15.3,该步骤标题已由
1f4e2072 feat(onboarding): rename the formula and figure parsing step更新,与本 PR 无关。Demo(feat 必填)
不适用(fix)。
自查清单
biome check --write,未使用--no-verify)pnpm typecheck、pnpm exec biome check、pnpm test(406 文件通过;settings-window-boot在全量并行时超时,单独运行通过,属既有 flaky)t()并同步zh-CNhttp://127.0.0.1:8012):settings.json:apiKey=""、selfHosted=true、baseUrl=http://127.0.0.1:8012,重启后仍有效https://mineru.net且自建开 → 探针 409 ms 失败,错误为MinerU self-hosted server https://mineru.net answered neither /v1/health (4.x) nor /health (3.x)pdf-layout-analysis.md:159已写明匿名自建可留空,本 PR 未改文档)范围外(不在本 PR)
resolve_target/authed已支持无鉴权自建,未改动。notifyError的既有副作用,localhost 连不上时会误报,另开跟进。关于额外的 chore(format) 提交
TypeScript (quality)在主干上自 2026-11-10 起就因scripts/rewrite-updater-json.mjs的格式化问题而失败(基点e8b4b510的 CI run 同样失败在同一处)。为让本分支的检查能通过,附带提交addbb3a5做了纯格式化修复(2 处换行,无行为变化);如不希望混入无关改动,可以单独拆出去。