mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-30 08:16:49 +00:00
feat: filter resource types passed to gpt-4 (#2430)
* feat: code gen filter resource types * fix: minor * feat: using snake case for flow inputs * fix: filter resource types for python * fix: correct resrouce type name + wmill import * fix: disable automerge ci * fix: remove unnecessary json parsing
This commit is contained in:
@@ -14,7 +14,9 @@ use crate::{
|
||||
HTTP_CLIENT,
|
||||
};
|
||||
use axum::{
|
||||
body::StreamBody,
|
||||
extract::{Extension, Path, Query},
|
||||
response::IntoResponse,
|
||||
routing::{get, post},
|
||||
Json, Router,
|
||||
};
|
||||
@@ -41,8 +43,7 @@ use windmill_common::{
|
||||
},
|
||||
users::username_to_permissioned_as,
|
||||
utils::{
|
||||
list_elems_from_hub, not_found_if_none, paginate, query_elems_from_hub, require_admin,
|
||||
Pagination, StripPath,
|
||||
not_found_if_none, paginate, query_elems_from_hub, require_admin, Pagination, StripPath,
|
||||
},
|
||||
};
|
||||
use windmill_queue::{self, schedule::push_scheduled_job, PushIsolationLevel, QueueTransaction};
|
||||
@@ -233,14 +234,19 @@ async fn list_scripts(
|
||||
Ok(Json(rows))
|
||||
}
|
||||
|
||||
async fn list_hub_scripts(ApiAuthed { email, .. }: ApiAuthed) -> JsonResult<serde_json::Value> {
|
||||
let asks = list_elems_from_hub(
|
||||
async fn list_hub_scripts(ApiAuthed { email, .. }: ApiAuthed) -> impl IntoResponse {
|
||||
let (status_code, headers, response) = query_elems_from_hub(
|
||||
&HTTP_CLIENT,
|
||||
"https://hub.windmill.dev/searchData?approved=true",
|
||||
&email,
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
Ok(Json(asks))
|
||||
Ok::<_, Error>((
|
||||
status_code,
|
||||
headers,
|
||||
StreamBody::new(response.bytes_stream()),
|
||||
))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -252,17 +258,26 @@ struct HubScriptsQuery {
|
||||
async fn query_hub_scripts(
|
||||
ApiAuthed { email, .. }: ApiAuthed,
|
||||
Query(query): Query<HubScriptsQuery>,
|
||||
) -> JsonResult<serde_json::Value> {
|
||||
let asks = query_elems_from_hub(
|
||||
) -> impl IntoResponse {
|
||||
let mut query_params = vec![("text", query.text)];
|
||||
if let Some(query_kind) = query.kind {
|
||||
query_params.push(("kind", query_kind.clone()));
|
||||
}
|
||||
if let Some(query_limit) = query.limit {
|
||||
query_params.push(("limit", query_limit.to_string().clone()));
|
||||
}
|
||||
let (status_code, headers, response) = query_elems_from_hub(
|
||||
&HTTP_CLIENT,
|
||||
"https://hub.windmill.dev/scripts/query",
|
||||
&email,
|
||||
&query.text,
|
||||
&query.kind,
|
||||
&query.limit,
|
||||
Some(query_params),
|
||||
)
|
||||
.await?;
|
||||
Ok(Json(asks))
|
||||
Ok::<_, Error>((
|
||||
status_code,
|
||||
headers,
|
||||
StreamBody::new(response.bytes_stream()),
|
||||
))
|
||||
}
|
||||
|
||||
fn hash_script(ns: &NewScript) -> i64 {
|
||||
|
||||
Reference in New Issue
Block a user