mirror of https://github.com/buster-so/buster.git
Merge branch 'evals' of https://github.com/buster-so/buster into evals
This commit is contained in:
commit
6366783a49
|
@ -462,10 +462,11 @@ impl Agent {
|
||||||
(trace_builder, parent_span)
|
(trace_builder, parent_span)
|
||||||
};
|
};
|
||||||
|
|
||||||
if recursion_depth >= 30 {
|
// Limit recursion to a maximum of 15 times
|
||||||
|
if recursion_depth >= 15 {
|
||||||
let message = AgentMessage::assistant(
|
let message = AgentMessage::assistant(
|
||||||
Some("max_recursion_depth_message".to_string()),
|
Some("max_recursion_depth_message".to_string()),
|
||||||
Some("I apologize, but I've reached the maximum number of actions (30). Please try breaking your request into smaller parts.".to_string()),
|
Some("I apologize, but I've reached the maximum number of actions (15). Please try breaking your request into smaller parts.".to_string()),
|
||||||
None,
|
None,
|
||||||
MessageProgress::Complete,
|
MessageProgress::Complete,
|
||||||
None,
|
None,
|
||||||
|
|
|
@ -109,7 +109,6 @@ pub struct UpdateCollectionAssetsRequest {
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
pub struct UpdateCollectionRequest {
|
pub struct UpdateCollectionRequest {
|
||||||
pub id: Uuid,
|
|
||||||
pub collection: Option<UpdateCollectionObject>,
|
pub collection: Option<UpdateCollectionObject>,
|
||||||
pub assets: Option<Vec<UpdateCollectionAssetsRequest>>,
|
pub assets: Option<Vec<UpdateCollectionAssetsRequest>>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,16 +21,18 @@ use crate::collections::types::{
|
||||||
///
|
///
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
/// * `user_id` - The ID of the user updating the collection
|
/// * `user_id` - The ID of the user updating the collection
|
||||||
|
/// * `collection_id` - The ID of the collection to update
|
||||||
/// * `req` - The request containing the collection updates
|
/// * `req` - The request containing the collection updates
|
||||||
///
|
///
|
||||||
/// # Returns
|
/// # Returns
|
||||||
/// * `Result<CollectionState>` - The updated collection state
|
/// * `Result<CollectionState>` - The updated collection state
|
||||||
pub async fn update_collection_handler(
|
pub async fn update_collection_handler(
|
||||||
user_id: &Uuid,
|
user_id: &Uuid,
|
||||||
|
collection_id: Uuid,
|
||||||
req: UpdateCollectionRequest,
|
req: UpdateCollectionRequest,
|
||||||
) -> Result<CollectionState> {
|
) -> Result<CollectionState> {
|
||||||
let user_id = Arc::new(*user_id);
|
let user_id = Arc::new(*user_id);
|
||||||
let collection_id = Arc::new(req.id);
|
let collection_id = Arc::new(collection_id);
|
||||||
|
|
||||||
// Update collection record if provided
|
// Update collection record if provided
|
||||||
let update_collection_record_handle = if let Some(collection) = req.collection {
|
let update_collection_record_handle = if let Some(collection) = req.collection {
|
||||||
|
@ -89,7 +91,7 @@ pub async fn update_collection_handler(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the updated collection
|
// Get the updated collection
|
||||||
let collection = match fetch_collection(&req.id).await? {
|
let collection = match fetch_collection(&collection_id).await? {
|
||||||
Some(collection) => collection,
|
Some(collection) => collection,
|
||||||
None => return Err(anyhow!("Collection not found")),
|
None => return Err(anyhow!("Collection not found")),
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use axum::{
|
use axum::{
|
||||||
|
extract::Path,
|
||||||
http::StatusCode,
|
http::StatusCode,
|
||||||
Extension, Json,
|
Extension, Json,
|
||||||
};
|
};
|
||||||
|
@ -10,11 +11,12 @@ use uuid::Uuid;
|
||||||
///
|
///
|
||||||
/// This endpoint updates a collection with the provided details.
|
/// This endpoint updates a collection with the provided details.
|
||||||
pub async fn update_collection(
|
pub async fn update_collection(
|
||||||
|
Path(collection_id): Path<Uuid>,
|
||||||
Extension(user): Extension<AuthenticatedUser>,
|
Extension(user): Extension<AuthenticatedUser>,
|
||||||
Json(req): Json<UpdateCollectionRequest>,
|
Json(req): Json<UpdateCollectionRequest>,
|
||||||
) -> Result<Json<CollectionState>, (StatusCode, String)> {
|
) -> Result<Json<CollectionState>, (StatusCode, String)> {
|
||||||
// Call the handler
|
// Call the handler
|
||||||
match update_collection_handler(&user.id, req).await {
|
match update_collection_handler(&user.id, collection_id, req).await {
|
||||||
Ok(collection) => Ok(Json(collection)),
|
Ok(collection) => Ok(Json(collection)),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tracing::error!("Error updating collection: {}", e);
|
tracing::error!("Error updating collection: {}", e);
|
||||||
|
|
|
@ -68,7 +68,9 @@ export const collectionsDeleteCollection = async (params: {
|
||||||
/** Array of collection IDs to be deleted */
|
/** Array of collection IDs to be deleted */
|
||||||
ids: string[];
|
ids: string[];
|
||||||
}) => {
|
}) => {
|
||||||
return await mainApi.delete<BusterCollection>('/collections', { params }).then((res) => res.data);
|
return await mainApi.delete<BusterCollection>('/collections', {
|
||||||
|
data: { ids: params.ids }
|
||||||
|
}).then((res) => res.data);
|
||||||
};
|
};
|
||||||
|
|
||||||
// share collections
|
// share collections
|
||||||
|
|
|
@ -52,7 +52,9 @@ export const updateMetric = async (params: UpdateMetricParams) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteMetrics = async (params: { ids: string[] }) => {
|
export const deleteMetrics = async (params: { ids: string[] }) => {
|
||||||
return mainApi.delete<null>(`/metrics/delete`, { params }).then((res) => res.data);
|
return mainApi.delete<null>(`/metrics/delete`, {
|
||||||
|
data: { ids: params.ids }
|
||||||
|
}).then((res) => res.data);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const duplicateMetric = async (params: {
|
export const duplicateMetric = async (params: {
|
||||||
|
|
Loading…
Reference in New Issue