Action

Genda

Posted by 0xnuminous, Last update 19 days ago

UPDATES

19 days ago

Fixed Description

show all updates...

19 days ago

Fixed Description

19 days ago

Now creates new draft instead of replacing orignal.

20 days ago

Updated info about natural language

Genda Action Description

Genda is a Drafts action designed to create a captivating and organized agenda for your day. Using Gemini AI, it generates a unique title for your tasks and formats them into a markdown checklist, making your daily quests more engaging and easy to track.

Instructions for Use:

  1. Highlight Tasks (Optional): If you have specific tasks highlighted in your draft, Genda will use them directly to generate the agenda. If no text is highlighted, the entire content of the current draft will be used.

  2. Run the Action: Execute the Genda action. The AI will generate a new agenda title and format the tasks as a checklist.

  3. Output Format:

    • The title will be formatted as: ## Captivating Name for Sep 27 2024 | Quests: 5
    • Each task will be formatted as a checklist item: [ ] Task
  4. Tags Automatically Applied:

    • The new draft will be tagged with:
      • “Agenda”
      • “AI Generated”
      • The current date in the format “Sep 27 2024”

Warning:

  • Replaces Current Draft: This action will replace the content of the current draft with the AI-generated output. Make sure to save any important information before running the action.

Key Features:

  • Automatic Tagging: Genda automatically applies relevant tags, making it easy to organize and retrieve your agendas.
  • No Additional Formatting Required: The AI handles all formatting, ensuring a consistent and polished appearance every time.
  • Captivating Titles: Each agenda is given a unique and engaging title, making task management more enjoyable.

Steps

  • script

    //BUG: Delete original doesnt work. Archive original probably not either
    // Function to get today's date formatted as "Day, Month DD, YYYY (mm-dd-yy)"
    function getFormattedDate(date = new Date()) {
        let options = { weekday: 'short', month: 'long', day: 'numeric', year: 'numeric' };
        let formatted = date.toLocaleDateString('en-US', options);
        let shortDate = `(${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}-${String(date.getFullYear()).slice(-2)})`;
        return `${formatted} ${shortDate}`;
    }
    
    // Function to get a future date
    function getFutureDate(days) {
        let date = new Date();
        date.setDate(date.getDate() + days);
        return date;
    }
    
    // Function to process draft with Gemini AI
    function processWithGeminiAI(content) {
        let ai = new GoogleAI();
        let formattedDate = getFormattedDate();
        
        let chatPrompt = `Analyze the following content and create an agenda based on these rules:
    
    1. Create a short, inspirational blurb (1-2 sentences) to be displayed at the top. Be unique or find quotes from famous people. 
    2. Determine if it's a plan for today only or includes future tasks.
    3. For today's plan:
       - Format as: 
         "[Inspirational Blurb]
          # Today, ${formattedDate} | Quests: [Number of Tasks]"
       - Create a markdown checklist of tasks using "[ ]" format.
       - If times are mentioned, include them at the start of the task and make only the task text (not the checkbox) bold.
       - Sort the list chronologically for tasks with times, followed by tasks without times.
       - For tasks without specific times, estimate their priority and assign a general time (Morning, Afternoon, Evening).
    4. For tasks mentioned as "later" or without a specific day:
       - Estimate their importance and assign them to a future day (tomorrow for important tasks, 2-3 days later for less urgent ones).
       - Create a separate section for future tasks, formatted similarly to today's tasks.
       - Use the heading "# Future Quests" for this section.
       - Include the estimated date for each future task.
    5. Do not include days with no tasks.
    6. Remove any duplicate tasks.
    7. Reword or rewrite each task for improved readability and clarity, while maintaining the original intent. Make sure the reworded tasks are concise and action-oriented.
    8. Use markdown formatting for all outputs.
    
    Here's the content to analyze:
    
    ${content}
    
    Respond only with the formatted agenda, no additional text.`;
    
        return ai.quickPrompt(chatPrompt, "models/gemini-1.5-flash");
    }
    
    // Main function to create the Genda agenda
    function createGendaAgenda() {
        let currentDraft = draft;
        let originalContent = currentDraft.content;
        
        if (originalContent.trim() === "") {
            alert("The current draft is empty. Please add some content before running Genda.");
            return;
        }
    
        let agendaContent = processWithGeminiAI(originalContent);
        
        if (agendaContent) {
            // Create a new draft with the AI-generated agenda
            let newDraft = Draft.create();
            newDraft.content = agendaContent;
    
            // Add tags to the new draft
            newDraft.addTag("Agenda");
            newDraft.addTag("AI Generated");
            newDraft.addTag(getFormattedDate().split(' ')[0]); // Day of week
            newDraft.addTag(getFormattedDate().split(' ').pop().replace(/[()]/g, '')); // Short date
    
            newDraft.update();
            
            // Prompt the user to archive or delete the original draft
        let p = new Prompt();
        p.title = "Archive or Delete Original Draft?";
        p.message = "Would you like to archive or delete the original draft?";
        p.addButton("Archive");
        p.addButton("Delete");
        p.addButton("Cancel");
    
        let result = p.show();
    
        if (result) {
            if (p.buttonPressed === "Archive") {
                draft.isArchived = true;
                draft.update();
            } else if (p.buttonPressed === "Delete") {
                draft.isTrashed = true;
                draft.update();
            }
        }
            
            // Display the new draft
            editor.activate();
        } else {
            alert("Failed to generate the agenda from Gemini AI.");
        }
    }
    
    // Run the main function
    createGendaAgenda();

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.