Create Cal Event From Screenshot with ChatGPT 🔧

Allow ChatGPT to create a calendar Event for you via AppleScript

// Name: Create Cal Event From Screenshot with ChatGPT
// Description: Allow ChatGPT to create a calendar Event for you via AppleScript
// Author: Eduard Uffelmann
// Linkedin: https://www.linkedin.com/in/euffelmann/
// Twitter: @schmedu_
// Website: https://schmedu.com

import "@johnlindquist/kit";
import { startChat } from "../lib/common";
import {
  getCalendars,
  getCurrentDayOfWeek,
} from "../lib/functions/implementations/calendar";
import { Functions } from "../lib/functions";
import { getSetting } from "../lib/settings";
import { createFullScreenScreenshotMessage, userMessage } from "../lib/helper";

let calendars = await getCalendars();

const defaultCalendar = await getSetting("defaultCalendar");
const CALENDAR_STRING = calendars.map((cal) => `- ${cal}`).join("\n");
let prompt = undefined;

const screenshotMessage = await createFullScreenScreenshotMessage();

await startChat({
  prompt,
  model: "gpt-4o-mini", // gpt-3.5 is not reliable with times and calculation
  temperature: 1,
  systemMessage: `You will now receive a screenshot where you will find the event details and then call the 'createEvent' function with the event details. Make a smart guess about the event duration.`,
  functions: [Functions.createEventFunction],
  messages: [screenshotMessage],
});