feat: load global prompts at startup, add minijinja crate (#1467)
This commit is contained in:
@@ -11,7 +11,7 @@ use tokio::sync::Mutex;
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use super::extension::{ExtensionConfig, ExtensionError, ExtensionInfo, ExtensionResult};
|
||||
use crate::prompt_template::{load_prompt, load_prompt_file};
|
||||
use crate::prompt_template;
|
||||
use crate::providers::base::{Provider, ProviderUsage};
|
||||
use mcp_client::client::{ClientCapabilities, ClientInfo, McpClient, McpClientTrait};
|
||||
use mcp_client::transport::{SseTransport, StdioTransport, Transport};
|
||||
@@ -340,12 +340,13 @@ impl Capabilities {
|
||||
context.insert("extensions", serde_json::to_value(extensions_info).unwrap());
|
||||
context.insert("current_date_time", Value::String(current_date_time));
|
||||
|
||||
// Conditionally load the override prompt or the default system prompt
|
||||
// and set the base prompt to the context
|
||||
// Conditionally load the override prompt or the global system prompt
|
||||
let base_prompt = if let Some(override_prompt) = &self.system_prompt_override {
|
||||
load_prompt(override_prompt, &context).expect("Prompt should render")
|
||||
prompt_template::render_inline_once(override_prompt, &context)
|
||||
.expect("Prompt should render")
|
||||
} else {
|
||||
load_prompt_file("system.md", &context).expect("Prompt should render")
|
||||
prompt_template::render_global_file("system.md", &context)
|
||||
.expect("Prompt should render")
|
||||
};
|
||||
|
||||
if self.system_prompt_extensions.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user