Cargo fix
This commit is contained in:
@@ -4,7 +4,7 @@ use serde::Serialize;
|
||||
use std::ops::DerefMut;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use crate::database::{connect, DbError, DbErrorKind};
|
||||
use crate::database::{DbError, DbErrorKind, connect};
|
||||
use crate::otel::trace_db_call;
|
||||
|
||||
/// Represents a daily conversation summary
|
||||
@@ -125,7 +125,10 @@ impl DailySummaryDao for SqliteDailySummaryDao {
|
||||
summary: InsertDailySummary,
|
||||
) -> Result<DailySummary, DbError> {
|
||||
trace_db_call(context, "insert", "store_summary", |_span| {
|
||||
let mut conn = self.connection.lock().expect("Unable to get DailySummaryDao");
|
||||
let mut conn = self
|
||||
.connection
|
||||
.lock()
|
||||
.expect("Unable to get DailySummaryDao");
|
||||
|
||||
// Validate embedding dimensions
|
||||
if summary.embedding.len() != 768 {
|
||||
@@ -141,7 +144,7 @@ impl DailySummaryDao for SqliteDailySummaryDao {
|
||||
diesel::sql_query(
|
||||
"INSERT OR REPLACE INTO daily_conversation_summaries
|
||||
(date, contact, summary, message_count, embedding, created_at, model_version)
|
||||
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7)"
|
||||
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7)",
|
||||
)
|
||||
.bind::<diesel::sql_types::Text, _>(&summary.date)
|
||||
.bind::<diesel::sql_types::Text, _>(&summary.contact)
|
||||
@@ -266,11 +269,14 @@ impl DailySummaryDao for SqliteDailySummaryDao {
|
||||
contact: &str,
|
||||
) -> Result<bool, DbError> {
|
||||
trace_db_call(context, "query", "summary_exists", |_span| {
|
||||
let mut conn = self.connection.lock().expect("Unable to get DailySummaryDao");
|
||||
let mut conn = self
|
||||
.connection
|
||||
.lock()
|
||||
.expect("Unable to get DailySummaryDao");
|
||||
|
||||
let count = diesel::sql_query(
|
||||
"SELECT COUNT(*) as count FROM daily_conversation_summaries
|
||||
WHERE date = ?1 AND contact = ?2"
|
||||
WHERE date = ?1 AND contact = ?2",
|
||||
)
|
||||
.bind::<diesel::sql_types::Text, _>(date)
|
||||
.bind::<diesel::sql_types::Text, _>(contact)
|
||||
@@ -289,10 +295,13 @@ impl DailySummaryDao for SqliteDailySummaryDao {
|
||||
contact: &str,
|
||||
) -> Result<i64, DbError> {
|
||||
trace_db_call(context, "query", "get_summary_count", |_span| {
|
||||
let mut conn = self.connection.lock().expect("Unable to get DailySummaryDao");
|
||||
let mut conn = self
|
||||
.connection
|
||||
.lock()
|
||||
.expect("Unable to get DailySummaryDao");
|
||||
|
||||
diesel::sql_query(
|
||||
"SELECT COUNT(*) as count FROM daily_conversation_summaries WHERE contact = ?1"
|
||||
"SELECT COUNT(*) as count FROM daily_conversation_summaries WHERE contact = ?1",
|
||||
)
|
||||
.bind::<diesel::sql_types::Text, _>(contact)
|
||||
.get_result::<CountResult>(conn.deref_mut())
|
||||
|
||||
Reference in New Issue
Block a user