refactor(kb-base): 正交提取 ChunkingStrategyPanel 等 4 个内联组件和 format-utils 到 _components 目录 - #550
Merged
Merged
Conversation
… 到 _components 目录; 将 knowledge/base/page.tsx 中的 4 个内联组件(ChunkingStrategyPanel 1491行、 CorpusSettingsPanel 364行、CorpusStatusBadge、DocumentMetadataPanel) 及 5 个工具函数(formatCorpusConfigSummary、formatFileSize、formatDateTime、 formatChunkLabel、toDocumentChunkCardViewModel)提取为独立模块, page.tsx 从 2064 行降至 1239 行,净减 825 行。 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini Code Assist](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
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.
背景
knowledge/base/page.tsx是一个 2,064 行的超大单体文件,其中ChunkingStrategyPanel(1,491行)和CorpusSettingsPanel(364行)等内联组件与主页面组件严重耦合,违反正交分解与单一职责原则核心变更
page.tsx正交提取 4 个内联组件到_components/目录:ChunkingStrategyPanel(322行)、CorpusSettingsPanel(389行)、CorpusStatusBadge(18行)、DocumentMetadataPanel(59行)_components/format-utils.ts(75行):formatCorpusConfigSummary、formatFileSize、formatDateTime、formatChunkLabel、toDocumentChunkCardViewModelpage.tsx从 2,064 行降至 1,239 行,净减 825 行(-40%)风险与回滚
git revert验证证据
KnowledgeBasePage.test.tsx等测试文件pnpm exec tsc --noEmit零新增错误影响范围
apps/negentropy-ui/app/knowledge/base/目录下 6 个文件(1 修改 + 5 新增)Next Best Action
knowledge-api.ts(3,063行)、conversation-tree.ts(1,815行)等超大文件执行正交分解(需先完成内部依赖图分析)