diff options
author | Oxbian <oxbian@mailbox.org> | 2025-05-18 12:19:33 -0400 |
---|---|---|
committer | Oxbian <oxbian@mailbox.org> | 2025-05-18 12:19:33 -0400 |
commit | ea5fe19ad751fd6fa686e502a5cf7f26a78668e9 (patch) | |
tree | cd005f10acc256613ef5a9b88cf36733659ea57f /src/app/modules/chat.rs | |
parent | fecb211130ec487c7c617d28419c6d0097f19783 (diff) | |
download | NAI-main.tar.gz NAI-main.zip |
feat: refactor chat, resume into modules + color in UImain
Diffstat (limited to 'src/app/modules/chat.rs')
-rw-r--r-- | src/app/modules/chat.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/app/modules/chat.rs b/src/app/modules/chat.rs new file mode 100644 index 0000000..ee00c98 --- /dev/null +++ b/src/app/modules/chat.rs @@ -0,0 +1,9 @@ +use crate::app::llm::{LLM, Message, MessageType}; + +pub async fn ask_chat(mut messages: Vec<Message>) -> Result<String, Box<dyn std::error::Error>> { + let chat_llm = LLM::new("config/chat-LLM.json"); + messages.push(Message::new(MessageType::USER, chat_llm.system_prompt.to_string())); + + let result: String = chat_llm.ask(&messages).await?; + Ok(result) +} |