Add LLM system prompt override
Allow overriding the LLM system prompt via the `LLM_SYSTEM_PROMPT` environment variable. This provides flexibility for customizing LLM behavior without code changes. A default prompt is used if the environment variable is unset or empty.
This commit is contained in:
@@ -53,6 +53,11 @@ pub struct Config {
|
||||
pub llm_model: String,
|
||||
pub llm_temperature: f32,
|
||||
pub llm_timeout_seconds: u64,
|
||||
/// System prompt sent to the analysis LLM. Defaults to
|
||||
/// `crate::analyze::prompt::SYSTEM_PROMPT` if `LLM_SYSTEM_PROMPT` is unset
|
||||
/// or empty. Runtime-configurable so admins can iterate and use the
|
||||
/// "Neu analysieren" button to re-run cases.
|
||||
pub llm_system_prompt: String,
|
||||
pub session_timeout_hours: u32,
|
||||
/// Whether to set the `Secure` flag on the session cookie. Default `true`.
|
||||
/// Set `COOKIE_SECURE=false` only for plain-HTTP local development —
|
||||
@@ -87,6 +92,14 @@ impl Config {
|
||||
llm_model: optional_env("LLM_MODEL", ""),
|
||||
llm_temperature: optional_env_parsed("LLM_TEMPERATURE", 0.0),
|
||||
llm_timeout_seconds: optional_env_parsed("LLM_TIMEOUT_SECONDS", 180),
|
||||
llm_system_prompt: {
|
||||
let v = optional_env("LLM_SYSTEM_PROMPT", "");
|
||||
if v.is_empty() {
|
||||
crate::analyze::prompt::SYSTEM_PROMPT.to_string()
|
||||
} else {
|
||||
v
|
||||
}
|
||||
},
|
||||
session_timeout_hours: optional_env_parsed("SESSION_TIMEOUT_HOURS", 8),
|
||||
cookie_secure: optional_env_parsed("COOKIE_SECURE", true),
|
||||
}
|
||||
@@ -135,6 +148,7 @@ impl Config {
|
||||
llm_model: String::new(),
|
||||
llm_temperature: 0.0,
|
||||
llm_timeout_seconds: 180,
|
||||
llm_system_prompt: crate::analyze::prompt::SYSTEM_PROMPT.to_string(),
|
||||
session_timeout_hours: 8,
|
||||
cookie_secure: false,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user