diff options
author | Oxbian <oxbian@mailbox.org> | 2025-03-02 21:32:20 -0500 |
---|---|---|
committer | Oxbian <oxbian@mailbox.org> | 2025-03-02 21:32:20 -0500 |
commit | e4eaecc8ce7fb3e84977c41597eff80edd4d73c7 (patch) | |
tree | fd33e7d93a680b2e0e93cb0eacb66137bd77ecab /src/app/init.rs | |
parent | 25cf2d92f3198ba7541dad979eca1f9c1238ff04 (diff) | |
download | NAI-e4eaecc8ce7fb3e84977c41597eff80edd4d73c7.tar.gz NAI-e4eaecc8ce7fb3e84977c41597eff80edd4d73c7.zip |
feat: conversation saved in file
Diffstat (limited to 'src/app/init.rs')
-rw-r--r-- | src/app/init.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/app/init.rs b/src/app/init.rs index aa74ae5..f62b2d0 100644 --- a/src/app/init.rs +++ b/src/app/init.rs @@ -1,9 +1,11 @@ use crate::app::llm::{Message, MessageType, LLM}; -use crate::helper::init::print_in_file; +use crate::helper::init::warn; +use uuid::Uuid; use tokio; pub struct App { pub messages: Vec<Message>, // History of recorded message + conv_id: Uuid, chat_llm: LLM, resume_llm: LLM, } @@ -16,6 +18,7 @@ impl App { MessageType::SYSTEM, chat_llm.system_prompt.clone(), )], + conv_id: Uuid::new_v4(), chat_llm, resume_llm: LLM::new("config/resume-LLM.json".to_string()).unwrap(), } @@ -23,6 +26,7 @@ impl App { fn append_message(&mut self, msg: String, role: MessageType) { let message = Message::new(role, msg); + message.save_message(self.conv_id.to_string()); self.messages.push(message); } |