@@ -173,7 +173,7 @@ impl LLMRuntimeModel for Qwen3Model {
173173 response_tx : Arc < std:: sync:: mpsc:: Sender < crate :: Query > > ,
174174 ) -> anyhow:: Result < ( ) , Error > {
175175 if let Query :: Prompt {
176- messages : _ ,
176+ messages,
177177 tools : _,
178178 config,
179179 chunk_size,
@@ -187,13 +187,27 @@ impl LLMRuntimeModel for Qwen3Model {
187187
188188 // preprocess message by applying chat template
189189 let message = {
190- let template = self . template . as_ref ( ) . ok_or ( Error :: ExecutionError (
190+ match self . template . as_ref ( ) . ok_or ( Error :: ExecutionError (
191191 "Template is missing in config!" . to_string ( ) ,
192- ) ) ?;
193- let proc = self . template_proc . as_ref ( ) . ok_or ( Error :: ExecutionError (
194- "Template processor is not intialized" . to_string ( ) ,
195- ) ) ?;
196- message. apply_template ( template, proc) ?
192+ ) ) {
193+ Ok ( template) => {
194+ let proc = self . template_proc . as_ref ( ) . ok_or ( Error :: ExecutionError (
195+ "Template processor is not intialized" . to_string ( ) ,
196+ ) ) ?;
197+ message. apply_template ( template, proc) ?
198+ }
199+ Err ( _) => {
200+ tracing:: error!( "No templates have been found. Sending plain query" ) ;
201+
202+ // FIXME: we don't want the plain prompt to be send to the model. Not loading the
203+ // template from the plugin config indicates a deeper problem.
204+ messages[ 0 ] . content . clone ( )
205+ }
206+ }
207+
208+ // let template = self.template.as_ref().ok_or(Error::ExecutionError(
209+ // "Template is missing in config!".to_string(),
210+ // ))?;
197211 } ;
198212
199213 let QueryConfig {
0 commit comments