Skip to content

Commit 4113b22

Browse files
committed
feat(actions): introduce templated actions and generation mode
This commit introduces a major evolution of Actions, enabling dynamic, multi-step workflows and content generation from scratch. The Actions UI is overhauled with bulk-management capabilities, and the application's startup logic is refactored for improved robustness and maintainability. ### Templated Actions with Placeholders Actions can now include placeholders (e.g., `[language]`) in their instructions, which are filled out via a new step-by-step UI in the floating menu at runtime. This transforms simple prompts into powerful, reusable tools. - Multiple Input Types: Supports Text, Multiline Text, Choice, Boolean, Number, Date, and File Picker. - Validation Rules: Enforce requirements like required fields, character limits, or numeric ranges. - Conditional Logic: Show or hide subsequent steps based on user input in previous steps. - Smart Defaults: Pre-fill values using dynamic tokens like `{clipboard}`, `{date:yyyy-MM-dd}`, and `{appContext}`. - New Presets: Adds several new templated actions, including Summarize, Translate, Rephrase, Write an Email, and Create Social Media Post. - Redesigned Action Editor: The Action Editor UI has been completely redesigned with an intuitive interface for creating and managing placeholders and their advanced properties. ### Generation Mode & Custom Instructions Actions can now be designated as not requiring selected text (`requiresSelection: false`). This enables a new "Generation Mode" for creating content from scratch. - When no text is selected, the floating menu filters for generation-capable actions, and the search bar becomes a prompt input field. - The "Custom Instruction" feature now logs the full instruction to the history and allows these ad-hoc prompts to be saved as new, reusable actions directly from the history view. ### UI and UX Enhancements - Bulk Action Management: The Actions screen now supports multi-selection with checkboxes. A contextual toolbar appears for bulk operations like Delete, Move to Group, and Export. - Action Management: Actions can now be easily duplicated or moved up/down within their group from a new context menu. - Onboarding: A new tutorial step introduces users to the power of templated actions, and the hotkey tutorial is updated to better reflect the Diff View output mode. ### Core Refinements - Startup Refactoring: The application's main startup logic in `App.axaml.cs` has been decomposed into modular, single-responsibility services (`DatabaseInitializer`, `BackgroundServiceInitializer`, `UiInitializer`, `DependencyInjectionSetup`, etc.) for improved maintainability and more resilient handling of database corruption. - Document Reader Service: A new `IDocumentReaderService` is introduced that can extract text from various file types (.pdf, .docx, .epub, .xlsx, etc.), enabling the new "File Picker" placeholder type.
1 parent 37e8fd2 commit 4113b22

78 files changed

