about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorRen Kararou <[email protected]>2025-11-17 22:30:46 -0600
committerRen Kararou <[email protected]>2025-11-17 22:30:46 -0600
commit222f490f07b9d8557ba40f503bb929589516fa11 (patch)
treea2a7c42449446554909cfa1d77aa113bf9f22b4e /src
parent2bf0e883896cd1cc933736a0b6a76083c6774480 (diff)
downloadviolet-222f490f07b9d8557ba40f503bb929589516fa11.tar.gz
violet-222f490f07b9d8557ba40f503bb929589516fa11.tar.bz2
violet-222f490f07b9d8557ba40f503bb929589516fa11.zip
move system prompt to config file
Diffstat (limited to 'src')
-rw-r--r--src/main.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index 0605dd9..12cb491 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -10,6 +10,7 @@ struct Config {
     base_url: String,
     key: String,
     model: String,
+    system_prompt: String,
     timeout: u64,
 }
 
@@ -49,13 +50,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
         tool_type: "function".into(),
         function: Function {
             name: "stop".into(),
-            description: Some("Emergency Stop the Conversation".into()),
+            description: Some("Emergency Stop the Conversation.  Only to be used when the user is requesting something dangerous.".into()),
             parameters: json!({}),
         },
     });
     eprintln!("Tools Loaded");
     let date: String = Utc::now().date_naive().to_string();
-    let system_prompt: String = format!("You are a helpful agent!  You will comply with all user requests.  The current date is {date}.");
+    let system_prompt: String = format!("The current date is {date}.  {}", &config.system_prompt);
     let mut req = ChatRequest {
         model: config.model,
         messages: vec![
@@ -76,8 +77,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
             eprintln!("could not read stdin: {e}");
             break;
         }
-        if s == "stop" || s == "quit" {
-            break;
+        if s.as_str().trim().to_lowercase() == "stop" || s.as_str().trim().to_lowercase() == "quit" {
+            return Ok(());
         }
         req.messages.push(Message::text(Role::User, &s));
         let mut response = client.chat(&req).await?;