diff --git a/Cargo.lock b/Cargo.lock index f00bda49..1808f04b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -543,6 +543,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + [[package]] name = "bytes" version = "1.6.0" @@ -932,9 +938,9 @@ dependencies = [ [[package]] name = "derive-docs" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1be89315e08052064fea4deff63c4c6a69b479dcca155f34d2fd8f74a61d57f" +checksum = "9ffe32235bc9858ff96b983633de013d5b1764d3c833b812b558f49f1db09035" dependencies = [ "Inflector", "convert_case", @@ -1650,6 +1656,18 @@ dependencies = [ "tiff", ] +[[package]] +name = "image" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99314c8a2152b8ddb211f924cdae532d8c5e4c8bb54728e12fff1b0cd5963a10" +dependencies = [ + "bytemuck", + "byteorder-lite", + "num-traits", + "png", +] + [[package]] name = "indexmap" version = "1.9.3" @@ -1809,9 +1827,9 @@ dependencies = [ [[package]] name = "kcl-lib" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165d6791a7d2b72b99ba5011a26fdc2f1ecb5cecbb79bb01c25a6a3a002a252e" +checksum = "29a543033c313077b629ef8fb815c2f65bc94c9b627d5a1bbba27e2f42f34671" dependencies = [ "anyhow", "approx", @@ -1829,6 +1847,7 @@ dependencies = [ "futures", "git_rev", "gltf-json", + "image 0.25.2", "js-sys", "kittycad", "lazy_static", @@ -1847,6 +1866,7 @@ dependencies = [ "tower-lsp", "ts-rs", "url", + "urlencoding", "uuid", "validator", "wasm-bindgen", @@ -1873,9 +1893,9 @@ dependencies = [ [[package]] name = "kittycad" -version = "0.3.10" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d798c82f6e62d786fca0a7ec073675bbe9550c885efb99390d2701ca557ec69" +checksum = "7bc87dcc307aa8c8dd56a6f022da1cbdf13a0a1e2abacb9ca9f897118a75596d" dependencies = [ "anyhow", "async-trait", @@ -3213,9 +3233,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.122" +version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da" +checksum = "66ad62847a56b3dba58cc891acd13884b9c61138d330c0d7b6181713d4fce38d" dependencies = [ "indexmap 2.3.0", "itoa", @@ -4244,6 +4264,12 @@ dependencies = [ "serde", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "utf-8" version = "0.7.6" @@ -4331,7 +4357,7 @@ dependencies = [ "base64 0.21.7", "console", "crossterm", - "image", + "image 0.24.9", "lazy_static", "tempfile", "termcolor", @@ -4788,7 +4814,7 @@ dependencies = [ [[package]] name = "zoo" -version = "0.2.68" +version = "0.2.69" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index b6d35e5f..2c99dc9b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zoo" -version = "0.2.68" +version = "0.2.69" edition = "2021" build = "build.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -22,7 +22,7 @@ git_rev = "0.1.0" heck = "0.5.0" http = "0.2.6" itertools = "0.12.1" -kcl-lib = "0.2" +kcl-lib = "0.2.4" kcl-test-server = "0.1.4" kittycad = { version = "0.3.10", features = ["clap", "tabled", "requests", "retry"] } log = "0.4.22" diff --git a/src/cmd_file.rs b/src/cmd_file.rs index 5c34ff8e..dcab0cc0 100644 --- a/src/cmd_file.rs +++ b/src/cmd_file.rs @@ -714,13 +714,17 @@ fn get_input_format( }, }; match format { - kittycad::types::FileImportFormat::Step => Ok(kittycad::types::InputFormat::Step {}), + kittycad::types::FileImportFormat::Step => Ok(kittycad::types::InputFormat::Step { + split_closed_faces: false, + }), kittycad::types::FileImportFormat::Stl => Ok(kittycad::types::InputFormat::Stl { coords, units: ul }), kittycad::types::FileImportFormat::Obj => Ok(kittycad::types::InputFormat::Obj { coords, units: ul }), kittycad::types::FileImportFormat::Gltf => Ok(kittycad::types::InputFormat::Gltf {}), kittycad::types::FileImportFormat::Ply => Ok(kittycad::types::InputFormat::Ply { coords, units: ul }), kittycad::types::FileImportFormat::Fbx => Ok(kittycad::types::InputFormat::Fbx {}), - kittycad::types::FileImportFormat::Sldprt => Ok(kittycad::types::InputFormat::Sldprt {}), + kittycad::types::FileImportFormat::Sldprt => Ok(kittycad::types::InputFormat::Sldprt { + split_closed_faces: false, + }), } } diff --git a/src/context.rs b/src/context.rs index 253721d4..1b48a12a 100644 --- a/src/context.rs +++ b/src/context.rs @@ -185,9 +185,10 @@ impl Context<'_> { let client = self.api_client(hostname)?; // Create the text-to-cad request. - let mut model: kittycad::types::TextToCad = client - .ai() + let mut gen_model: kittycad::types::TextToCad = client + .ml() .create_text_to_cad( + None, format, &kittycad::types::TextToCadCreateBody { prompt: prompt.to_string(), @@ -196,7 +197,7 @@ impl Context<'_> { .await?; // Poll until the model is ready. - let mut status = model.status.clone(); + let mut status = gen_model.status.clone(); // Get the current time. let start = std::time::Instant::now(); // Give it 5 minutes to complete. That should be way @@ -206,7 +207,7 @@ impl Context<'_> { && start.elapsed().as_secs() < 60 * 5 { // Poll for the status. - let result = client.api_calls().get_async_operation(model.id).await?; + let result = client.api_calls().get_async_operation(gen_model.id).await?; if let kittycad::types::AsyncApiCallOutput::TextToCad { completed_at, @@ -222,9 +223,11 @@ impl Context<'_> { status, updated_at, user_id, + code, + model, } = result { - model = kittycad::types::TextToCad { + gen_model = kittycad::types::TextToCad { completed_at, created_at, error, @@ -238,32 +241,34 @@ impl Context<'_> { status, updated_at, user_id, + code, + model, }; } else { anyhow::bail!("Unexpected response type: {:?}", result); } - status = model.status.clone(); + status = gen_model.status.clone(); // Wait for a bit before polling again. tokio::time::sleep(std::time::Duration::from_secs(5)).await; } // If the model failed we will want to tell the user. - if model.status == kittycad::types::ApiCallStatus::Failed { - if let Some(error) = model.error { + if gen_model.status == kittycad::types::ApiCallStatus::Failed { + if let Some(error) = gen_model.error { anyhow::bail!("Your prompt returned an error: ```\n{}\n```", error); } else { anyhow::bail!("Your prompt returned an error, but no error message. :("); } } - if model.status != kittycad::types::ApiCallStatus::Completed { + if gen_model.status != kittycad::types::ApiCallStatus::Completed { anyhow::bail!("Your prompt timed out"); } // Okay, we successfully got a model! - Ok(model) + Ok(gen_model) } /// This function opens a browser that is based on the configured