Fix crash: remove server SSE fallback, return error when no Bedrock config available
This commit is contained in:
@@ -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,19 +318,15 @@ 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))
|
});
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
let (tx, rx) = async_channel::unbounded();
|
let (tx, rx) = async_channel::unbounded();
|
||||||
let _ = tx.send(Err(e)).await;
|
let _ = tx.send(Err(err)).await;
|
||||||
Ok(Box::pin(rx))
|
Ok(Box::pin(rx))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_supported_tools(params: &RequestParams) -> Vec<api::ToolType> {
|
fn get_supported_tools(params: &RequestParams) -> Vec<api::ToolType> {
|
||||||
let mut supported_tools = vec![
|
let mut supported_tools = vec![
|
||||||
|
|||||||
Reference in New Issue
Block a user