@@ -295,9 +295,9 @@ impl TeacherPrompt {
fn extract_editable_region(text: &str) -> String {
let start = text
- .find(Self::EDITABLE_REGION_START)
+ .rfind(Self::EDITABLE_REGION_START)
.map_or(0, |pos| pos + Self::EDITABLE_REGION_START.len());
- let end = text.find(Self::EDITABLE_REGION_END).unwrap_or(text.len());
+ let end = text.rfind(Self::EDITABLE_REGION_END).unwrap_or(text.len());
let region = &text[start..end];
let region = region.strip_suffix('\n').unwrap_or(region);
@@ -364,8 +364,12 @@ async fn load_examples(
}
}
- if let Some(path) = output_path {- resume_from_output(path, &mut examples);
+ // Skip resume logic for --in-place since input and output are the same file,
+ // which would incorrectly treat all input examples as already processed.
+ if !args.in_place {
+ if let Some(path) = output_path {
+ resume_from_output(path, &mut examples);
+ }
}
Progress::global().set_total_examples(examples.len());
@@ -71,7 +71,11 @@ The user is computing a sum based on a list of products. The only numeric field
# 1. User Edits History
+`````
{{edit_history}}
+`````
+
+# 2. Related excerpts
{{context}}