-
Notifications
You must be signed in to change notification settings - Fork 46.2k
Open
Description
Summary
Create a reusable text input component/element that accepts context and generates intelligent default values using a cheap AI model.
Concept
A generic component that can be attached to any text input field. You pass it context, and it generates a sensible default value.
Use Cases
| Use Case | Context Passed | Generated Default |
|---|---|---|
| Output names | Connected blocks/inputs in graph | Descriptive output name |
| Schedule names | Schedule time/frequency | "Daily morning run", "Weekly Monday sync" |
| Block names | Graph context, block type | Descriptive block label |
| Agent names | Agent description/blocks | Descriptive agent name |
Behavior
- Component receives context (structured data relevant to the field)
- Calls cheap LLM (GPT-4o-mini) to generate appropriate text
- Shows as preview/default in the input field
- Auto-saves when parent form is submitted (e.g., graph run, schedule save)
Technical Approach
Backend
- Generic endpoint:
POST /api/generate-default-text - Request:
{ context_type: string, context: object } - Response:
{ generated_text: string } - Different prompt templates per context_type
Frontend Component
<AITextInput
contextType="output_name"
context={{ connectedBlocks: [...], inputSources: [...] }}
value={name}
onChange={setName}
placeholder="Enter name or let AI suggest..."
/>Implementation Notes
- Debounce generation (dont call on every keystroke)
- Cache results for same context
- Show loading state while generating
- Fallback gracefully if generation fails
- Cost: ~$0.0001/generation (GPT-4o-mini)
Open Questions
- How to integrate with existing input components? (wrapper vs new component)
- Should it show "AI suggested" indicator?
- Regenerate button, or one-shot?
Requested by
Nick Tindle
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels