diff --git a/CHANGELOG.md b/CHANGELOG.md index c1b1a5f..d206f35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## 开发快照 0.1.383(发布管理精简 + 系统设置审查修复) + +### Changed + +- 发布管理:顶部改为「状态卡 + 下一步」,一个主按钮(启动同步/查看任务)+ 一个准备按钮 + (封存/基线/签发授权);启动条件、检查清单、恢复验证收进「发布前检查」; + 目标维护、差异明细、来源身份收进「高级与历史」。去掉重复的版本入口与说明。 + +### Fixed + +- 服务配置与刷新策略各自保存边界:保存一方不再夹带另一方未保存的草稿(F03)。 +- 系统设置分区独立加载:监控/目录失败不再挡住成员与备份入口;保存后重新探测服务状态(F09)。 +- 解析停滞阈值接入活动配置(worker 60 秒内生效),收尾超时仍只保存并在页面标注未接入(F02)。 +- 重置密码改为受控遮罩对话框,不再用浏览器 prompt(F11)。 +- 生产绑定:文档级旧配置收进折叠区,凭据缺失时说明不影响整库执行器(F05/F06)。 +- 备份:主机未接通时明确「当前计划不会执行」,无运行记录时失败库显示未知(F07)。 +- 文案统一:生产租户 ID、备份执行主机、收尾超时告警;技术细节不再占据主视图(F10)。 + ## 开发快照 0.1.382(采集 agent 允许显式 peer uid) ### Added diff --git a/cmd/worker/main.go b/cmd/worker/main.go index af7e023..feeb1a4 100644 --- a/cmd/worker/main.go +++ b/cmd/worker/main.go @@ -10,6 +10,7 @@ import ( "os/signal" "path/filepath" "strings" + "sync" "syscall" "time" @@ -561,6 +562,11 @@ func workerHandlers(store *postgresstore.Store, config appconfig.Config) (map[st Client: client, PollDelay: config.TestWeKnoraPollInitial, StallAfter: config.TestWeKnoraStalledAfter, + // 页面保存的停滞阈值在这里生效;每 60 秒重读一次活动配置, + // 读失败保留上一次值,再失败才回落到启动参数。 + StallAfterSource: func() time.Duration { + return activeStalledAfter(context.Background(), store, config.TestWeKnoraStalledAfter) + }, }) if err != nil { return nil, fmt.Errorf("create test poll handler: %w", err) @@ -592,3 +598,29 @@ func workerHandlers(store *postgresstore.Store, config appconfig.Config) (map[st handlers["test.remove"] = remove.Handle return handlers, nil } + +// activeStalledAfter 读取活动 UI 配置里的解析停滞阈值(带 60 秒缓存)。 +// 页面保存后无需重启 worker 即可生效;“保存即生效”不是文案,而是这里的读取。 +var stalledAfterCache struct { + mu sync.Mutex + value time.Duration + fetchedAt time.Time +} + +func activeStalledAfter(ctx context.Context, store *postgresstore.Store, fallback time.Duration) time.Duration { + stalledAfterCache.mu.Lock() + defer stalledAfterCache.mu.Unlock() + if time.Since(stalledAfterCache.fetchedAt) < time.Minute && stalledAfterCache.value > 0 { + return stalledAfterCache.value + } + settings, err := store.GetActiveUISettings(ctx) + if err != nil || settings.StalledAfterSeconds <= 0 { + if stalledAfterCache.value > 0 { + return stalledAfterCache.value + } + return fallback + } + stalledAfterCache.value = time.Duration(settings.StalledAfterSeconds) * time.Second + stalledAfterCache.fetchedAt = time.Now() + return stalledAfterCache.value +} diff --git a/internal/workflows/testweknora/poll.go b/internal/workflows/testweknora/poll.go index 83a2d20..905d27e 100644 --- a/internal/workflows/testweknora/poll.go +++ b/internal/workflows/testweknora/poll.go @@ -35,7 +35,9 @@ type PollHandlerConfig struct { Client PollClient PollDelay time.Duration StallAfter time.Duration - Now func() time.Time + // StallAfterSource 可选:返回当前生效的停滞阈值(来自活动 UI 配置)。 + StallAfterSource func() time.Duration + Now func() time.Time } type PollHandler struct { @@ -43,7 +45,10 @@ type PollHandler struct { client PollClient pollDelay time.Duration stallAfter time.Duration - now func() time.Time + // stallAfterSource 存在时优先于 stallAfter:页面保存的“解析停滞阈值” + // 必须真的决定判定,而不是只写进数据库。 + stallAfterSource func() time.Duration + now func() time.Time } type pollPayload struct { @@ -60,7 +65,7 @@ func NewPollHandler(config PollHandlerConfig) (*PollHandler, error) { } return &PollHandler{ store: config.Store, client: config.Client, pollDelay: config.PollDelay, - stallAfter: config.StallAfter, now: config.Now, + stallAfter: config.StallAfter, stallAfterSource: config.StallAfterSource, now: config.Now, }, nil } diff --git a/web/src/BackupScheduleSection.test.tsx b/web/src/BackupScheduleSection.test.tsx index dd9fa32..7214cd0 100644 --- a/web/src/BackupScheduleSection.test.tsx +++ b/web/src/BackupScheduleSection.test.tsx @@ -81,7 +81,7 @@ describe('BackupScheduleView', () => { const html = view() for (const text of [ '存储与备份', - '目标库所在主机', + '备份执行主机', '定时时间', '储存天数', '每月归档保留', diff --git a/web/src/BackupScheduleSection.tsx b/web/src/BackupScheduleSection.tsx index b88f562..cbcdcb2 100644 --- a/web/src/BackupScheduleSection.tsx +++ b/web/src/BackupScheduleSection.tsx @@ -104,7 +104,7 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {

