Skip to content

Commit

Permalink
context_servers: fixup protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
dsp-ant committed Sep 13, 2024
1 parent 6684f70 commit 99f04ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/assistant/src/slash_command/context_server_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ fn format_messages(messages: &[SamplingMessage]) -> String {
.iter()
.map(|msg| {
match &msg.content {
SamplingContent::Text(text) => text,
SamplingContent::Text { text } => text,
SamplingContent::Image { .. } => "", // Ignore images for now
}
})
Expand All @@ -245,7 +245,7 @@ fn format_messages(messages: &[SamplingMessage]) -> String {
SamplingRole::Assistant => "Assistant",
};
let content = match &msg.content {
SamplingContent::Text(text) => text,
SamplingContent::Text { text } => text,
SamplingContent::Image { .. } => "",
};
format!("{}: {}", role, content)
Expand Down
5 changes: 3 additions & 2 deletions crates/context_servers/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,11 @@ pub enum SamplingRole {
}

#[derive(Debug, Deserialize)]
#[serde(tag = "type", content = "content")]
#[serde(tag = "type")]
pub enum SamplingContent {
#[serde(rename = "text")]
Text(String),
Text { text: String },
// Keep the Image variant if it's still needed
#[serde(rename = "image")]
Image { data: String, mime_type: String },
}
Expand Down

0 comments on commit 99f04ec

Please sign in to comment.