refactor(settings): Phase B1 PR1 — 抽出 types.ts + helpers.ts#10
Open
oneMuggle wants to merge 1 commit into
Open
refactor(settings): Phase B1 PR1 — 抽出 types.ts + helpers.ts#10oneMuggle wants to merge 1 commit into
oneMuggle wants to merge 1 commit into
Conversation
按 v3 路线图 Phase B1 拆分 `ImageGenerationSettings.tsx`(2205 行)。 PR1 仅做公共层抽出,不动 UI: - 新增 `types.ts`(75 行):`<Props>`、`<生图模型字段>`、`<设置分页>`、`<画师串适用页签>`、`<词组预设页签>`、`<TestResultModal>`、`<WorkflowItem>`、选项联合类型 - 新增 `helpers.ts`(206 行):8 个纯函数(`初始化模型列表`、`获取后端设置标签`、`图片后端需要*`、`生成预设ID`、`创建文生图配置模板`、`创建空画师串预设`、`创建空词组预设`)+ 9 个 UI 选项常量 - 主文件 2205 → 2059 行(净减 146 行公共声明) - 仅改 import,不改运行时行为 验证: - tsc -p tsconfig.app.json: 重构文件 0 错误 - vitest: 122 files / 2565 tests passed 后续:PR2 抽 state/handlers(useImageGenState/useImageGenHandlers),PR3~4 拆 6 个 panel。 Co-Authored-By: Claude <noreply@anthropic.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.
Phase B1 PR1:公共层抽出
按 v3 路线图 Phase B1 拆分
ImageGenerationSettings.tsx(2205 行)。本 PR 仅做公共层抽出,不动 UI。
变更
src/components/features/Settings/Image/types.tssrc/components/features/Settings/Image/helpers.tssrc/components/features/Settings/Image/ImageGenerationSettings.tsxdocs/plans/2026-06-16_b1-image-gen-settings-split.md净变化:+445 / -169(新增 281 行有效代码,移除 169 行重复声明)
抽出的内容
types.ts
<Props>、<生图模型字段>、<设置分页>、<画师串适用页签>、<词组预设页签>、<TestResultModal>、<WorkflowItem><页面选项>、<后端选项>、<接口路径模式选项_>、<预设接口路径选项_>、<NovelAI采样器选项_>、<NovelAI噪点表选项_>helpers.ts
初始化模型列表、初始化加载状态、获取后端设置标签、图片后端需要模型选择/鉴权、生成预设ID、创建文生图配置模板、创建空画师串预设、创建空词组预设基础页面选项、文生图后端选项、接口路径模式选项、预设路径选项映射、NovelAI模型建议/采样器/噪点表选项ComfyUI工作流占位提示、页面容器样式、卡片样式、标签样式验证
tsc -p tsconfig.app.json:重构文件 0 错误npm run test:unit:122 files / 2565 tests passed / 2 skippedSettingsPanel.tsx消费 API 不变(仍React.lazy(() => import('./Image/ImageGenerationSettings')))ImageGenerationSettings: React.FC<Props>)签名不变后续 PR 计划
useImageGenState.ts、useImageGenHandlers.tspanels/BasicPage.tsx、panels/PresetsPage.tsx风险
LOW:纯 import 重构,运行时行为零变化。
🤖 Generated with Claude Code