style: cargo fmt fixes flagged by Forgejo CI
Some checks failed
CI / Linux x86_64 (Forgejo) (push) Failing after 1m25s
Some checks failed
CI / Linux x86_64 (Forgejo) (push) Failing after 1m25s
Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
parent
f8a3a7ebf3
commit
b407450e6b
3 changed files with 13 additions and 12 deletions
11
src/lib.rs
11
src/lib.rs
|
|
@ -32,10 +32,8 @@ impl exports::fai::platform::invoke::Guest for Orchestrator {
|
||||||
fn invoke(
|
fn invoke(
|
||||||
ctx: fai::platform::types::InvocationContext,
|
ctx: fai::platform::types::InvocationContext,
|
||||||
inputs: Vec<(String, fai::platform::types::Payload)>,
|
inputs: Vec<(String, fai::platform::types::Payload)>,
|
||||||
) -> Result<
|
) -> Result<Vec<(String, fai::platform::types::Payload)>, fai::platform::types::InvocationError>
|
||||||
Vec<(String, fai::platform::types::Payload)>,
|
{
|
||||||
fai::platform::types::InvocationError,
|
|
||||||
> {
|
|
||||||
use fai::platform::types::{InvocationError, Payload};
|
use fai::platform::types::{InvocationError, Payload};
|
||||||
|
|
||||||
fai::platform::host::log(
|
fai::platform::host::log(
|
||||||
|
|
@ -84,10 +82,7 @@ impl exports::fai::platform::invoke::Guest for Orchestrator {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
fn text_input(
|
fn text_input(inputs: &[(String, fai::platform::types::Payload)], name: &str) -> Option<String> {
|
||||||
inputs: &[(String, fai::platform::types::Payload)],
|
|
||||||
name: &str,
|
|
||||||
) -> Option<String> {
|
|
||||||
use fai::platform::types::Payload;
|
use fai::platform::types::Payload;
|
||||||
inputs.iter().find(|(k, _)| k == name).and_then(|(_, v)| {
|
inputs.iter().find(|(k, _)| k == name).and_then(|(_, v)| {
|
||||||
if let Payload::Text(s) = v {
|
if let Payload::Text(s) = v {
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn extracts_content_from_well_formed_response() {
|
fn extracts_content_from_well_formed_response() {
|
||||||
let body = r#"{"model":"x","message":{"role":"assistant","content":"the-plan"},"done":true}"#;
|
let body =
|
||||||
|
r#"{"model":"x","message":{"role":"assistant","content":"the-plan"},"done":true}"#;
|
||||||
assert_eq!(extract_ollama_content(body).unwrap(), "the-plan");
|
assert_eq!(extract_ollama_content(body).unwrap(), "the-plan");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -239,7 +240,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn end_to_end_via_mock_client_returns_validated_plan() {
|
fn end_to_end_via_mock_client_returns_validated_plan() {
|
||||||
let canned_plan = r#"{"schema_version":1,"goal":"hi","steps":[{"kind":"explain","text":"ok"}]}"#;
|
let canned_plan =
|
||||||
|
r#"{"schema_version":1,"goal":"hi","steps":[{"kind":"explain","text":"ok"}]}"#;
|
||||||
let canned_response = format!(
|
let canned_response = format!(
|
||||||
r#"{{"message":{{"role":"assistant","content":{}}},"done":true}}"#,
|
r#"{{"message":{{"role":"assistant","content":{}}},"done":true}}"#,
|
||||||
serde_json::to_string(canned_plan).unwrap(),
|
serde_json::to_string(canned_plan).unwrap(),
|
||||||
|
|
@ -260,7 +262,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn rejects_invalid_plan_from_llm() {
|
fn rejects_invalid_plan_from_llm() {
|
||||||
let bad_plan = r#"{"schema_version":99,"goal":"x","steps":[{"kind":"explain","text":"a"}]}"#;
|
let bad_plan =
|
||||||
|
r#"{"schema_version":99,"goal":"x","steps":[{"kind":"explain","text":"a"}]}"#;
|
||||||
let canned_response = format!(
|
let canned_response = format!(
|
||||||
r#"{{"message":{{"content":{}}}}}"#,
|
r#"{{"message":{{"content":{}}}}}"#,
|
||||||
serde_json::to_string(bad_plan).unwrap(),
|
serde_json::to_string(bad_plan).unwrap(),
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,10 @@ mod tests {
|
||||||
r#"{"schema_version":1,"goal":"x","steps":[{"kind":"save_flow","name":"","yaml":"a"}]}"#,
|
r#"{"schema_version":1,"goal":"x","steps":[{"kind":"save_flow","name":"","yaml":"a"}]}"#,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(matches!(validate(&plan), Err(PlanError::InvalidStep { .. })));
|
assert!(matches!(
|
||||||
|
validate(&plan),
|
||||||
|
Err(PlanError::InvalidStep { .. })
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue