Add template processing to /run command
Apply the same {{var}} template variable injection to prompts
loaded via the /run command in interactive mode.
This commit is contained in:
@@ -11,6 +11,7 @@ use g3_core::Agent;
|
|||||||
use crate::completion::G3Helper;
|
use crate::completion::G3Helper;
|
||||||
use crate::g3_status::{G3Status, Status};
|
use crate::g3_status::{G3Status, Status};
|
||||||
use crate::simple_output::SimpleOutput;
|
use crate::simple_output::SimpleOutput;
|
||||||
|
use crate::template::process_template;
|
||||||
use crate::task_execution::execute_task_with_retry;
|
use crate::task_execution::execute_task_with_retry;
|
||||||
|
|
||||||
/// Handle a control command. Returns true if the command was handled and the loop should continue.
|
/// Handle a control command. Returns true if the command was handled and the loop should continue.
|
||||||
@@ -142,7 +143,8 @@ pub async fn handle_command<W: UiWriter>(
|
|||||||
};
|
};
|
||||||
match std::fs::read_to_string(&expanded_path) {
|
match std::fs::read_to_string(&expanded_path) {
|
||||||
Ok(content) => {
|
Ok(content) => {
|
||||||
let prompt = content.trim();
|
let processed = process_template(&content);
|
||||||
|
let prompt = processed.trim();
|
||||||
if prompt.is_empty() {
|
if prompt.is_empty() {
|
||||||
output.print("❌ File is empty.");
|
output.print("❌ File is empty.");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user