13 lines
338 B
Rust
13 lines
338 B
Rust
use serde::de::DeserializeOwned;
|
|
|
|
use crate::error::PlatformAgentError;
|
|
|
|
pub fn parse_json_output<T>(raw_text: &str) -> Result<T, PlatformAgentError>
|
|
where
|
|
T: DeserializeOwned,
|
|
{
|
|
serde_json::from_str(raw_text).map_err(|error| {
|
|
PlatformAgentError::OutputParse(format!("解析 Agent JSON 输出失败:{error}"))
|
|
})
|
|
}
|