feat: implement workflow findings sharing for inter-agent communication in workflows
This commit is contained in:
+22
-4
@@ -30,11 +30,13 @@ impl LlmClient {
|
||||
/// Construct a client, falling back to built-in defaults for empty inputs.
|
||||
///
|
||||
/// Flow: empty api_key/model → substitute defaults → build reqwest client
|
||||
/// with connect/request timeouts (falling back to an untimed client if
|
||||
/// the builder fails) → normalize base_url.
|
||||
/// with connect/request timeouts → if TLS config fails, retry with just
|
||||
/// request timeout (no connect timeout) → normalize base_url.
|
||||
///
|
||||
/// Why: empty strings are treated as "unset" rather than errors so callers
|
||||
/// can pass through unconfigured settings without special-casing them.
|
||||
/// Timeouts are always enforced — the pure-default-client fallback is only
|
||||
/// used as a last resort when even the no-connect-timeout build fails.
|
||||
pub fn new(mut api_key: String, model: String, base_url: Option<String>) -> Self {
|
||||
if api_key.is_empty() {
|
||||
api_key = DEFAULT_API_KEY.to_string();
|
||||
@@ -51,8 +53,24 @@ impl LlmClient {
|
||||
{
|
||||
Ok(c) => c,
|
||||
Err(e) => {
|
||||
tracing::warn!("warning: failed to build reqwest client with timeouts: {}. Using default client without timeouts.", e);
|
||||
reqwest::blocking::Client::new()
|
||||
tracing::warn!(
|
||||
"failed to build reqwest client with connect timeout: {}. \
|
||||
retrying without connect timeout",
|
||||
e,
|
||||
);
|
||||
match reqwest::blocking::Client::builder()
|
||||
.timeout(REQUEST_TIMEOUT)
|
||||
.build()
|
||||
{
|
||||
Ok(c) => c,
|
||||
Err(e2) => {
|
||||
tracing::warn!(
|
||||
"also failed: {}. using default client (no configured timeouts)",
|
||||
e2,
|
||||
);
|
||||
reqwest::blocking::Client::new()
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
LlmClient {
|
||||
|
||||
Reference in New Issue
Block a user