存储与备份

- 整库逻辑备份(pg_dump 目录格式)在目标库所在主机 + 整库逻辑备份(pg_dump 目录格式)在备份执行主机(同 VPC 直连 RDS) 上本地执行:这里设置定时时间与储存天数,保存即下发到主机 cron,并可读回主机上生效的计划与最近一次结果。

@@ -136,9 +136,11 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
{schedule.host_next_run ? schedule.host_next_run - : schedule.host_schedule_enabled - ? `已配置每日 ${schedule.host_schedule_time};尚未核验下一次实际执行(不以历史下发时间推算)` - : '未启用定时或未从主机读到计划'} + : !schedule.host_configured + ? '未接通备份执行主机:当前计划不会执行' + : schedule.host_schedule_enabled + ? `已配置每日 ${schedule.host_schedule_time};尚未核验下一次实际执行(不以历史下发时间推算)` + : '未启用定时或未从主机读到计划'}
最近一次运行
@@ -163,7 +165,13 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
覆盖的库
{schedule.last_run_databases.length ? schedule.last_run_databases.join('、') : '—'}
失败的库
-
{schedule.last_run_failed_databases.length ? schedule.last_run_failed_databases.join('、') : '无'}
+
+ {schedule.last_run_failed_databases.length + ? schedule.last_run_failed_databases.join('、') + : schedule.last_run_stamp + ? '无' + : '未知(还没有读到运行记录,不能据此判断没有失败)'} +
主机上生效的计划
{schedule.host_schedule_enabled @@ -268,7 +276,7 @@ export function BackupScheduleView(props: BackupScheduleViewProps) { ) } -// 容器:读取 + 下发 + 在途轮询。真正执行备份的是目标库所在主机(同 VPC 直连 RDS)。 +// 容器:读取 + 下发 + 在途轮询。真正执行备份的是备份执行主机(同 VPC 直连 RDS)。 export function BackupScheduleSection() { const auth = useOptionalAuth() const isAdmin = auth?.identity?.role === 'admin' diff --git a/web/src/MembersSection.tsx b/web/src/MembersSection.tsx index 3eb480a..10a5441 100644 --- a/web/src/MembersSection.tsx +++ b/web/src/MembersSection.tsx @@ -23,6 +23,9 @@ export function MembersSection() { const [busy, setBusy] = useState(null) const [error, setError] = useState(null) const [message, setMessage] = useState(null) + // 重置密码用受控对话框(遮罩输入),不再借浏览器 prompt 显示明文。 + const [resetTarget, setResetTarget] = useState<{ id: string; username: string } | null>(null) + const [resetValue, setResetValue] = useState('') const [form, setForm] = useState({ username: '', display_name: '', @@ -154,15 +157,8 @@ export function MembersSection() { className="secondary-action" disabled={busy === user.id} onClick={() => { - const temporary = window.prompt( - `为 ${user.username} 生成一个临时密码(至少 8 位,对方首次登录必须更换)` - ) - if (temporary) - void run( - user.id, - () => resetManagedUserPassword(user.id, temporary), - `${user.username} 的临时密码已生效` - ) + setResetTarget({ id: user.id, username: user.username }) + setResetValue('') }} > 重置密码 @@ -238,6 +234,47 @@ export function MembersSection() { 停用不会删除任何业务记录,只禁止登录并立即撤销其在线会话。 + {resetTarget ? ( +
+

