copilot prompt for prebuilt cards can be configured per card

This commit is contained in:
arkml 2025-09-13 13:10:01 +05:30
parent eec92bbd39
commit c41e65d7a5
10 changed files with 32 additions and 22 deletions

View file

@ -107,13 +107,14 @@ export function BuildAssistantSection() {
};
// Handle template selection
const handleTemplateSelect = async (templateId: string) => {
const handleTemplateSelect = async (template: any) => {
// Show a small non-blocking spinner on the clicked card
setLoadingTemplateId(templateId);
setLoadingTemplateId(template.id);
try {
await createProjectWithOptions({
template: templateId,
prompt: 'Explain this workflow',
template: template.id,
// Prefer a card-specific copilot prompt if present on the template JSON
prompt: template.copilotPrompt || 'Explain this workflow',
router,
onError: () => {
// Clear loading state if creation fails
@ -499,7 +500,7 @@ export function BuildAssistantSection() {
{items.map((template) => (
<button
key={template.id}
onClick={() => handleTemplateSelect(template.id)}
onClick={() => handleTemplateSelect(template)}
disabled={loadingTemplateId === template.id}
className={clsx(
"relative block p-4 border border-gray-200 dark:border-gray-700 rounded-xl transition-all group text-left",