Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
added initial placeholder for truncation without a valid strategy
KCaverly32853c20447d
diff --git a/crates/ai/src/templates/file_context.rs b/crates/ai/src/templates/file_context.rsindex 94b194d9bf7..e28f9ccdedb 100644--- a/crates/ai/src/templates/file_context.rs+++ b/crates/ai/src/templates/file_context.rs@@ -1,3 +1,4 @@+use anyhow::anyhow;use language::ToOffset;use crate::templates::base::PromptArguments;@@ -12,6 +13,12 @@ impl PromptTemplate for FileContext {args: &PromptArguments,max_token_length: Option<usize>,) -> anyhow::Result<(String, usize)> {+ if max_token_length.is_some() {+ return Err(anyhow!(+ "no truncation strategy established for file_context template"+ ));+ }+let mut prompt = String::new();// Add Initial Preamblediff --git a/crates/ai/src/templates/generate.rs b/crates/ai/src/templates/generate.rsindex d8a1ff6cf14..053398e8738 100644--- a/crates/ai/src/templates/generate.rs+++ b/crates/ai/src/templates/generate.rs@@ -18,6 +18,12 @@ impl PromptTemplate for GenerateInlineContent {args: &PromptArguments,max_token_length: Option<usize>,) -> anyhow::Result<(String, usize)> {+ if max_token_length.is_some() {+ return Err(anyhow!(+ "no truncation strategy established for generating inline content template"+ ));+ }+let Some(user_prompt) = &args.user_prompt else {return Err(anyhow!("user prompt not provided"));};@@ -83,6 +89,7 @@ impl PromptTemplate for GenerateInlineContent {}let token_count = args.model.count_tokens(&prompt)?;+anyhow::Ok((prompt, token_count))}}