config file, bugfixes
This commit is contained in:
@@ -4,6 +4,8 @@ use serde::{Deserialize, Serialize};
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::config::Config;
|
||||
|
||||
const SYSTEM_PROMPT: &str = "You are an AI assistant running in a terminal (CLI) environment. \
|
||||
Optimise all answers for 80‑column readability, prefer plain text, \
|
||||
ASCII art or concise bullet lists over heavy markup, and wrap code \
|
||||
@@ -62,8 +64,9 @@ impl Session {
|
||||
}
|
||||
|
||||
pub fn sessions_dir() -> Result<PathBuf> {
|
||||
let config = Config::load().unwrap_or_default();
|
||||
let home = dirs::home_dir().context("Could not find home directory")?;
|
||||
let sessions_dir = home.join(".chat_cli_sessions");
|
||||
let sessions_dir = home.join(&config.session.sessions_dir_name);
|
||||
|
||||
if !sessions_dir.exists() {
|
||||
fs::create_dir_all(&sessions_dir)
|
||||
@@ -74,7 +77,8 @@ impl Session {
|
||||
}
|
||||
|
||||
pub fn session_path(name: &str) -> Result<PathBuf> {
|
||||
Ok(Self::sessions_dir()?.join(format!("{}.json", name)))
|
||||
let config = Config::load().unwrap_or_default();
|
||||
Ok(Self::sessions_dir()?.join(format!("{}.{}", name, config.session.file_extension)))
|
||||
}
|
||||
|
||||
pub fn save(&self) -> Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user