diff options
author | Oxbian <oxbian@mailbox.org> | 2025-03-02 18:54:59 -0500 |
---|---|---|
committer | Oxbian <oxbian@mailbox.org> | 2025-03-02 18:54:59 -0500 |
commit | 25cf2d92f3198ba7541dad979eca1f9c1238ff04 (patch) | |
tree | 605e4bda26caeaf2e4e5a82c225f0028c22597a9 /src/helper/init.rs | |
parent | 2c03f0c29f582e7c8b2bd99c1ffa0b1ca7c96eff (diff) | |
download | NAI-25cf2d92f3198ba7541dad979eca1f9c1238ff04.tar.gz NAI-25cf2d92f3198ba7541dad979eca1f9c1238ff04.zip |
feat: llama.cpp -> ollama API + reading from stream
Diffstat (limited to 'src/helper/init.rs')
-rw-r--r-- | src/helper/init.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/helper/init.rs b/src/helper/init.rs index 392e4fb..084caf5 100644 --- a/src/helper/init.rs +++ b/src/helper/init.rs @@ -1,12 +1,18 @@ -use std::fs::File; +use std::fs::OpenOptions; use std::io::{self, Write}; pub fn print_in_file(content: String) -> io::Result<()> { // Open the file (create it if it doesn't exist, or truncate it if it does) - let mut file = File::create("debug.txt")?; + let mut file = OpenOptions::new() + .write(true) + .append(true) + .create(true) + .open("debug.txt") + .unwrap(); - // Write the content to the file - file.write_all(content.as_bytes())?; + if let Err(e) = writeln!(file, "{}", content) { + eprintln!("Couldn't write to file: {}", e); + } Ok(()) } |