Improve workflow suggestion steps and debug info (#16309)

Release Notes:

- N/A

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
This commit is contained in:
Kirill Bulatov 2024-08-15 22:46:19 +03:00 committed by GitHub
parent 6b7664ef4a
commit ff83e5b55a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 311 additions and 157 deletions

View file

@ -31,6 +31,15 @@ pub struct TerminalAssistantPromptContext {
pub user_prompt: String,
}
/// Context required to generate a workflow step resolution prompt.
#[derive(Debug, Serialize)]
pub struct StepResolutionContext {
/// The full context, including <step>...</step> tags
pub workflow_context: String,
/// The text of the specific step from the context to resolve
pub step_to_resolve: String,
}
pub struct PromptBuilder {
handlebars: Arc<Mutex<Handlebars<'static>>>,
}
@ -278,7 +287,10 @@ impl PromptBuilder {
self.handlebars.lock().render("edit_workflow", &())
}
pub fn generate_step_resolution_prompt(&self) -> Result<String, RenderError> {
self.handlebars.lock().render("step_resolution", &())
pub fn generate_step_resolution_prompt(
&self,
context: &StepResolutionContext,
) -> Result<String, RenderError> {
self.handlebars.lock().render("step_resolution", context)
}
}