mirror of
https://github.com/katanemo/plano.git
synced 2026-07-20 16:41:04 +02:00
fix: handle MessageContent enum in responses API conversion
- Update request.rs to handle new MessageContent enum structure from main - MessageContent can now be Text(String) or Items(Vec<InputContent>) - Handle new InputItem variants (ItemReference, FunctionCallOutput) - Fixes compilation error after merging latest main (#632)
This commit is contained in:
parent
1fc39d5dcf
commit
fc52274836
1 changed files with 19 additions and 10 deletions
|
|
@ -220,16 +220,21 @@ impl ProviderRequestType {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Extract text from message content
|
// Extract text from message content
|
||||||
let content = msg.content.iter()
|
let content = match &msg.content {
|
||||||
.filter_map(|c| {
|
crate::apis::openai_responses::MessageContent::Text(text) => text.clone(),
|
||||||
if let crate::apis::openai_responses::InputContent::InputText { text } = c {
|
crate::apis::openai_responses::MessageContent::Items(items) => {
|
||||||
Some(text.clone())
|
items.iter()
|
||||||
} else {
|
.filter_map(|c| {
|
||||||
None
|
if let crate::apis::openai_responses::InputContent::InputText { text } = c {
|
||||||
}
|
Some(text.clone())
|
||||||
})
|
} else {
|
||||||
.collect::<Vec<_>>()
|
None
|
||||||
.join("\n");
|
}
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join("\n")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
openai_messages.push(Message {
|
openai_messages.push(Message {
|
||||||
role,
|
role,
|
||||||
|
|
@ -239,6 +244,10 @@ impl ProviderRequestType {
|
||||||
tool_call_id: None,
|
tool_call_id: None,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// Skip other input item types for now
|
||||||
|
InputItem::ItemReference { .. } | InputItem::FunctionCallOutput { .. } => {
|
||||||
|
// These are not yet supported in agent framework
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue