mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-31 14:47:13 +00:00
feat: add filter
This commit is contained in:
@@ -40,6 +40,47 @@ export class CloudServiceClient extends BaseHttpClient {
|
|||||||
tags_filter?: string[],
|
tags_filter?: string[],
|
||||||
type_filter?: string,
|
type_filter?: string,
|
||||||
): Promise<ApiRespMarketplacePlugins> {
|
): Promise<ApiRespMarketplacePlugins> {
|
||||||
|
// Use different endpoints based on type_filter
|
||||||
|
if (type_filter === 'mcp') {
|
||||||
|
return this.post<{ mcps: PluginV4[]; total: number }>(
|
||||||
|
'/api/v1/marketplace/mcps/search',
|
||||||
|
{
|
||||||
|
query,
|
||||||
|
page,
|
||||||
|
page_size,
|
||||||
|
sort_by,
|
||||||
|
sort_order,
|
||||||
|
tags_filter,
|
||||||
|
},
|
||||||
|
).then((resp) => ({
|
||||||
|
plugins: (resp.mcps || []).map((mcp) => ({
|
||||||
|
...mcp,
|
||||||
|
plugin_id: mcp.mcp_id || mcp.plugin_id,
|
||||||
|
type: 'mcp' as const,
|
||||||
|
})),
|
||||||
|
total: resp.total || 0,
|
||||||
|
}));
|
||||||
|
} else if (type_filter === 'skill') {
|
||||||
|
return this.post<{ skills: PluginV4[]; total: number }>(
|
||||||
|
'/api/v1/marketplace/skills/search',
|
||||||
|
{
|
||||||
|
query,
|
||||||
|
page,
|
||||||
|
page_size,
|
||||||
|
sort_by,
|
||||||
|
sort_order,
|
||||||
|
tags_filter,
|
||||||
|
},
|
||||||
|
).then((resp) => ({
|
||||||
|
plugins: (resp.skills || []).map((skill) => ({
|
||||||
|
...skill,
|
||||||
|
plugin_id: skill.skill_id || skill.plugin_id,
|
||||||
|
type: 'skill' as const,
|
||||||
|
})),
|
||||||
|
total: resp.total || 0,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
return this.post<ApiRespMarketplacePlugins>(
|
return this.post<ApiRespMarketplacePlugins>(
|
||||||
'/api/v1/marketplace/plugins/search',
|
'/api/v1/marketplace/plugins/search',
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user