File tree Expand file tree Collapse file tree 4 files changed +266
-129
lines changed
Expand file tree Collapse file tree 4 files changed +266
-129
lines changed Original file line number Diff line number Diff line change @@ -566,6 +566,46 @@ impl ChatSession {
566566 }
567567 }
568568
569+ pub fn create_from_config (
570+ config : & crate :: config:: AIConfig ,
571+ tools : ToolSet < McpToolAdapter > ,
572+ ) -> Self {
573+ match config {
574+ crate :: config:: AIConfig :: Stable { llm, .. } => {
575+ let mut session = ChatSession :: new (
576+ llm. llm_chat_url . clone ( ) ,
577+ llm. api_key . clone ( ) . unwrap_or_default ( ) ,
578+ llm. model . clone ( ) ,
579+ None ,
580+ llm. history ,
581+ tools,
582+ ) ;
583+
584+ session. system_prompts = llm. sys_prompts . clone ( ) ;
585+ session. messages = llm. dynamic_prompts . clone ( ) ;
586+
587+ session
588+ }
589+ crate :: config:: AIConfig :: GeminiAndTTS { gemini, .. }
590+ | crate :: config:: AIConfig :: Gemini { gemini } => {
591+ let mut session = ChatSession :: new (
592+ String :: new ( ) ,
593+ gemini. api_key . clone ( ) ,
594+ gemini
595+ . model
596+ . clone ( )
597+ . unwrap_or ( "models/gemini-2.0-flash-live-001" . to_string ( ) ) ,
598+ None ,
599+ 20 ,
600+ tools,
601+ ) ;
602+
603+ session. system_prompts = gemini. sys_prompts . clone ( ) ;
604+ session
605+ }
606+ }
607+ }
608+
569609 pub fn add_user_message ( & mut self , message : String ) {
570610 self . messages . push_back ( llm:: Content {
571611 role : llm:: Role :: User ,
Original file line number Diff line number Diff line change 11pub mod file;
22pub mod realtime_ws;
33pub mod ws;
4+ pub mod ws_record;
You can’t perform that action at this time.
0 commit comments