文件最后提交记录最后更新时间
♻️ refactor(knowledge-base): share RAG runtime across client/server via KnowledgeBaseSearchService (#14673) * ♻️ refactor(knowledge-base): share runtime across client/server via KnowledgeBaseSearchService Extract a server-side `KnowledgeBaseSearchService` (semanticSearchForChat fan-out + getFileContents branching + groupAndRankFiles) so both the lambda chunk router and the builtin tool server runtime orchestrate RAG through one implementation. Wire the builtin knowledge-base tool to the shared ExecutionRuntime in the package by moving the client executor to `src/client/executor/` and registering a thin server runtime factory. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ♻️ refactor(knowledge-base): move PG 23505 handling into adapters, restore executor path ExecutionRuntime is dual-end so it cannot detect PG error codes — only the server adapter can. Move the unique-constraint check there and translate the lambda router's `FILE_ALREADY_IN_KNOWLEDGE_BASE` sentinel in the client adapter, so the runtime's generic catch surfaces the human-readable message on both code paths. Restore `src/executor/` as a top-level sibling of `src/client/` to match the convention of every other builtin tool. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ♻️ refactor(knowledge-base): collapse executor into /client, drop ./executor export The executor is just another client-only adapter (alongside Inspector and Render) — no reason for it to sit at the package root with a dedicated subpath. Move it under `src/client/executor/`, re-export from `src/client/index.ts`, drop the `./executor` entry from package.json, and update the consumer to import from `@lobechat/builtin-tool-knowledge-base/client`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ✅ test(knowledge-base): cover KnowledgeBaseSearchService 13 unit tests across both methods: - getFileContents: docs_* direct read, missing doc, file_* via findByFileId, parseFile fallback, parse failure surfaces as error entry, missing file, mixed batch. - semanticSearchForChat: chunk grouping + relevance ranking, BM25 skip when no knowledgeIds, knowledgeIds → fileIds expansion, vector/BM25 isolated failure capture (preserves the other path's results + structured rejections), full failure path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>12 天前
♻️ refactor(knowledge-base): share RAG runtime across client/server via KnowledgeBaseSearchService (#14673) * ♻️ refactor(knowledge-base): share runtime across client/server via KnowledgeBaseSearchService Extract a server-side `KnowledgeBaseSearchService` (semanticSearchForChat fan-out + getFileContents branching + groupAndRankFiles) so both the lambda chunk router and the builtin tool server runtime orchestrate RAG through one implementation. Wire the builtin knowledge-base tool to the shared ExecutionRuntime in the package by moving the client executor to `src/client/executor/` and registering a thin server runtime factory. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ♻️ refactor(knowledge-base): move PG 23505 handling into adapters, restore executor path ExecutionRuntime is dual-end so it cannot detect PG error codes — only the server adapter can. Move the unique-constraint check there and translate the lambda router's `FILE_ALREADY_IN_KNOWLEDGE_BASE` sentinel in the client adapter, so the runtime's generic catch surfaces the human-readable message on both code paths. Restore `src/executor/` as a top-level sibling of `src/client/` to match the convention of every other builtin tool. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ♻️ refactor(knowledge-base): collapse executor into /client, drop ./executor export The executor is just another client-only adapter (alongside Inspector and Render) — no reason for it to sit at the package root with a dedicated subpath. Move it under `src/client/executor/`, re-export from `src/client/index.ts`, drop the `./executor` entry from package.json, and update the consumer to import from `@lobechat/builtin-tool-knowledge-base/client`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ✅ test(knowledge-base): cover KnowledgeBaseSearchService 13 unit tests across both methods: - getFileContents: docs_* direct read, missing doc, file_* via findByFileId, parseFile fallback, parse failure surfaces as error entry, missing file, mixed batch. - semanticSearchForChat: chunk grouping + relevance ranking, BM25 skip when no knowledgeIds, knowledgeIds → fileIds expansion, vector/BM25 isolated failure capture (preserves the other path's results + structured rejections), full failure path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>12 天前