-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip - initial/ experimental insert to database
- Loading branch information
Showing
9 changed files
with
306 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
use std::path::PathBuf; | ||
use std::sync::{Arc, Mutex}; | ||
|
||
use rusqlite::Error as SqliteError; | ||
|
||
mod connector; | ||
mod schema; | ||
mod store; | ||
|
||
pub use connector::DatabaseConnector; | ||
pub use schema::{ | ||
ConversationId, Exchange, InMemoryDatabase, Message, ModelId, | ||
}; | ||
pub use store::ConversationDatabaseStore; | ||
|
||
pub use super::PromptRole; | ||
|
||
pub struct ConversationDatabase { | ||
pub store: Arc<Mutex<ConversationDatabaseStore>>, | ||
pub cache: Arc<Mutex<InMemoryDatabase>>, | ||
} | ||
|
||
impl ConversationDatabase { | ||
pub fn new(sqlite_file: &PathBuf) -> Result<Self, SqliteError> { | ||
Ok(Self { | ||
store: Arc::new(Mutex::new(ConversationDatabaseStore::new( | ||
sqlite_file, | ||
)?)), | ||
cache: Arc::new(Mutex::new(InMemoryDatabase::new())), | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.