打通多模态 UI 工作流与 Agent Runtime 路由
- 接入 Codex app-server 原生图片输入与隔离暂存 - 统一 UI 识别、合并、绑定到 Agent Runtime Provider - 增加页面自动发现、UI 资源桥接与阶段持久化 - 同步画布编辑器投影、测试与技术文档
This commit is contained in:
@@ -1295,7 +1295,12 @@ impl LlmRunRequest {
|
||||
self
|
||||
}
|
||||
|
||||
fn validate(&self) -> Result<(), LlmError> {
|
||||
/// Validate a request before handing it to any transport adapter.
|
||||
///
|
||||
/// Runtime adapters such as Codex app-server do not use `LlmClient::run`
|
||||
/// and therefore must still enforce the exact same message/tool contract
|
||||
/// before opening an upstream request.
|
||||
pub fn validate_for_transport(&self) -> Result<(), LlmError> {
|
||||
if self.messages.is_empty() {
|
||||
return Err(LlmError::InvalidRequest(
|
||||
"LLM messages 不能为空".to_string(),
|
||||
@@ -1327,15 +1332,16 @@ impl LlmRunRequest {
|
||||
));
|
||||
}
|
||||
|
||||
if self.api_kind == LlmApiKind::OpenAiResponses
|
||||
&& message.role == LlmMessageRole::Assistant
|
||||
&& message
|
||||
.content_parts
|
||||
.iter()
|
||||
.any(|part| matches!(part, LlmMessageContentPart::InputImage { .. }))
|
||||
if matches!(
|
||||
message.role,
|
||||
LlmMessageRole::System | LlmMessageRole::Assistant
|
||||
) && message
|
||||
.content_parts
|
||||
.iter()
|
||||
.any(|part| matches!(part, LlmMessageContentPart::InputImage { .. }))
|
||||
{
|
||||
return Err(LlmError::InvalidRequest(
|
||||
"OpenAI Responses assistant 消息不支持 input_image".to_string(),
|
||||
"system/assistant 消息不支持 input_image;图片必须放在 user 消息".to_string(),
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -1408,6 +1414,10 @@ impl LlmRunRequest {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn validate(&self) -> Result<(), LlmError> {
|
||||
self.validate_for_transport()
|
||||
}
|
||||
|
||||
fn resolved_model<'a>(&'a self, fallback_model: &'a str) -> &'a str {
|
||||
self.model
|
||||
.as_deref()
|
||||
|
||||
Reference in New Issue
Block a user