Merge branch 'master' into feat/agc-llm-router-official-chain
This commit is contained in:
@@ -666,12 +666,27 @@ async fn request_game_creator_agent_codex_cli_with_executable(
|
||||
let mut stdin = child.stdin.take().ok_or_else(|| {
|
||||
platform_llm::LlmError::Transport("Codex CLI Agent stdin 未建立".to_string())
|
||||
})?;
|
||||
stdin.write_all(prompt.as_bytes()).await.map_err(|error| {
|
||||
platform_llm::LlmError::Transport(format!("写入 Codex CLI Agent prompt 失败:{error}"))
|
||||
})?;
|
||||
stdin.shutdown().await.map_err(|error| {
|
||||
platform_llm::LlmError::Transport(format!("关闭 Codex CLI Agent stdin 失败:{error}"))
|
||||
})?;
|
||||
// 短生命周期 CLI 可能在 prompt 写完前退出;继续采集退出状态和脱敏
|
||||
// stderr,确保调用方拿到可行动的进程错误,而不是平台相关的 BrokenPipe。
|
||||
let mut stdin_error = None;
|
||||
if let Err(error) = stdin.write_all(prompt.as_bytes()).await {
|
||||
if error.kind() == std::io::ErrorKind::BrokenPipe {
|
||||
stdin_error = Some(format!("写入 Codex CLI Agent prompt 失败:{error}"));
|
||||
} else {
|
||||
return Err(platform_llm::LlmError::Transport(format!(
|
||||
"写入 Codex CLI Agent prompt 失败:{error}"
|
||||
)));
|
||||
}
|
||||
}
|
||||
if let Err(error) = stdin.shutdown().await {
|
||||
if error.kind() == std::io::ErrorKind::BrokenPipe {
|
||||
stdin_error.get_or_insert_with(|| format!("关闭 Codex CLI Agent stdin 失败:{error}"));
|
||||
} else {
|
||||
return Err(platform_llm::LlmError::Transport(format!(
|
||||
"关闭 Codex CLI Agent stdin 失败:{error}"
|
||||
)));
|
||||
}
|
||||
}
|
||||
drop(stdin);
|
||||
|
||||
let stdout = child.stdout.take().ok_or_else(|| {
|
||||
@@ -744,6 +759,9 @@ async fn request_game_creator_agent_codex_cli_with_executable(
|
||||
stderr.sha256
|
||||
)));
|
||||
}
|
||||
if let Some(error) = stdin_error {
|
||||
return Err(platform_llm::LlmError::Transport(error));
|
||||
}
|
||||
parse_game_creator_codex_cli_response(&stdout, &request)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user