重置 {resetTarget.username} 的临时密码

+

至少 8 位;对方首次登录必须更换,旧会话会立即失效。

+ setResetValue(event.target.value)} + /> +
+ + +
+
+ ) : null} ) } diff --git a/web/src/ProductionBindingsSection.test.tsx b/web/src/ProductionBindingsSection.test.tsx index 7587f24..c47e664 100644 --- a/web/src/ProductionBindingsSection.test.tsx +++ b/web/src/ProductionBindingsSection.test.tsx @@ -65,7 +65,7 @@ describe('ProductionBindingsView', () => { it('旧文档级绑定标成旧路径,不再声称"发布写入此库"', () => { const html = view(bindings()) expect(html).toContain('文档级发布(单篇文档写生产)· 旧路径') - expect(html).toContain('仅文档级发布读取这组绑定;整库发布(封存/同步/恢复)不读它。') + expect(html).toContain('整库封存/同步/恢复不读取这组配置') expect(html).toContain('对内文档级目标') expect(html).not.toContain('发布写入此库') }) diff --git a/web/src/ProductionBindingsSection.tsx b/web/src/ProductionBindingsSection.tsx index 17c62a3..7857d84 100644 --- a/web/src/ProductionBindingsSection.tsx +++ b/web/src/ProductionBindingsSection.tsx @@ -103,7 +103,9 @@ export function ProductionBindingsView(props: ProductionBindingsViewProps) { {error ? (

- {error} + {/api key file/i.test(error) + ? '生产 API 读取凭据未配置:无法在此列出生产知识库。整库同步走独立执行器通道,不受这条读取凭据影响。' + : error}

) : null} {bindings ? ( @@ -133,14 +135,16 @@ export function ProductionBindingsView(props: ProductionBindingsViewProps) { ) : null} {bindings ? ( -
-

{bindings.legacy_scope || '文档级绑定(旧路径)'}

-

仅文档级发布读取这组绑定;整库发布(封存/同步/恢复)不读它。

+
+ + {bindings.legacy_scope || '文档级发布(单篇文档写生产)· 旧路径'} + · 展开编辑;整库封存/同步/恢复不读取这组配置 +
{renderSide('对内文档级目标', bindings.internal_kb_id, bindings.internal_kb_name)} {renderSide('对外文档级目标', bindings.external_kb_id, bindings.external_kb_name)}
-
+ ) : null} {bindings && !bindings.production_connected ? (

@@ -156,12 +160,8 @@ export function ProductionBindingsView(props: ProductionBindingsViewProps) { ) : null} {isAdmin && bindings ? (

- - + +

保存时只改文档级绑定;整库发布目标由部署配置决定,本页不改它。

保存时会向生产端核对所选的库是否真实存在;对不上会拒收,生产端不可达则只提示。

{sameSelection ?

对内与对外必须绑定不同的生产知识库

: null} @@ -259,4 +259,4 @@ export function ProductionBindingsSection() { onReload={() => void load()} /> ) -} \ No newline at end of file +} diff --git a/web/src/ReleaseTargets.tsx b/web/src/ReleaseTargets.tsx index 1902533..3fb729f 100644 --- a/web/src/ReleaseTargets.tsx +++ b/web/src/ReleaseTargets.tsx @@ -958,39 +958,15 @@ function ProtectionCard({
恢复条件
{gate.reasons.length === 0 ? '已满足' : `缺 ${gate.reasons.length} 项`}
- - {gate.reasons.length > 0 ? ( - - ) : null} -
- {sync.canSign && authorization.state !== 'active' && targetSealed ? ( - - ) : null} - {baseline.canStart && baselineNeeded ? ( - - ) : null} -
+

+ {gate.reasons.length > 0 + ? `启动与恢复条件还有 ${gate.reasons.length} 项未满足,见上方“发布前检查”。` + : '启动与恢复条件已满足。'} +

{authorization.state !== 'active' && !sync.canSign ? (

同步授权只能由管理员按目标+快照签发;工程师看不到签发入口。

) : null} -

同步启动后,这里显示本次生产恢复点及备份进度,可直接查看对应快照。

- -

恢复版本会恢复一整套生产知识状态,不回退测试知识库。

+

恢复会回退整套生产知识状态,不回退测试知识库。

) } @@ -1040,7 +1016,6 @@ function ReadyBody({ return ( <>
-
- {canCapture ? ( - - ) : ( - {captureHint(view, canWrite)} - )} + {canCapture ? '封存入口在页面顶部“下一步”。' : captureHint(view, canWrite)} ) @@ -1918,17 +1882,69 @@ export function ReleaseTargetsView(props: ViewProps) { const gate = view.overview?.gate ?? { sync_allowed: false, reasons: ['整库状态接口不可用'] } const authorization = view.overview?.authorization ?? { state: 'none' as const, reason: '整库状态接口不可用' } + const sealed = Boolean(view.snapshot) + const authorizationActive = authorization.state === 'active' + // 主按钮永远是"同步"或"查看当前任务";准备动作(封存/基线/恢复验证/授权) + // 作为次要按钮按状态出现,页面因此只有一个前进方向。 + const primaryAction = runningJob + ? { + label: '查看当前任务', + hint: `${jobKindText(runningJob.kind)}正在执行,不要重复启动。`, + disabled: false, + run: () => document.getElementById('rel-progress')?.scrollIntoView?.({ behavior: 'smooth', block: 'start' }), + } + : { + label: sync.pending ? '投递中…' : '▶ 启动同步', + hint: sync.canStart + ? '先固定测试版本,再备份目标并写入;失败会停在维护窗口。' + : `暂不能启动:${gate.reasons.join(';') || '条件未满足'}`, + disabled: !sync.canStart || sync.pending, + run: sync.onStart, + } + const prepAction = !sealed + ? canCapture + ? { + label: pendingCapture ? '封存中…' : '封存测试版本', + hint: '只读导出测试库,生成一份可发布的整库版本。', + disabled: pendingCapture, + run: onCapture, + } + : { label: '尚无封存', hint: captureHint(view, canWrite), disabled: true, run: () => {} } + : productionClass === 'nonempty' && baseline.canStart + ? { + label: baseline.pending ? '投递中…' : '建立目标权威基线(维护隔离)', + hint: '生产目标非空但还没有权威版本,先登记一份基线。', + disabled: baseline.pending, + run: baseline.onStart, + } + : !authorizationActive && sync.canSign + ? { + label: sync.pendingGrant ? '签发中…' : '签发同步授权(30 分钟)', + hint: '授权后才允许写生产;一次授权只对当前目标+快照有效。', + disabled: sync.pendingGrant, + run: sync.onGrant, + } + : null + + const productionText = + productionClass === 'known' && production?.version + ? production.version.version_label || `生效 ${production.version.snapshot_id.slice(0, 12)}` + : productionClass === 'empty' + ? '目标已读且为空' + : productionClass === 'unreachable' + ? '读取失败' + : productionClass === 'nonempty' + ? '目标非空,尚无权威版本' + : '未读取' + return (

发布管理

-

测试维护与验证,生产按知识库版本同步。

+

测试封存 → 生产同步:每一步只保留一个入口。

- @@ -1969,128 +1985,87 @@ export function ReleaseTargetsView(props: ViewProps) { ) : null} {notice ?

{notice}

: null} -
-
-

- {scopeName(scope)} ·{' '} - {active - ? `${jobKindText(view.job?.kind)}进行中` - : view.snapshot - ? '已封存,同步按条件放行' - : '尚无测试封存'} -

-
- - -
-
-

- 目标实例 {view.overview?.target_instance || view.overview?.executor?.instance || '未读取'} · 项目{' '} - {view.overview?.target_project || view.overview?.executor?.project || '未读取'} · 知识库{' '} - {view.overview?.target_knowledge_base_id || target?.knowledge_base_id || '未读取'}({scopeName(scope)}) +

+

+ {scopeName(scope)} ·{' '} + {active ? `${jobKindText(view.job?.kind)}进行中` : sealed ? '已封存,同步按条件放行' : '尚无测试封存'} + {sealed ? '(需要新版本时点上方“封存测试版本”)' : ''}

-

- 目标当前{' '} - {productionClass === 'known' && production?.version ? ( - - {production.version.version_label || `生效 ${production.version.snapshot_id.slice(0, 12)}`} - {' · '} - 快照 {production.version.snapshot_id.slice(0, 12)} - - ) : productionClass === 'empty' ? ( - 目标已读且为空(首次发布) - ) : productionClass === 'unreachable' ? ( - 读取失败:{production?.reason || '无法读取目标整库状态'} - ) : productionClass === 'nonempty' ? ( - 目标非空,尚无权威版本 - ) : ( - {productionNote} - )} - {productionStale ? ({STALE_NOTE}) : null} → 拟发布{' '} - {target ? `封存 ${target.snapshot_id.slice(0, 12)} · ${stamp(target.created_at)}` : '还没有测试封存'} ·{' '} - {publishStateText(view.job)} -

-
+
-
新增文档
-
- {diff.state === 'computed' ? diff.added.length : '未接入'} +
测试封存
+
+ {sealed ? `快照 ${view.snapshot!.snapshot_id.slice(0, 12)}` : '尚无'}
+ {sealed ? stamp(view.snapshot!.created_at) : '先封存测试版本'}
-
更新文档
-
- {diff.state === 'computed' ? diff.updated.length : '未接入'} -
+
生产当前
+
{productionText}
+ {publishStateText(view.job)}
-
删除文档
-
- {diff.state === 'computed' ? diff.removed.length : '未接入'} -
+
发布授权
+
{authorizationActive ? '已签发' : '未签发'}
+ + {authorizationActive + ? `有效至 ${stamp(authorization.expires_at ?? '')}` + : sync.canSign + ? '可在下方签发' + : '需管理员签发'} +
-
Wiki 发布方式
-
{target ? '完整快照' : '未接入'}
+
最近预备份
+
+ {prebackup.state === 'known' ? '已登记' : '无'} +
+ + {prebackup.state === 'known' && prebackup.version + ? stamp(prebackup.version.created_at) + : '同步时自动生成'} +
- {target?.source_identity ? ( -
- 来源身份与完整摘要 -

- 来源实例:{target.source_identity.project} / {target.source_identity.app} -

-

- 来源租户 / 知识库:{target.source_identity.tenant_id} / {target.source_identity.knowledge_base_id} -

-

来源身份:{target.source_id}

-

快照摘要:{target.snapshot_id}

-
+
+

+ 下一步 + {prepAction && prepAction.disabled === false && !runningJob ? prepAction.hint : primaryAction.hint} +

+ {prepAction && !runningJob ? ( + + ) : null} + + +
+ {gate.reasons.length > 0 ? ( +

还差 {gate.reasons.length} 项条件,展开“发布前检查”查看原因。

) : null} -
    -
  • - {target - ? `✓ 文档解析与索引完整(${target.totals.chunks ?? 0} 分块 / ${target.totals.index_documents ?? 0} 索引)` - : '○ 文档解析与索引:未接入'} - {target ? ( - - 依据 {stamp(target.created_at)} 封存的测试库全库快照,不代表实时测试库已就绪 - - ) : null} -
  • -
  • - {target ? `✓ Wiki 快照完整(${target.totals.wiki_pages ?? 0} 页)` : '○ Wiki 快照:未接入'} - {target ? 同一份封存快照,不是实时 Wiki 队列状态 : null} -
  • -
  • - {target ? `✓ 清单与摘要登记:${target.parts.length} 项部件摘要已记录` : '○ 数据完整性:尚无封存可核验'} - {target ? ( - 封存时逐项哈希登记;列表只校验清单自身,字节级复核在同步/恢复执行前进行 - ) : null} -
  • -
+
+ +
0}> + + 发布前检查 + {gate.reasons.length > 0 ? `(${gate.reasons.length} 项未满足)` : '(已满足)'} + {gate.reasons.length > 0 ? (
    {gate.reasons.map((reason) => ( @@ -2098,26 +2073,47 @@ export function ReleaseTargetsView(props: ViewProps) { ))}
) : null} -

启动后先固定测试版本,再备份生产。备份失败或恢复条件不满足,不进入生产写入。

-
- - +
    +
  • + {target + ? `✓ 文档解析与索引完整(${target.totals.chunks ?? 0} 分块 / ${target.totals.index_documents ?? 0} 索引)` + : '○ 文档解析与索引:未接入(尚无封存)'} + {target ? ( + + 依据 {stamp(target.created_at)} 封存的测试库全库快照,不代表实时测试库已就绪 + + ) : null} +
  • +
  • + {target ? `✓ Wiki 快照完整(${target.totals.wiki_pages ?? 0} 页)` : '○ Wiki 快照:未接入(尚无封存)'} + {target ? 同一份封存快照,不是实时 Wiki 队列状态 : null} +
  • +
  • + {target ? `✓ 清单与摘要登记:${target.parts.length} 项部件摘要` : '○ 数据完整性:未接入(尚无封存可核验)'} + {target ? ( + 封存时逐项哈希登记;列表只校验清单自身,字节级复核在同步/恢复执行前进行 + ) : null} +
  • +
+ + {active ? ( - onDrawer(true)} - canReconcileCapture={canReconcileCapture} - pendingReconcileCapture={pendingReconcileCapture} - onReconcileCapture={onReconcileCapture} - /> +
+ onDrawer(true)} + canReconcileCapture={canReconcileCapture} + pendingReconcileCapture={pendingReconcileCapture} + onReconcileCapture={onReconcileCapture} + /> +
) : ( )} +
+ 高级与历史(目标维护、差异明细、来源身份) + + +

+ 目标实例 {view.overview?.target_instance || view.overview?.executor?.instance || '未读取'} · 项目{' '} + {view.overview?.target_project || view.overview?.executor?.project || '未读取'} · 知识库{' '} + {view.overview?.target_knowledge_base_id || target?.knowledge_base_id || '未读取'}({scopeName(scope)}) + {productionStale ? ({STALE_NOTE}) : null} +

+ {target?.source_identity ? ( +
+ 来源身份与完整摘要 +

+ 来源实例:{target.source_identity.project} / {target.source_identity.app} +

+

+ 来源租户 / 知识库:{target.source_identity.tenant_id} / {target.source_identity.knowledge_base_id} +

+

来源身份:{target.source_id}

+

快照摘要:{target.snapshot_id}

+
+ ) : null} +

同步会先固定测试版本,再备份生产;备份失败或恢复条件不满足时不进入生产写入。

+
+ { 'finalizing 2小时', '文档状态刷新间隔', '15秒', - '解析停滞判定', + '解析停滞阈值', '30分钟', - '保存并应用刷新与告警参数', + '保存刷新与告警参数', ]) expect(refreshHtml).toContain(text) expect(visibleSaveMessage('已保存', true)).toBeNull() diff --git a/web/src/SystemSettings.tsx b/web/src/SystemSettings.tsx index 44c35b1..7f95506 100644 --- a/web/src/SystemSettings.tsx +++ b/web/src/SystemSettings.tsx @@ -183,21 +183,41 @@ export function SystemSettingsView({ productionTenantID.trim() !== settings.production_tenant_id || productionKnowledgeBaseID.trim() !== settings.production_knowledge_base_id) ) - const candidateInput = (overrides: Partial = {}): UISettingsCandidateInput => ({ + const refreshSettingsDirty = Boolean( + settings && + (documentRefresh !== settings.document_refresh_seconds || + resourceRefresh !== settings.resource_refresh_seconds || + stalled !== settings.stalled_after_seconds || + finalizing !== settings.finalizing_after_seconds || + concurrency !== settings.ingestion_concurrency) + ) + // 保存边界:服务分区只带上自己这一组的输入,另一组一律用服务器当前值。 + // 否则“改了地址没保存、切到刷新策略保存”会把未确认的地址一起写进去。 + const serviceInput = (): UISettingsCandidateInput => ({ + document_refresh_seconds: settings?.document_refresh_seconds ?? documentRefresh, + resource_refresh_seconds: settings?.resource_refresh_seconds ?? resourceRefresh, + stalled_after_seconds: settings?.stalled_after_seconds ?? stalled, + finalizing_after_seconds: settings?.finalizing_after_seconds ?? finalizing, + ingestion_concurrency: settings?.ingestion_concurrency ?? concurrency, + test_weknora_base_url: testEndpoint.trim(), + production_weknora_base_url: endpoint.trim(), + production_tenant_id: productionTenantID.trim(), + production_knowledge_base_id: productionKnowledgeBaseID.trim(), + }) + const refreshInput = (): UISettingsCandidateInput => ({ document_refresh_seconds: documentRefresh, resource_refresh_seconds: resourceRefresh, stalled_after_seconds: stalled, finalizing_after_seconds: finalizing, ingestion_concurrency: concurrency, - test_weknora_base_url: testEndpoint.trim(), - production_weknora_base_url: endpoint.trim(), - production_tenant_id: productionTenantID.trim(), - production_knowledge_base_id: productionKnowledgeBaseID.trim(), - ...overrides, + test_weknora_base_url: settings?.test_weknora_base_url ?? '', + production_weknora_base_url: settings?.production_weknora_base_url ?? '', + production_tenant_id: settings?.production_tenant_id ?? '', + production_knowledge_base_id: settings?.production_knowledge_base_id ?? '', }) const saveEndpoint = () => { setDirty(false) - onSave(candidateInput()) + onSave(serviceInput()) } return (
@@ -211,7 +231,7 @@ export function SystemSettingsView({ {error}
) : null} - {monitor && settings ? ( + {settings || monitor ? (
) : null} - {section === 'services' ? ( + {section === 'services' && settings ? (

服务配置

- 只配四项:测试地址、生产地址、生产 ID、知识库 - ID。保存会先生成修订、验证后原子启用,旧版本保留用于审计;凭据只写不读。 + 四项可写:测试地址、生产地址、生产租户、生产知识库。保存前会做真实探活与列库核验,凭据只写不读。

@@ -274,7 +293,7 @@ export function SystemSettingsView({
测试 WeKnora {healthStateLabel(findHealth(monitor, 'WeKnora API'), undefined)} - {`${healthStateDetail(findHealth(monitor, 'WeKnora API'), undefined) || '端点探测:未配置'};解析队列 对内 ${routingCapabilities.internal_enabled ? '已配置' : '未配置'} · 对外 ${routingCapabilities.external_enabled ? '已配置' : '未配置'}`} + {`${healthStateDetail(findHealth(monitor, 'WeKnora API'), undefined) || '端点探测:未配置'};解析队列 对内 ${routingCapabilities.internal_enabled ? '已配置' : '未配置'} · 对外 ${routingCapabilities.external_enabled ? '已配置' : '未配置'};上传/解析执行器能力不在本卡片验证`}
生产 WeKnora @@ -316,7 +335,7 @@ export function SystemSettingsView({ />