fix pipedream app search

This commit is contained in:
Saumya 2025-07-09 23:27:25 +05:30
parent 7bc95af934
commit aa06019f7e
2 changed files with 9 additions and 35 deletions

View File

@ -355,10 +355,10 @@ async def get_available_pipedream_tools(
@router.get("/apps", response_model=Dict[str, Any])
async def get_pipedream_apps(
page: int = Query(1, ge=1),
search: Optional[str] = Query(None),
q: Optional[str] = Query(None),
category: Optional[str] = Query(None)
):
logger.info(f"Fetching Pipedream apps registry, page: {page}")
logger.info(f"Fetching Pipedream apps registry, page: {page}, search: {q}")
try:
import httpx
@ -367,8 +367,8 @@ async def get_pipedream_apps(
url = f"https://mcp.pipedream.com/api/apps"
params = {"page": page}
if search:
params["search"] = search
if q:
params["q"] = q
if category:
params["category"] = category

View File

@ -179,14 +179,14 @@ export const pipedreamApi = {
},
async getApps(page: number = 1, search?: string, category?: string): Promise<PipedreamAppResponse> {
if (search) {
return await this.searchApps(search, page, category);
}
const params = new URLSearchParams({
page: page.toString(),
});
if (search) {
params.append('q', search);
}
if (category) {
params.append('category', category);
}
@ -209,33 +209,7 @@ export const pipedreamApi = {
},
async searchApps(query: string, page: number = 1, category?: string): Promise<PipedreamAppResponse> {
const params = new URLSearchParams({
q: query,
page: page.toString(),
});
if (category) {
params.append('category', category);
}
const result = await backendApi.get<PipedreamAppResponse>(
`/pipedream/apps/search?${params.toString()}`,
{
errorContext: { operation: 'search apps', resource: 'Pipedream apps' },
}
);
if (!result.success) {
throw new Error(result.error?.message || 'Failed to search apps');
}
// Handle both success response and potential error in the data
const data = result.data!;
if (!data.success && data.error) {
throw new Error(data.error);
}
return data;
return await this.getApps(page, query, category);
},
async getAvailableTools(): Promise<PipedreamToolsResponse> {