Skip to content

Commit 8071aaf

Browse files
authored
add vercel blob (#102)
* vercel blob * fix template vars * fix output fields
1 parent 6ce477b commit 8071aaf

File tree

15 files changed

+876
-68
lines changed

15 files changed

+876
-68
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Visit [http://localhost:3000](http://localhost:3000) to get started.
8080

8181
<!-- PLUGINS:START - Do not remove. Auto-generated by discover-plugins -->
8282
- **AI Gateway**: Generate Text, Generate Image
83+
- **Blob**: Put Blob, List Blobs
8384
- **Firecrawl**: Scrape URL, Search Web
8485
- **Linear**: Create Ticket, Find Issues
8586
- **Resend**: Send Email

components/ui/template-autocomplete.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { useEffect, useRef, useState } from "react";
66
import { createPortal } from "react-dom";
77
import { cn } from "@/lib/utils";
88
import { edgesAtom, nodesAtom, type WorkflowNode } from "@/lib/workflow-store";
9+
import { findActionById } from "@/plugins";
910

1011
type TemplateAutocompleteProps = {
1112
isOpen: boolean;
@@ -32,6 +33,13 @@ const getNodeDisplayName = (node: WorkflowNode): string => {
3233

3334
if (node.data.type === "action") {
3435
const actionType = node.data.config?.actionType as string | undefined;
36+
if (actionType) {
37+
// Look up human-readable label from plugin registry
38+
const action = findActionById(actionType);
39+
if (action?.label) {
40+
return action.label;
41+
}
42+
}
3543
return actionType || "HTTP Request";
3644
}
3745

@@ -103,6 +111,15 @@ const isActionType = (
103111
const getCommonFields = (node: WorkflowNode) => {
104112
const actionType = node.data.config?.actionType as string | undefined;
105113

114+
// First, check if the plugin defines output fields
115+
if (actionType) {
116+
const action = findActionById(actionType);
117+
if (action?.outputFields && action.outputFields.length > 0) {
118+
return action.outputFields;
119+
}
120+
}
121+
122+
// Legacy hardcoded fields for backwards compatibility
106123
if (isActionType(actionType, "Find Issues", "linear/find-issues")) {
107124
return [
108125
{ field: "issues", description: "Array of issues found" },
@@ -153,12 +170,12 @@ const getCommonFields = (node: WorkflowNode) => {
153170
const aiFormat = node.data.config?.aiFormat as string | undefined;
154171
const aiSchema = node.data.config?.aiSchema as string | undefined;
155172

156-
// If format is object and schema is defined, show schema fields
173+
// If format is object and schema is defined, show schema fields under "object" prefix
157174
if (aiFormat === "object" && aiSchema) {
158175
try {
159176
const schema = JSON.parse(aiSchema) as SchemaField[];
160177
if (schema.length > 0) {
161-
return schemaToFields(schema);
178+
return schemaToFields(schema, "object");
162179
}
163180
} catch {
164181
// If schema parsing fails, fall through to default fields

components/ui/template-badge-input.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useAtom } from "jotai";
44
import { useEffect, useRef, useState } from "react";
55
import { cn } from "@/lib/utils";
66
import { nodesAtom, selectedNodeAtom } from "@/lib/workflow-store";
7+
import { findActionById } from "@/plugins";
78
import { TemplateAutocomplete } from "./template-autocomplete";
89

910
export interface TemplateBadgeInputProps {
@@ -40,24 +41,32 @@ function getDisplayTextForTemplate(template: string, nodes: ReturnType<typeof us
4041
return rest;
4142
}
4243

43-
// Replace old label with current label
44-
const currentLabel = node.data.label || "";
44+
// Get display label: custom label > human-readable action label > fallback
45+
let displayLabel: string | undefined = node.data.label;
46+
if (!displayLabel && node.data.type === "action") {
47+
const actionType = node.data.config?.actionType as string | undefined;
48+
if (actionType) {
49+
const action = findActionById(actionType);
50+
displayLabel = action?.label;
51+
}
52+
}
53+
4554
const dotIndex = rest.indexOf(".");
4655

4756
if (dotIndex === -1) {
4857
// No field, just the node: {{@nodeId:Label}}
49-
return currentLabel || rest;
58+
return displayLabel ?? rest;
5059
}
5160

5261
// Has field: {{@nodeId:Label.field}}
5362
const field = rest.substring(dotIndex + 1);
5463

55-
// If currentLabel is empty, fall back to the original label from the template
56-
if (!currentLabel) {
64+
// If no display label, fall back to the original label from the template
65+
if (!displayLabel) {
5766
return rest;
5867
}
5968

60-
return `${currentLabel}.${field}`;
69+
return `${displayLabel}.${field}`;
6170
}
6271

6372
/**

components/ui/template-badge-textarea.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useAtom } from "jotai";
44
import { useEffect, useRef, useState } from "react";
55
import { cn } from "@/lib/utils";
66
import { nodesAtom, selectedNodeAtom } from "@/lib/workflow-store";
7+
import { findActionById } from "@/plugins";
78
import { TemplateAutocomplete } from "./template-autocomplete";
89

910
export interface TemplateBadgeTextareaProps {
@@ -41,24 +42,32 @@ function getDisplayTextForTemplate(template: string, nodes: ReturnType<typeof us
4142
return rest;
4243
}
4344

44-
// Replace old label with current label
45-
const currentLabel = node.data.label || "";
45+
// Get display label: custom label > human-readable action label > fallback
46+
let displayLabel: string | undefined = node.data.label;
47+
if (!displayLabel && node.data.type === "action") {
48+
const actionType = node.data.config?.actionType as string | undefined;
49+
if (actionType) {
50+
const action = findActionById(actionType);
51+
displayLabel = action?.label;
52+
}
53+
}
54+
4655
const dotIndex = rest.indexOf(".");
4756

4857
if (dotIndex === -1) {
4958
// No field, just the node: {{@nodeId:Label}}
50-
return currentLabel || rest;
59+
return displayLabel ?? rest;
5160
}
5261

5362
// Has field: {{@nodeId:Label.field}}
5463
const field = rest.substring(dotIndex + 1);
5564

56-
// If currentLabel is empty, fall back to the original label from the template
57-
if (!currentLabel) {
65+
// If no display label, fall back to the original label from the template
66+
if (!displayLabel) {
5867
return rest;
5968
}
6069

61-
return `${currentLabel}.${field}`;
70+
return `${displayLabel}.${field}`;
6271
}
6372

6473
/**

0 commit comments

Comments
 (0)