Fix potential panic in create_http_context

Signed-off-by: José Ulises Niño Rivera <junr03@users.noreply.github.com>
This commit is contained in:
José Ulises Niño Rivera 2024-10-13 15:41:28 -06:00
parent 5e22c24f77
commit 03291c018a

View file

@ -282,7 +282,10 @@ impl RootContext for FilterContext {
// No StreamContext can be created until the Embedding Store is fully initialized.
let embedding_store = match self.mode {
GatewayMode::Llm => None,
GatewayMode::Prompt => Some(Rc::clone(self.embeddings_store.as_ref().unwrap())),
GatewayMode::Prompt => match self.embeddings_store.as_ref() {
None => return None,
Some(store) => Some(Rc::clone(store)),
},
};
Some(Box::new(StreamContext::new(
context_id,