Skip to content

Commit 96e1f30

Browse files
committed
feat(copilot): kittycad 0.3.42, markdown reasoning, try to keep up
- Handle ReasoningMessage::Markdown in formatting and markdown output - Adapt to API changes, set forced_tools default, ignore ConversationId Signed-off-by: Jessie Frazelle <[email protected]>
1 parent a8ffe42 commit 96e1f30

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ itertools = "0.12.1"
3636
kcl-derive-docs = { version = "=0.1.95" }
3737
kcl-lib = { version = "=0.2.95", features = ["disable-println"] }
3838
kcl-test-server = "=0.1.95"
39-
kittycad = { version = "0.3.41", features = [
39+
kittycad = { version = "0.3.42", features = [
4040
"clap",
4141
"tabled",
4242
"requests",
@@ -47,7 +47,10 @@ kittycad-modeling-cmds = { version = "=0.2.133", features = [
4747
"convert_client_crate",
4848
"tabled",
4949
] }
50-
image = { version = "0.25", default-features = false, features = ["png", "jpeg"] }
50+
image = { version = "0.25", default-features = false, features = [
51+
"png",
52+
"jpeg",
53+
] }
5154
log = "0.4.27"
5255
miette = { version = "7.5.0", features = ["fancy"] }
5356
nu-ansi-term = "0.50.1"
@@ -57,7 +60,9 @@ open = "5.3.2"
5760
parse-display = "0.10.0"
5861
pulldown-cmark = "0.9.2"
5962
pulldown-cmark-to-cmark = "11.0.2"
60-
ratatui = { version = "0.26", default-features = false, features = ["crossterm"] }
63+
ratatui = { version = "0.26", default-features = false, features = [
64+
"crossterm",
65+
] }
6166
regex = "1"
6267
reqwest = { version = "0.12", default-features = false, features = [
6368
"json",

src/context.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,9 @@ pub(crate) fn format_reasoning(reason: kittycad::types::ReasoningMessage, use_co
710710
kittycad::types::ReasoningMessage::Text { content } => {
711711
vec![format!("{} {}", lbl("reasoning:", Color::Cyan), content.trim())]
712712
}
713+
kittycad::types::ReasoningMessage::Markdown { content } => {
714+
vec![format!("{} {}", lbl("reasoning:", Color::Cyan), content.trim())]
715+
}
713716
kittycad::types::ReasoningMessage::KclDocs { content } => {
714717
vec![format!("{} {}", lbl("kcl docs:", Color::Purple), content.trim())]
715718
}
@@ -769,6 +772,7 @@ pub(crate) fn reasoning_to_markdown(reason: &kittycad::types::ReasoningMessage)
769772

770773
match reason {
771774
kittycad::types::ReasoningMessage::Text { content } => content.trim().to_string(),
775+
kittycad::types::ReasoningMessage::Markdown { content } => content.trim().to_string(),
772776
kittycad::types::ReasoningMessage::KclDocs { content } => {
773777
format!("**KCL Docs**\n\n{}", content.trim())
774778
}

src/ml/copilot/run.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ fn build_user_message(
5454
current_files: Some(files),
5555
project_name: project_name.clone(),
5656
source_ranges: None,
57+
forced_tools: Default::default(),
5758
};
5859
let len = serde_json::to_string(&msg).map(|s| s.len()).unwrap_or(0);
5960
(msg, len)

src/ml/copilot/ui.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ pub fn draw(frame: &mut Frame, app: &App) {
175175
kittycad::types::MlCopilotServerMessage::Delta { delta } => {
176176
assistant_buf.push_str(delta);
177177
}
178+
kittycad::types::MlCopilotServerMessage::ConversationId { .. } => {
179+
// Ignore conversation ID we don't care.
180+
}
178181
kittycad::types::MlCopilotServerMessage::EndOfStream { .. } => {
179182
if !assistant_buf.is_empty() {
180183
let rows = render_preserving_newlines(&assistant_buf);

0 commit comments

Comments
 (0)