Prompt Accept File Upload Option
# Prompt Accept File Upload Option Implementation
**Date:** 2025-07-28 12:55
**Feature:** Accept File Upload Option for Prompts
## Overview
Implemented a new option setting for prompts that allows enabling/disabling file upload support. This feature adds a toggle switch in the prompt creation/editing dialog to control whether a prompt accepts file uploads as part of user input.
## Technical Implementation
### Frontend Changes
#### PromptsTable.vue Updates
- **Switch Component Integration**: Added a Switch component to the prompt dialog for toggling file upload acceptance
- **Form Data Enhancement**: Extended `formData` reactive object to include `options` property with `acceptFileUpload` boolean
- **Dialog Management**: Updated all dialog management functions (`openCreateDialog`, `editPrompt`, `clonePrompt`) to properly handle the options property
- **API Integration**: Modified `savePrompt` function to include options in API requests for both create and update operations
#### ViewPromptDialog.vue Updates
- **Options Display Section**: Added a new collapsible "Options" section to display prompt configuration settings
- **Visual Status Indicators**: Implemented status indicators with colored dots (green for enabled, gray for disabled)
- **Toggle Visibility**: Added switch control to show/hide the options section, similar to JSON schema sections
- **Consistent Styling**: Maintained design consistency with existing dialog sections
#### UI/UX Features
- **Toggle Switch**: Clean switch component positioned next to the "Accept file upload" label
- **Descriptive Text**: Added helpful description explaining the feature's purpose
- **State Persistence**: Options are properly loaded when editing or cloning existing prompts
- **Default Values**: New prompts default to `acceptFileUpload: false`
### API Integration
#### Type Safety
- Leverages existing `PromptOptionsSchema` from API definitions
- Uses typed `CreatePromptRequest` interface ensuring type safety
- Proper handling of optional options property with fallback defaults
#### Data Flow
1. **Create Flow**: New prompts include options in the creation request
2. **Edit Flow**: Existing prompt options are loaded and can be modified
3. **Clone Flow**: Options are copied from the source prompt
4. **Persistence**: Options are saved to the backend via the existing API endpoints
## User Experience
### Interface Design
- **Intuitive Toggle**: Switch component provides clear on/off state indication
- **Contextual Placement**: Located in the right column of the dialog alongside other prompt configuration options
- **Helpful Description**: Clear explanation of what enabling the option does
- **Consistent Styling**: Follows existing design patterns from the PromptsTable component
### Workflow Integration
- **Seamless Integration**: Works with existing create, edit, and clone workflows
- **State Management**: Proper state handling ensures no data loss during dialog operations
- **Error Handling**: Integrated with existing error handling and toast notification system
## Technical Architecture
### Component Structurewhen to use it
Community prompt sourced from the open-source GitHub repo hypersigilhq/hypersigil (NOASSERTION). A "Prompt Accept File Upload Option" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
roleplaycommunitygeneral
source
hypersigilhq/hypersigil · NOASSERTION