修复 master 合并后的客户端 CI 回归
Project CI / Repository checks (pull_request) Successful in 2m36s
Project CI / Frontend tests (pull_request) Successful in 3m19s
Project CI / Backend tests (pull_request) Successful in 6m36s
Project CI / Native shell tests (pull_request) Failing after 14m3s

避免空项目首页调用插件路径清理命令
恢复首页项目类型和未识别项目提示契约
隐藏创建过程中的底层错误文本并保留稳定重试提示
补充项目路径引用清理,避免切换项目重复调用
This commit is contained in:
2026-09-13 12:56:16 +08:00
parent 3089061694
commit 0b7aeb7d8a
4 changed files with 17 additions and 12 deletions
+8 -2
View File
@@ -598,11 +598,14 @@ export function App({
: null,
);
const localProjectPathRef = useRef<string | null>(null);
localProjectPathRef.current = localProject?.projectPath ?? null;
useEffect(() => {
if (supervisorChatOnly) return;
const nextProjectPath = localProject?.projectPath ?? null;
const previousProjectPath = localProjectPathRef.current;
localProjectPathRef.current = nextProjectPath;
// 未绑定项目时无需触发插件宿主;这也避免启动空首页时产生无意义的 Tauri 调用。
if (!nextProjectPath && !previousProjectPath) return;
void setAgcPluginProjectPath(nextProjectPath)
.then(async () => {
if (workspaceProjectKind === 'cocos' && nextProjectPath) {
@@ -620,7 +623,10 @@ export function App({
);
});
return () => {
void setAgcPluginProjectPath(null).catch(() => undefined);
if (nextProjectPath || previousProjectPath) {
void setAgcPluginProjectPath(null).catch(() => undefined);
}
localProjectPathRef.current = null;
};
}, [localProject?.projectPath, supervisorChatOnly, workspaceProjectKind]);
@@ -39,7 +39,7 @@ function projectKindLabel(project: RecentProjectRow) {
: 'Godot';
}
if (project.projectKind === 'web') {
return 'Phaser';
return 'GameAgent';
}
return '待识别';
}
@@ -490,9 +490,7 @@ export function useHomeProjectCreation({
);
projectManifest = result.manifest;
} else {
setStatus(
'未识别为支持的 AGC、Godot 或 Cocos Creator 项目,请选择项目根目录。',
);
setStatus('这不是已初始化的 AI 游戏项目,请使用新建项目。');
return;
}
const runtimeMode = await invoke<{
@@ -613,11 +611,9 @@ export function useHomeProjectCreation({
if (!invoke) {
throw new Error('需要在陶泥儿客户端内运行');
}
setStatus(options.suggestName ? '正在提炼项目名称' : '正在创建工作区');
const suggestedName = options.suggestName
? await suggestAutomaticProjectName(invoke, draft)
: null;
setStatus('正在创建工作区');
const result = await invoke<InitLocalProjectResult>(
'create_automatic_local_game_project',
{
@@ -154,12 +154,13 @@ export default function HomeView({
const referencedAttachments = richTextToAttachments(homeRichText);
const prompt = richTextToPrompt(homeRichText);
if (!prompt && referencedAttachments.length === 0) {
onStatusChange(activeCreationType.emptyPrompt);
if (homeCreationType !== 'doc') {
onStatusChange(activeCreationType.emptyPrompt);
}
return;
}
homeCreationBusyRef.current = true;
setHomeCreationBusy(true);
onStatusChange('正在创建工作区');
try {
onStatusChange(
await onCreateDraftAutomatically(
@@ -171,8 +172,10 @@ export default function HomeView({
startMode,
),
);
} catch (error) {
onStatusChange(error instanceof Error ? error.message : String(error));
} catch {
// 详细错误已由工作区创建控制器记录;首页只显示稳定的用户可执行提示,
// 避免把底层 Provider/IPC 文本直接渲染到首页状态区。
onStatusChange('创建未完成,请重试');
} finally {
homeCreationBusyRef.current = false;
setHomeCreationBusy(false);