From 553612b2fd47da3940ef3cf08fd79e12d8d3e88e Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 25 Dec 2024 07:25:38 +0000 Subject: [PATCH 1/2] docs: Add comprehensive handler documentation Added documentation for: - ScreenpipeHandler - LastModifiedHandler - ExecuteActionsHandler - Common workflows and combinations Includes examples of chat prompts and detailed explanations of how each handler works. Co-Authored-By: ben --- tutorials/CommonWorkflows.md | 72 ++++++++++++++++++++++++++++++ tutorials/ExecuteActionsHandler.md | 44 ++++++++++++++++++ tutorials/LastModifiedHandler.md | 41 +++++++++++++++++ tutorials/ScreenpipeHandler.md | 37 +++++++++++++++ 4 files changed, 194 insertions(+) create mode 100644 tutorials/CommonWorkflows.md create mode 100644 tutorials/ExecuteActionsHandler.md create mode 100644 tutorials/LastModifiedHandler.md create mode 100644 tutorials/ScreenpipeHandler.md diff --git a/tutorials/CommonWorkflows.md b/tutorials/CommonWorkflows.md new file mode 100644 index 00000000..a1a5fb5c --- /dev/null +++ b/tutorials/CommonWorkflows.md @@ -0,0 +1,72 @@ +# Common Workflows + +This document describes common combinations of tools and how they work together to accomplish complex tasks. + +## Renaming Untitled Files + +### Step 1: Retrieve Untitled Files +``` +Could you retrieve all my untitled files? +``` +This triggers the search tool to find files matching the "untitled" pattern. + +### Step 2: Rename Files +``` +rename files with something meaningful +``` +This triggers the ExecuteActionsHandler to: +1. Analyze the content of each file +2. Generate meaningful names +3. Show a confirmation button +4. Execute the renaming when confirmed + +### What Happens Behind the Scenes +1. The first prompt triggers `searchByName` with pattern "Untitled*" +2. Files are added to context +3. The second prompt triggers `executeActionsOnFileBasedOnPrompt` +4. The ExecuteActionsHandler processes each file + +## Using Screenpipe Data for Organization + +### Step 1: Get Activity Data +``` +based on my screenpipe activity +``` +This retrieves your recent activity data. + +### Step 2: Organize Related Files +``` +organize files based on my recent activity +``` +This uses the Screenpipe context to suggest appropriate organization. + +### What Happens Behind the Scenes +1. First prompt triggers `getScreenpipeDailySummary` +2. Data is added to context +3. Second prompt can use this context for better organization decisions + +## Finding and Tagging Recent Files + +### Step 1: Get Recent Files +``` +get my last 7 files +``` +This retrieves your most recently modified files. + +### Step 2: Add Tags +``` +tag these files based on their content +``` +This analyzes and tags the files appropriately. + +### What Happens Behind the Scenes +1. First prompt triggers `getLastModifiedFiles` +2. Files are added to context +3. Second prompt triggers `executeActionsOnFileBasedOnPrompt` with tag action +4. Tags are suggested and applied with confirmation + +## Tips for Effective Workflows +1. Always check the confirmation messages +2. Review suggested changes before confirming +3. Use specific language to trigger desired actions +4. Combine tools in sequence for complex operations diff --git a/tutorials/ExecuteActionsHandler.md b/tutorials/ExecuteActionsHandler.md new file mode 100644 index 00000000..628aab0a --- /dev/null +++ b/tutorials/ExecuteActionsHandler.md @@ -0,0 +1,44 @@ +# ExecuteActionsHandler + +## Overview +The ExecuteActionsHandler is a powerful tool that can analyze file content and perform various actions like tagging, moving to folders, or renaming files based on their content. + +## Usage + +### Basic Command +The handler is typically triggered after selecting files to process, using a natural language prompt like: +``` +rename files with something meaningful +``` + +This will trigger the `executeActionsOnFileBasedOnPrompt` tool in the chat interface. + +### Parameters +The handler accepts: +- `filePaths`: Array of file paths to analyze +- `userPrompt`: Instructions for how to rename/re-tag/re-folder the files + +### Actions Available +The handler can perform three types of actions based on the user prompt: +1. **Tags** (triggered by words like "tag" or "label") + - Recommends and adds tags based on content +2. **Folders** (triggered by words like "folder", "move", or "organize") + - Suggests and moves files to appropriate folders +3. **Names** (default action) + - Recommends and applies meaningful names based on content + +### How It Works +1. The handler: + - Analyzes the user prompt to determine the action type + - Processes each file individually + - Shows a confirmation button before executing actions + - Provides visual feedback for each operation + +### Example Response +The handler shows: +- Success: "✅ Added tag [tag] to [filename]" +- Info: "ℹī¸ No suggestions for [filename]" +- Error: "❌ Error processing [filename]" + +### Code Reference +The handler is implemented in `packages/plugin/views/ai-chat/tool-handlers/execute-actions-handler.tsx` and is triggered through the chat interface defined in `packages/web/app/api/(newai)/chat/route.ts`. diff --git a/tutorials/LastModifiedHandler.md b/tutorials/LastModifiedHandler.md new file mode 100644 index 00000000..fc4e4314 --- /dev/null +++ b/tutorials/LastModifiedHandler.md @@ -0,0 +1,41 @@ +# LastModifiedHandler + +## Overview +The LastModifiedHandler allows you to retrieve recently modified files from your vault. It's particularly useful for finding files you've recently worked on. + +## Usage + +### Basic Command +To get your recently modified files, use a natural language prompt like: +``` +get my last 7 files +``` + +This will trigger the `getLastModifiedFiles` tool in the chat interface. + +### Parameters +The handler accepts one parameter: +- `count`: The number of last modified files to retrieve + +### How It Works +1. When triggered, the handler: + - Gets all markdown files from the vault + - Sorts them by modification time + - Retrieves the specified number of most recent files + - Adds the files to the context for further operations + +### Example Response +The handler will show: +- Loading state: "Fetching last modified files..." +- Success state: "Found X recently modified files" +- Error state: "No recently modified files found" + +### File Information Retrieved +For each file, the handler returns: +- Title (basename) +- Content +- Path +- Last modified timestamp + +### Code Reference +The handler is implemented in `packages/plugin/views/ai-chat/tool-handlers/last-modified-handler.tsx` and is triggered through the chat interface defined in `packages/web/app/api/(newai)/chat/route.ts`. diff --git a/tutorials/ScreenpipeHandler.md b/tutorials/ScreenpipeHandler.md new file mode 100644 index 00000000..63233c10 --- /dev/null +++ b/tutorials/ScreenpipeHandler.md @@ -0,0 +1,37 @@ +# ScreenpipeHandler + +## Overview +The ScreenpipeHandler is a tool that allows you to retrieve and analyze your Screenpipe activity data. It processes screen recording data and provides insights about your daily activities. + +## Usage + +### Basic Command +To retrieve your Screenpipe activity, you can use a natural language prompt like: +``` +based on my screenpipe activity +``` + +This will trigger the `getScreenpipeDailySummary` tool in the chat interface. + +### Parameters +The handler accepts the following parameters: +- `startTime` (optional): Start time in ISO format +- `endTime` (optional): End time in ISO format + +If no times are specified, it will use default time ranges. + +### How It Works +1. When triggered, the handler: + - Fetches daily information using the `getDailyInformation` function + - Clears existing context + - Adds new Screenpipe data to the context + - Returns the results with success/failure status + +### Example Response +The handler will show: +- A loading state: "Fetching Screenpipe data..." +- Success state: "Screenpipe data successfully retrieved" +- Error state: "Failed to fetch Screenpipe data" + +### Code Reference +The handler is implemented in `packages/plugin/views/ai-chat/tool-handlers/screenpipe-handler.tsx` and is triggered through the chat interface defined in `packages/web/app/api/(newai)/chat/route.ts`. From 5ea4d5d2a5a6dd837ce6bbcda626fccef45d13c9 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 25 Dec 2024 08:28:15 +0100 Subject: [PATCH 2/2] Update CommonWorkflows.md --- tutorials/CommonWorkflows.md | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/tutorials/CommonWorkflows.md b/tutorials/CommonWorkflows.md index a1a5fb5c..65fda809 100644 --- a/tutorials/CommonWorkflows.md +++ b/tutorials/CommonWorkflows.md @@ -30,20 +30,12 @@ This triggers the ExecuteActionsHandler to: ### Step 1: Get Activity Data ``` -based on my screenpipe activity +based on my screenpipe activity give me a small summary of my day ``` -This retrieves your recent activity data. -### Step 2: Organize Related Files -``` -organize files based on my recent activity -``` -This uses the Screenpipe context to suggest appropriate organization. +This uses the Screenpipe context so you can create daily logs of based on your activity right in Obidian. + -### What Happens Behind the Scenes -1. First prompt triggers `getScreenpipeDailySummary` -2. Data is added to context -3. Second prompt can use this context for better organization decisions ## Finding and Tagging Recent Files