feat: 知识批量沉淀改为后台任务,避免 nginx 504

- /ingest/threads/batch 新增 background 参数(默认 true),立即返回 {queued:true}
- 抽取循环抽出 _run_batch_ingest,后台路径显式传入 created_by
- 前端知识库页与输入框、线程 hooks/types 配套调整
- config.yaml 上下文压缩测试值

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
吉鑫升andClaude Opus 4.8 committed 2026-06-16 21:07:17 +08:00
1 parent b380575f16
commit 342fa8265a
12 files changed
+170 -22

No files matched your search

+9
View File
@@ -147,6 +147,13 @@ export interface BatchIngestPayload {
include_sources?: boolean;
skip_existing?: boolean;
mode?: "summary" | "full";
/**
* When true (default), the backend runs the per-thread extraction loop in a
* background task and returns immediately (`queued:true`) instead of blocking
* the request until every thread is processed — which otherwise outlives the
* nginx gateway timeout and surfaces as a generic "request failed".
*/
background?: boolean;
/** Optional model override for knowledge extraction (null = configured default). */
model_name?: string | null;
/** Optional extraction-prompt template id (null = scope default). */
@@ -157,6 +164,8 @@ export interface BatchIngestPayload {
export interface BatchIngestResult {
ok: boolean;
/** True when the backend queued the batch as a background task (see payload). */
queued?: boolean;
processed: number;
created: number;
skipped: number;