首页加回做方案入口
master 的直连 Codex 改造把 HomeAgentMode 和「做游戏 / 做素材 / 做方案」模式栏 整个删了,合并后 startMode 在前端没有 planning 的来源,只能写死 direct-build。 立项策划链路的后端、prompt、澄清卡、审批卡都还在,但从首页够不着,CI 上 home.suite.ts 的两条 routes 做方案 用例也因此找不到按钮而挂。 不把三选一搬回来(那是 master 主动收掉的产品形态),只在输入框工具栏加一个 「做方案」开关:选中时 startMode 走 planning、提交按钮文案切成「进入立项策划」、 占位文案换成方案口径;不选中时与 master 的直连默认完全一致。 createHomeDraft / createHomeDraftAutomatically 改为由调用方传 startMode, 删掉 HOME_DRAFT_START_MODE 这个占位常量。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,12 +44,6 @@ type UseHomeProjectCreationOptions = {
|
||||
rememberRecentWorkspace: (projectPath: string) => void;
|
||||
};
|
||||
|
||||
// 首页的「做游戏 / 做素材 / 做方案」模式选择随 HomeAgentMode 一起被 master 的直连
|
||||
// Codex 改造删掉了,`startMode` 在前端因此暂时没有 `planning` 的来源。立项策划链路
|
||||
// 的代码全部保留(后端、prompt、澄清卡、审批卡都在),只是 UI 入口待产品侧重新定;
|
||||
// 在那之前首页统一按直接构建进入。
|
||||
const HOME_DRAFT_START_MODE: ProjectStartMode = 'direct-build';
|
||||
|
||||
export function useHomeProjectCreation({
|
||||
setStatus,
|
||||
setLauncherView,
|
||||
@@ -454,7 +448,10 @@ export function useHomeProjectCreation({
|
||||
pendingNonEmptyProject !== null,
|
||||
);
|
||||
|
||||
async function createHomeDraft(draft: HomeDraft) {
|
||||
async function createHomeDraft(
|
||||
draft: HomeDraft,
|
||||
startMode: ProjectStartMode,
|
||||
) {
|
||||
const invoke = resolveTauriInvoke();
|
||||
if (!invoke) {
|
||||
throw new Error('需要在 Tauri App 内运行');
|
||||
@@ -470,11 +467,14 @@ export function useHomeProjectCreation({
|
||||
selectedPath,
|
||||
draft.prompt,
|
||||
draft.attachments,
|
||||
HOME_DRAFT_START_MODE,
|
||||
startMode,
|
||||
);
|
||||
}
|
||||
|
||||
async function createHomeDraftAutomatically(draft: HomeDraft) {
|
||||
async function createHomeDraftAutomatically(
|
||||
draft: HomeDraft,
|
||||
startMode: ProjectStartMode,
|
||||
) {
|
||||
const invoke = resolveTauriInvoke();
|
||||
if (!invoke) {
|
||||
throw new Error('需要在陶泥儿客户端内运行');
|
||||
@@ -489,7 +489,7 @@ export function useHomeProjectCreation({
|
||||
result,
|
||||
draft.prompt,
|
||||
draft.attachments,
|
||||
HOME_DRAFT_START_MODE,
|
||||
startMode,
|
||||
);
|
||||
setStatus('已创建工作区,正在开始智能创作');
|
||||
return '已创建工作区并进入项目开发';
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
import { FolderKanban, FolderOpen, Plus, Sparkles } from 'lucide-react';
|
||||
import {
|
||||
FileText,
|
||||
FolderKanban,
|
||||
FolderOpen,
|
||||
Plus,
|
||||
Sparkles,
|
||||
} from 'lucide-react';
|
||||
import type { FormEvent } from 'react';
|
||||
import { useRef, useState } from 'react';
|
||||
|
||||
import BRAND_ICON from '../../../../../packages/shared/src/icons/taonier-product-ip.png';
|
||||
import type { ProjectStartMode } from '../../app/types';
|
||||
import RichInputArea, { UploadButton } from './components/RichInputArea';
|
||||
import {
|
||||
richTextToAttachments,
|
||||
@@ -24,7 +31,10 @@ type HomeViewProps = {
|
||||
status: string;
|
||||
onStatusChange: (status: string) => void;
|
||||
recentProjectRows: readonly HomeProjectRow[];
|
||||
onCreateDraftAutomatically: (draft: HomeDraft) => Promise<string>;
|
||||
onCreateDraftAutomatically: (
|
||||
draft: HomeDraft,
|
||||
startMode: ProjectStartMode,
|
||||
) => Promise<string>;
|
||||
onProjectsOpen: () => void;
|
||||
onProjectOpen: (path: string) => void;
|
||||
onProjectPick: () => void;
|
||||
@@ -46,6 +56,13 @@ export default function HomeView({
|
||||
);
|
||||
const [homeCreationBusy, setHomeCreationBusy] = useState(false);
|
||||
const homeCreationBusyRef = useRef(false);
|
||||
// 首页只保留「做方案」一个开关:做游戏 / 做素材 沿用 master 的直连默认,走
|
||||
// direct-build;立项策划要委派子 Agent、挂澄清 pending、过 GDD 审批,只能由
|
||||
// planning 起链,所以必须在建项目之前就把 startMode 定下来。
|
||||
const [planningSelected, setPlanningSelected] = useState(false);
|
||||
const startMode: ProjectStartMode = planningSelected
|
||||
? 'planning'
|
||||
: 'direct-build';
|
||||
|
||||
async function createFromHome() {
|
||||
if (homeCreationBusyRef.current) {
|
||||
@@ -62,10 +79,10 @@ export default function HomeView({
|
||||
onStatusChange('正在创建工作区');
|
||||
try {
|
||||
onStatusChange(
|
||||
await onCreateDraftAutomatically({
|
||||
prompt,
|
||||
attachments: referencedAttachments,
|
||||
}),
|
||||
await onCreateDraftAutomatically(
|
||||
{ prompt, attachments: referencedAttachments },
|
||||
startMode,
|
||||
),
|
||||
);
|
||||
} catch (error) {
|
||||
onStatusChange(error instanceof Error ? error.message : String(error));
|
||||
@@ -110,18 +127,38 @@ export default function HomeView({
|
||||
>
|
||||
<RichInputArea
|
||||
value={homeRichText}
|
||||
placeholder="告诉陶泥儿你想创建什么"
|
||||
placeholder={
|
||||
planningSelected
|
||||
? '今天有什么设计需要帮你整理'
|
||||
: '告诉陶泥儿你想创建什么'
|
||||
}
|
||||
onChange={setHomeRichText}
|
||||
onEnter={() => {
|
||||
void createFromHome();
|
||||
}}
|
||||
>
|
||||
<div className="grid grid-cols-[1fr_auto] items-center gap-2.5 text-[12px] text-(--platform-text-soft)">
|
||||
<UploadButton />
|
||||
<span className="flex items-center gap-2">
|
||||
<UploadButton />
|
||||
<button
|
||||
className={`inline-flex cursor-pointer items-center gap-1 rounded-full border px-2 py-0.5 text-[12px] transition disabled:cursor-not-allowed disabled:opacity-55 ${
|
||||
planningSelected
|
||||
? 'border-(--platform-warm-text) bg-(--platform-warm-bg) text-(--platform-warm-text)'
|
||||
: 'border-(--platform-surface-border) bg-transparent text-(--platform-text-soft)'
|
||||
}`}
|
||||
type="button"
|
||||
aria-pressed={planningSelected}
|
||||
disabled={homeCreationBusy}
|
||||
onClick={() => setPlanningSelected((selected) => !selected)}
|
||||
>
|
||||
<FileText size={13} aria-hidden="true" />
|
||||
做方案
|
||||
</button>
|
||||
</span>
|
||||
<button
|
||||
className="grid size-6 cursor-pointer place-items-center rounded-full border-0 bg-(image:--platform-button-primary-fill) p-0 text-(--platform-button-primary-text) shadow-(--platform-profile-action-shadow) disabled:cursor-not-allowed disabled:opacity-55"
|
||||
type="submit"
|
||||
aria-label="开启创作"
|
||||
aria-label={planningSelected ? '进入立项策划' : '开启创作'}
|
||||
disabled={homeCreationBusy}
|
||||
>
|
||||
<Plus size={16} aria-hidden="true" />
|
||||
|
||||
Reference in New Issue
Block a user