move method to endpoint section and use Agent AI app name

This commit is contained in:
Adil Hafeez 2024-12-06 11:54:50 -08:00
parent c40a6d66c8
commit 428227d98e
11 changed files with 36 additions and 32 deletions

View file

@ -194,12 +194,6 @@ pub struct Parameter {
pub in_path: Option<bool>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EndpointDetails {
pub name: String,
pub path: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, Default)]
pub enum HttpMethod {
#[default]
@ -218,13 +212,19 @@ impl Display for HttpMethod {
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EndpointDetails {
pub name: String,
pub path: Option<String>,
#[serde(rename = "http_method")]
pub method: Option<HttpMethod>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PromptTarget {
pub name: String,
pub default: Option<bool>,
pub description: String,
#[serde(rename = "http_method")]
pub method: Option<HttpMethod>,
pub endpoint: Option<EndpointDetails>,
pub parameters: Option<Vec<Parameter>>,
pub system_prompt: Option<String>,

View file

@ -920,7 +920,7 @@ impl StreamContext {
}
};
let http_method = prompt_target.method.unwrap_or_default().to_string();
let http_method = endpoint.method.unwrap_or_default().to_string();
let mut headers = vec![
(ARCH_UPSTREAM_HOST_HEADER, endpoint.name.as_str()),
(":method", &http_method),