修复自动命名路由并增加发送等待动画
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled

- codex_app_server 模式复用 DirectHome Codex 通道执行自动项目命名

- 首页开启创作与项目对话发送按钮忙碌时显示旋转动画
This commit is contained in:
2026-09-02 16:50:18 +08:00
parent b56fe94bad
commit 2f3d20bd13
3 changed files with 33 additions and 12 deletions
@@ -16,6 +16,8 @@ const AGENT_EDITOR_ASSET_ID_MAX_CHARS: usize = 512;
const AUTOMATIC_PROJECT_NAME_MAX_PROMPT_CHARS: usize = 8_000;
const AUTOMATIC_PROJECT_NAME_MAX_ATTACHMENTS: usize = 20;
const AUTOMATIC_PROJECT_NAME_MAX_OUTPUT_TOKENS: u32 = 64;
const AUTOMATIC_PROJECT_NAME_SYSTEM_PROMPT: &str =
"你是项目命名助手。只根据用户输入提炼一个原创、简短、中文的项目名称;不要使用知名作品名、路径、URL、凭据、Markdown、引号或解释。输出必须有且只有一行纯文本,长度为 2 到 16 个字符。信息不足时输出:未命名游戏原型";
#[derive(Clone, Debug, Deserialize, Eq, PartialEq)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -106,18 +108,23 @@ async fn request_automatic_project_name(
) -> Result<Option<String>, String> {
let user_prompt = build_automatic_project_name_prompt(prompt, attachments)?;
let app_config = load_game_creator_app_config()?;
if app_config.agent_mode == GAME_CREATOR_AGENT_MODE_CODEX_APP_SERVER {
let reply = crate::agent::direct_game_creator_home_codex_chat(
AUTOMATIC_PROJECT_NAME_SYSTEM_PROMPT.to_string(),
user_prompt,
)
.await?;
return Ok(normalize_suggested_project_name(reply.trim()));
}
let mut llm = app_config.llm.clone();
llm.max_retries = 0;
let client = build_game_creator_llm_client_from_llm_config(&llm, "llm")?;
let request = LlmRunRequest::single_turn(
"你是项目命名助手。只根据用户输入提炼一个原创、简短、中文的项目名称;不要使用知名作品名、路径、URL、凭据、Markdown、引号或解释。输出必须有且只有一行纯文本,长度为 2 到 16 个字符。信息不足时输出:未命名游戏原型",
user_prompt,
)
.with_api_kind(parse_game_creator_llm_api_kind(&llm.api_kind)?)
.with_model(llm.model.clone())
.with_request_timeout_ms(llm.request_timeout_ms)
.with_max_output_tokens(AUTOMATIC_PROJECT_NAME_MAX_OUTPUT_TOKENS)
.with_web_search(false);
let request = LlmRunRequest::single_turn(AUTOMATIC_PROJECT_NAME_SYSTEM_PROMPT, user_prompt)
.with_api_kind(parse_game_creator_llm_api_kind(&llm.api_kind)?)
.with_model(llm.model.clone())
.with_request_timeout_ms(llm.request_timeout_ms)
.with_max_output_tokens(AUTOMATIC_PROJECT_NAME_MAX_OUTPUT_TOKENS)
.with_web_search(false);
let response = client
.run(request)
.await
@@ -1,4 +1,4 @@
import { ArrowUp } from 'lucide-react';
import { ArrowUp, Loader2 } from 'lucide-react';
import type {
ComponentProps,
Dispatch,
@@ -108,6 +108,7 @@ export function ProjectSupervisorView({
: runtimePanelProps.controlBusy
? '思考中'
: '发送';
const submitting = runtimePanelProps.controlBusy && !needsUserInput;
return (
<section
className={`project-supervisor-surface${directCodex ? ' is-direct-codex' : ''}`}
@@ -264,7 +265,11 @@ export function ProjectSupervisorView({
title={submitLabel}
disabled={runtimePanelProps.controlBusy || needsUserInput}
>
<ArrowUp size={16} aria-hidden="true" />
{submitting ? (
<Loader2 size={16} aria-hidden="true" className="animate-spin" />
) : (
<ArrowUp size={16} aria-hidden="true" />
)}
</button>
</form>
<small className="project-supervisor-workspace-status">
@@ -5,6 +5,7 @@ import {
FolderOpen,
Gamepad2,
Image,
Loader2,
type LucideIcon,
Sparkles,
} from 'lucide-react';
@@ -248,7 +249,15 @@ export default function HomeView({
}
disabled={homeCreationBusy}
>
<ArrowUp size={16} aria-hidden="true" />
{homeCreationBusy ? (
<Loader2
size={16}
aria-hidden="true"
className="animate-spin"
/>
) : (
<ArrowUp size={16} aria-hidden="true" />
)}
</button>
</div>
</RichInputArea>