mirror of
https://github.com/katanemo/plano.git
synced 2026-06-17 15:25:17 +02:00
cleaned up logs and fixed issue with connectivity for llm gateway in weather forecast demo
This commit is contained in:
parent
1212b526b8
commit
e49ff4bbf4
8 changed files with 260 additions and 220 deletions
|
|
@ -3,9 +3,9 @@ use brightstaff::handlers::llm::llm_chat;
|
|||
use brightstaff::handlers::models::list_models;
|
||||
use brightstaff::handlers::function_calling::{function_calling_chat_handler};
|
||||
use brightstaff::router::llm_router::RouterService;
|
||||
use brightstaff::state::memory::MemoryConversationalStorage;
|
||||
use brightstaff::state::StateStorage;
|
||||
use brightstaff::state::supabase::SupabaseConversationalStorage;
|
||||
use brightstaff::state::postgresql::PostgreSQLConversationStorage;
|
||||
use brightstaff::state::memory::MemoryConversationalStorage;
|
||||
use brightstaff::utils::tracing::init_tracer;
|
||||
use bytes::Bytes;
|
||||
use common::configuration::Configuration;
|
||||
|
|
@ -123,7 +123,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
|||
debug!("Postgres connection string (full): {}", connection_string);
|
||||
info!("Initializing conversation state storage: Postgres");
|
||||
Arc::new(
|
||||
SupabaseConversationalStorage::new(connection_string.clone())
|
||||
PostgreSQLConversationStorage::new(connection_string.clone())
|
||||
.await
|
||||
.expect("Failed to initialize Postgres state storage"),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use tracing::{debug};
|
|||
|
||||
pub mod memory;
|
||||
pub mod response_state_processor;
|
||||
pub mod supabase;
|
||||
pub mod postgresql;
|
||||
|
||||
/// Represents the conversational state for a v1/responses request
|
||||
/// Contains the complete input/output history that can be restored
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ use tracing::{debug, info, warn};
|
|||
|
||||
/// Supabase/PostgreSQL storage backend for conversation state
|
||||
#[derive(Clone)]
|
||||
pub struct SupabaseConversationalStorage {
|
||||
pub struct PostgreSQLConversationStorage {
|
||||
client: Arc<Client>,
|
||||
table_verified: Arc<OnceCell<()>>,
|
||||
}
|
||||
|
||||
impl SupabaseConversationalStorage {
|
||||
impl PostgreSQLConversationStorage {
|
||||
/// Creates a new Supabase storage instance with the given connection string
|
||||
pub async fn new(connection_string: String) -> Result<Self, StateStorageError> {
|
||||
let (client, connection) = tokio_postgres::connect(&connection_string, NoTls)
|
||||
|
|
@ -76,7 +76,7 @@ impl SupabaseConversationalStorage {
|
|||
}
|
||||
|
||||
#[async_trait]
|
||||
impl StateStorage for SupabaseConversationalStorage {
|
||||
impl StateStorage for PostgreSQLConversationStorage {
|
||||
async fn put(&self, state: OpenAIConversationState) -> Result<(), StateStorageError> {
|
||||
self.ensure_ready().await?;
|
||||
|
||||
|
|
@ -251,9 +251,9 @@ mod tests {
|
|||
// Set TEST_DATABASE_URL environment variable to run integration tests
|
||||
// Example: TEST_DATABASE_URL=postgresql://user:pass@localhost/test_db
|
||||
|
||||
async fn get_test_storage() -> Option<SupabaseConversationalStorage> {
|
||||
async fn get_test_storage() -> Option<PostgreSQLConversationStorage> {
|
||||
if let Ok(db_url) = std::env::var("TEST_DATABASE_URL") {
|
||||
match SupabaseConversationalStorage::new(db_url).await {
|
||||
match PostgreSQLConversationStorage::new(db_url).await {
|
||||
Ok(storage) => Some(storage),
|
||||
Err(e) => {
|
||||
eprintln!("Failed to create test storage: {}", e);
|
||||
Loading…
Add table
Add a link
Reference in a new issue