Community cards and prebuilt cards (#258)

* Add community sharing feature and merge with pre-built templates

* Add warning before publishing

* [Untested] Add delete flow for community cards

* Fix bug with sorting by likes count and update design of cards

* Fix community assistant parsing errors

* Remove all as a type filter

* Remove default assistant name for publishing to community

* Update DB calls to be standardized paginated
This commit is contained in:
Akhilesh Sudhakar 2025-09-15 19:53:35 +04:00 committed by GitHub
parent 62c1230cff
commit be4e17b5a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 2144 additions and 264 deletions

View file

@ -2,7 +2,8 @@
import { z } from 'zod';
import { container } from "@/di/container";
import { redirect } from "next/navigation";
import { templates } from "../lib/project_templates";
// Fetch library templates from the unified assistant templates repository
import { MongoDBAssistantTemplatesRepository } from "@/src/infrastructure/repositories/mongodb.assistant-templates.repository";
import { authCheck } from "./auth.actions";
import { ApiKey } from "@/src/entities/models/api-key";
import { Project } from "@/src/entities/models/project";
@ -40,14 +41,17 @@ const updateLiveWorkflowController = container.resolve<IUpdateLiveWorkflowContro
const revertToLiveWorkflowController = container.resolve<IRevertToLiveWorkflowController>('revertToLiveWorkflowController');
export async function listTemplates() {
const templatesArray = Object.entries(templates)
.filter(([key]) => key !== 'default') // Exclude the default template
.map(([key, template]) => ({
id: key,
...template
}));
return templatesArray;
const repo = new MongoDBAssistantTemplatesRepository();
const result = await repo.list({ source: 'library', isPublic: true }, undefined, 100);
// Map to the shape expected by callers (tools at top-level)
return result.items.map((item) => ({
id: item.id,
name: item.name,
description: item.description,
category: item.category,
tools: (item as any).workflow?.tools || [],
copilotPrompt: item.copilotPrompt,
}));
}
export async function projectAuthCheck(projectId: string) {