Lines changed: 6183 additions & 1458 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Changelogs/v0.3.0.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# 🎉 ProseFlow v0.3.0 – Release Notes
2+
3+
We are excited to launch **ProseFlow v0.3.0**, a landmark release that transforms how you create and use AI-powered actions. This update introduces **Templated Actions with Placeholders**, a powerful new **Generation Mode** for creating content from scratch, and a completely overhauled **Actions UI** with bulk-management capabilities.
4+
5+
These features turn simple prompts into dynamic, reusable, and shareable tools, elevating ProseFlow from a text processor to a comprehensive AI workflow engine.
6+
7+
---
8+
9+
## 🌟 Highlights
10+
11+
### 1. **Templated Actions with Placeholders**
12+
Actions are no longer static prompts! You can now create dynamic, multi-step workflows by embedding placeholders (e.g., `[language]`) in your instructions. When you run a templated action, the floating menu guides you through a step-by-step form to fill in the details.
13+
14+
- **Multiple Input Types:** Choose from Text, Multiline Text, Choice (dropdown), Boolean (Yes/No), Number, Date, and even a **File Picker**.
15+
- **Validation Rules:** Enforce required fields, set character limits, or define numeric ranges to ensure valid input.
16+
- **Conditional Logic:** Create intelligent workflows by showing or hiding subsequent steps based on user input.
17+
- **Smart Defaults:** Pre-fill values with dynamic tokens like `{clipboard}`, `{date:yyyy-MM-dd}`, and `{appContext}` to accelerate common tasks.
18+
- **New Presets:** Get started with powerful new templated actions, including **Summarize**, **Translate**, **Rephrase**, **Write an Email**, and **Create Social Media Post**.
19+
20+
> 💡 This feature transforms simple actions into sophisticated, reusable applications for complex tasks.
21+
22+
<table>
23+
<tr>
24+
<td align="center"><strong>Advanced Action Editor</strong></td>
25+
<td align="center"><strong>Templated Action Menu</strong></td>
26+
</tr>
27+
<tr>
28+
<td><img src="https://raw.githubusercontent.com/LSXPrime/_resources/refs/heads/main/ProseFlow/screenshot-action-editor.gif" alt="Advanced Action Editor"></td>
29+
<td><img src="https://raw.githubusercontent.com/LSXPrime/_resources/refs/heads/main/ProseFlow/screenshot-template-menu.gif" alt="Templated Action Menu"></td>
30+
</tr>
31+
</table>
32+
33+
---
34+
35+
### 2. **Generation Mode & Enhanced Custom Instructions**
36+
ProseFlow now excels at creating content from scratch. Actions can be designated as not requiring selected text (`requiresSelection: false`), enabling a new **Generation Mode**.
37+
38+
- **Generate from Scratch:** When no text is selected, the floating menu filters for generation-capable actions. The search bar becomes a prompt input field, allowing you to describe what you want to create.
39+
- **Save Custom Instructions:** The "Custom Instruction" feature now logs the full instruction to your history. You can save these ad-hoc prompts as new, reusable actions directly from the history view with a single click.
40+
41+
---
42+
43+
### 3. **Overhauled Actions UI with Bulk Management**
44+
The Actions screen has been completely redesigned for power users and teams managing large sets of actions.
45+
46+
- **Multi-Selection:** Use checkboxes to select multiple actions at once.
47+
- **Contextual Toolbar:** A new toolbar appears when items are selected, enabling bulk operations:
48+
- **Bulk Delete:** Permanently remove multiple actions.
49+
- **Bulk Move:** Move selected actions to another group in one step.
50+
- **Bulk Export:** Export only the selected actions to a JSON file.
51+
- **Action Management:** Actions can now be easily **duplicated** or **moved up/down** within their group from a new context menu.
52+
53+
---
54+
55+
## 🛠️ Core & Infrastructure Improvements
56+
57+
### 📄 **New Document Reader Service**
58+
A powerful new `IDocumentReaderService` can now extract plain text from various file types, enabling the new "File Picker" placeholder. Supported formats include:
59+
- `.pdf`
60+
- `.docx`
61+
- `.xlsx`, `.xls`
62+
- `.epub`
63+
- `.txt`, `.md`, and many other plain-text-like formats.
64+
65+
### 🚀 **Refactored Startup Logic**
66+
The application's startup process has been decomposed into modular, single-responsibility services (`DatabaseInitializer`, `BackgroundServiceInitializer`, `UiInitializer`, `DependencyInjectionSetup`, etc.).
67+
68+
- **Improved Maintainability:** Cleaner, more organized code makes future development easier.
69+
- **Resilient Database Handling:** A new recovery flow gracefully handles database corruption by prompting the user to back up the corrupt file and reset the application data, preventing startup failures.
70+
71+
---
72+
73+
## 🎨 UI & UX Refinements
74+
75+
### ✍️ **Redesigned Action Editor**
76+
The Action Editor has been rebuilt from the ground up to support templated actions:
77+
- An intuitive interface for adding, configuring, and removing placeholders.
78+
- Dedicated sections for setting up validation rules and conditional display logic.
79+
- A smart token inserter for easily adding dynamic default values.
80+
81+
### 🎓 **Enhanced Onboarding**
82+
- A new tutorial step introduces users to the power of templated actions with an interactive simulation.
83+
- A visual progress indicator now tracks your journey through the setup process.
84+
- The hotkey tutorial has been updated to better reflect the Diff View output mode.
85+
86+
---
87+
88+
## ❤️ Thank You
89+
90+
This release is a huge step forward for ProseFlow, making it a more versatile and powerful tool for everyone.
91+
92+
If you encounter any issues or have suggestions, please [open an issue on GitHub](https://github.com/LSXPrime/ProseFlow/issues).
93+
94+
— LSXPrime

ProseFlow.Application/DTOs/ActionDto.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ public record ActionDto
2424
[JsonPropertyName("explain_changes")]
2525
public bool ExplainChanges { get; init; }
2626

27+
[JsonPropertyName("requires_selection")]
28+
public bool RequiresSelection { get; init; } = true;
29+
2730
[JsonPropertyName("application_context")]
2831
public IEnumerable<string> ApplicationContext { get; init; } = [];
32+
33+
[JsonPropertyName("placeholders")]
34+
public IEnumerable<ActionPlaceholderDto> Placeholders { get; init; } = [];
2935
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System.Text.Json.Serialization;
2+
using ProseFlow.Core.Enums;
3+
4+
namespace ProseFlow.Application.DTOs;
5+
6+
/// <summary>
7+
/// Data Transfer Object for an ActionPlaceholder, used in import/export.
8+
/// </summary>
9+
public record ActionPlaceholderDto
10+
{
11+
[JsonPropertyName("name")]
12+
public string Name { get; init; } = string.Empty;
13+
14+
[JsonPropertyName("label")]
15+
public string Label { get; init; } = string.Empty;
16+
17+
[JsonPropertyName("type")]
18+
public PlaceholderInputType InputType { get; init; }
19+
20+
[JsonPropertyName("options")]
21+
public IEnumerable<string> Options { get; init; } = [];
22+
23+
[JsonPropertyName("default")]
24+
public string? DefaultValue { get; init; }
25+
26+
[JsonPropertyName("validation_json")]
27+
public string? ValidationJson { get; init; }
28+
29+
[JsonPropertyName("display_condition_json")]
30+
public string? DisplayConditionJson { get; init; }
31+
}

ProseFlow.Application/Events/AppEvents.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,23 @@ public static class AppEvents
6363
/// The UI layer subscribes to this, shows the menu, and returns the user's selection.
6464
/// The Func returns a task that resolves to the user's choice, or null if cancelled.
6565
/// </summary>
66-
public static event Func<IEnumerable<Action>, string, Task<ActionExecutionRequest?>>? ShowFloatingMenuRequested;
66+
public static event Func<IEnumerable<Action>, string, bool, Task<ActionExecutionRequest?>>? ShowFloatingMenuRequested;
6767

6868
/// <summary>
6969
/// Invokes the ShowFloatingMenuRequested event.
7070
/// </summary>
71-
public static async Task<ActionExecutionRequest?> RequestFloatingMenuAsync(IEnumerable<Action> availableActions, string activeAppContext)
71+
/// <param name="availableActions">The list of actions to display.</param>
72+
/// <param name="activeAppContext">The context of the active application.</param>
73+
/// <param name="isGenerationMode">True if the menu should be in 'generate from scratch' mode.</param>
74+
public static async Task<ActionExecutionRequest?> RequestFloatingMenuAsync(IEnumerable<Action> availableActions, string activeAppContext, bool isGenerationMode)
7275
{
7376
if (!IsShowFloatingMenuEnabled) return null;
7477

7578
return ShowFloatingMenuRequested is not null
76-
? await ShowFloatingMenuRequested.Invoke(availableActions, activeAppContext)
79+
? await ShowFloatingMenuRequested.Invoke(availableActions, activeAppContext, isGenerationMode)
7780
: await Task.FromResult<ActionExecutionRequest?>(null);
7881
}
79-
82+
8083
/// <summary>
8184
/// Raised when a result needs to be displayed in a window.
8285
/// The UI subscribes and is responsible for showing the window and then returning a Task
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace ProseFlow.Application.Interfaces;
2+
3+
/// <summary>
4+
/// Defines a contract for a service that can extract text content from various document types.
5+
/// </summary>
6+
public interface IDocumentReaderService
7+
{
8+
/// <summary>
9+
/// Asynchronously reads the text content from a file at the specified path.
10+
/// </summary>
11+
/// <param name="filePath">The absolute path to the file.</param>
12+
/// <returns>A string containing the extracted text content of the file.</returns>
13+
/// <exception cref="System.IO.FileNotFoundException">Thrown if the file does not exist.</exception>
14+
/// <exception cref="System.NotSupportedException">Thrown if the file type is not supported.</exception>
15+
Task<string> ReadTextAsync(string filePath);
16+
}

0 commit comments

Comments
 (0)