Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
outlined when truncation is taking place in the prompt
KCaverly19c2df4822db
diff --git a/crates/ai/src/templates/file_context.rs b/crates/ai/src/templates/file_context.rsindex 253d24e4691..1afd61192ed 100644--- a/crates/ai/src/templates/file_context.rs+++ b/crates/ai/src/templates/file_context.rs@@ -131,6 +131,10 @@ impl PromptTemplate for FileContext {)?;writeln!(prompt, "```{language_name}\n{context}\n```").unwrap();+ if truncated {+ writeln!(prompt, "Note the content has been truncated and only represents a portion of the file.").unwrap();+ }+if let Some(selected_range) = &args.selected_range {let start = selected_range.start.to_offset(buffer);let end = selected_range.end.to_offset(buffer);diff --git a/crates/ai/src/templates/generate.rs b/crates/ai/src/templates/generate.rsindex 34d874cc412..19334340c8e 100644--- a/crates/ai/src/templates/generate.rs+++ b/crates/ai/src/templates/generate.rs@@ -50,7 +50,8 @@ impl PromptTemplate for GenerateInlineContent {.unwrap();} else {writeln!(prompt, "Modify the user's selected {content_type} based upon the users prompt: '{user_prompt}'").unwrap();- writeln!(prompt, "You MUST reply with only the adjusted {content_type} (within the '<|START|' and '|END|>' spans), not the entire file.").unwrap();+ writeln!(prompt, "You must reply with only the adjusted {content_type} (within the '<|START|' and '|END|>' spans) not the entire file.").unwrap();+ writeln!(prompt, "Double check that you only return code and not the '<|START|' and '|END|'> spans").unwrap();}} else {writeln!(diff --git a/crates/assistant/src/prompts.rs b/crates/assistant/src/prompts.rsindex c7b52a35405..dffcbc29234 100644--- a/crates/assistant/src/prompts.rs+++ b/crates/assistant/src/prompts.rs@@ -166,8 +166,6 @@ pub fn generate_content_prompt(let chain = PromptChain::new(args, templates);let (prompt, _) = chain.generate(true)?;- println!("PROMPT: {:?}", &prompt);-anyhow::Ok(prompt)}