Fix crash: remove server SSE fallback, return error when no Bedrock config available

This commit is contained in:
Ryan Ward
2026-05-12 10:51:06 -05:00
parent ee69403bdb
commit ca1337ad7d
+9 -13
View File
@@ -12,7 +12,7 @@ use crate::server::server_api::ServerApi;
use super::{convert_to::convert_input, ConvertToAPITypeError, RequestParams, ResponseStream}; use super::{convert_to::convert_input, ConvertToAPITypeError, RequestParams, ResponseStream};
pub async fn generate_multi_agent_output( pub async fn generate_multi_agent_output(
server_api: Arc<ServerApi>, _server_api: Arc<ServerApi>,
bedrock_config: Option<BedrockClientConfig>, bedrock_config: Option<BedrockClientConfig>,
mut params: RequestParams, mut params: RequestParams,
cancellation_rx: futures::channel::oneshot::Receiver<()>, cancellation_rx: futures::channel::oneshot::Receiver<()>,
@@ -318,18 +318,14 @@ pub async fn generate_multi_agent_output(
} }
} }
let response_stream = server_api.generate_multi_agent_output(&request).await; log::error!("[bedrock] No Bedrock config available and server fallback is disabled. Cannot process request.");
match response_stream { let err = Arc::new(crate::server::server_api::AIApiError::Stream {
Ok(stream) => { stream_type: "bedrock_converse",
let output_stream = stream.take_until(cancellation_rx); source: anyhow::anyhow!("No AI backend available. Please configure Bedrock credentials in Settings > AI."),
Ok(Box::pin(output_stream)) });
} let (tx, rx) = async_channel::unbounded();
Err(e) => { let _ = tx.send(Err(err)).await;
let (tx, rx) = async_channel::unbounded(); Ok(Box::pin(rx))
let _ = tx.send(Err(e)).await;
Ok(Box::pin(rx))
}
}
} }
fn get_supported_tools(params: &RequestParams) -> Vec<api::ToolType> { fn get_supported_tools(params: &RequestParams) -> Vec<api::ToolType> {