Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar integration #182

Open
jatoko opened this issue Nov 21, 2024 · 4 comments
Open

Calendar integration #182

jatoko opened this issue Nov 21, 2024 · 4 comments
Labels
api_google_gemini Google Gemini API Integration api_ollama Ollama API Integration api_openai_comp Compatible OpenAI API Integration for local LLMs api_openai OpenAI API Integration for Chatgpt new feature Sparks Features to be added to the "ThunderAI Sparks" add-on.
Milestone

Comments

@jatoko
Copy link

jatoko commented Nov 21, 2024

Is your feature request related to a problem? Please describe.
Many emails contain information about to-dos and events. The LLM can easily extract the information to generate events in .ics-format, for example. But let's face it: importing ics files is painful and we can do much better.

Describe the solution you'd like
I would like to link ThunderAI to Thunderbird's Calendar API, e.g. to automatically display the UI for a new calendar event, which is automatically prepopulated with the LLM output. Users would then only need to click save to add the event to a calendar.
I would also love to have an input field in the calendar view to add events to my calendar in a conversational manner.
E.g.: I have a doctor's appointment Wednesday, Nov 27 at 3:15 pm. --> creates calendar event/ Thunderbird calendar dialogue window.

Additional context
General strategic question: Is ThunderAI the right place to integrate this calendar integration? Or is this considered out of scope/ a different domain?

@micz
Copy link
Owner

micz commented Nov 21, 2024

Thank you for your suggestion!
I think this fits well with ThunderAI's scope.

The only issue is that there isn't a Calendar API available at the moment, so implementing this will require extra effort to find a workaround. However, I definitely think it's worth exploring.

I also think that the idea could be to open the "New Event" dialog pre-populated with data from the AI.
In this way, adding a tool to create calendar events in a conversational manner could also become feasible.

It won't be easy, but I'll look into it!

@micz micz added Sparks Features to be added to the "ThunderAI Sparks" add-on. api_openai OpenAI API Integration for Chatgpt api_ollama Ollama API Integration api_openai_comp Compatible OpenAI API Integration for local LLMs labels Nov 24, 2024
@micz
Copy link
Owner

micz commented Nov 24, 2024

A bit of information to start with, thanks to the help of @kewisch.

This it the method to call to open the new event dialog: https://searchfox.org/comm-central/source/calendar/base/content/item-editing/calendar-item-editing.js#261

The parameters structure is defined in those files in https://searchfox.org/comm-central/source/calendar/base/public , and then there is the mega-module https://searchfox.org/comm-central/source/calendar/base/modules/calUtils.sys.mjs which will give us ways to create most of the things we need.

@micz
Copy link
Owner

micz commented Jan 12, 2025

I'm currently testing this prompt with variable results with OpenAI and Google Gemini:

Extract all relevant details required to generate a calendar event from the following text. The extracted information should include:

  • Event Title
  • Start Date and Time (including timezone, if specified)
  • End Date and Time (including timezone, if specified)
  • Full day (if mentioned)
    Ensure the data is formatted clearly and consistently so that it can be directly used for creating a calendar event.
    If there are relative time references, consider that the date and time of the considered email are "{%mail_datetime%}".
    If the duration is not specified, set it to one hour.
    If you're not able to get one or more of the required information, please respond with an empty string.
    Generate a response in JSON format only. Do not include any additional text or explanations; provide only the JSON. Here is the format to be used:
    {
    "startDate": "AAAAMMDDTHHMMSSZ",
    "endDate": "AAAAMMDDTHHMMSSZ",
    "summary": "Calendar event summary here",
    "forceAllDay": false
    }
    Here's the text:"{%selected_text%}"

Consider {%mail_datetime%} will be implemented in #223.

When {%selected_text%} is a specified date and time it works, but if it's something like "Tomorrow at 15:00", it does not work consistently.
Do you have any suggestions?

@micz micz pinned this issue Jan 12, 2025
@micz
Copy link
Owner

micz commented Jan 13, 2025

This prompt is working better.

Extract all relevant details required to generate a calendar event from the following text. The extracted information should include:

  • Event Title
  • Start Date and Time (including timezone, if specified)
  • End Date and Time (including timezone, if specified)
  • Full day (if mentioned)
    Ensure the data is formatted clearly and consistently so that it can be directly used for creating a calendar event.
    If there are relative time references, consider that the date and time of the email are "{%mail_datetime%}". Calculate the start date and time based on this reference. If the calculated start date and time are earlier than "{%current_datetime%}", recalculate the start date and time using "{%current_datetime%}" as the base.
    If the duration is not specified, set it to one hour.
    If you're not able to get one or more of the required information, please respond with an empty string.
    Generate a response in JSON format only. Do not include any additional text or explanations; provide only the JSON. Here is the format to be used:
    {
    "startDate": "YYYYMMDDTHHMMSS",
    "endDate": "YYYYMMDDTHHMMSS",
    "summary": "Calendar event summary here",
    "forceAllDay": false
    }
    Here's the text:"{%selected_text%}"

I implemented also #224 for the current date and time placeholder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api_google_gemini Google Gemini API Integration api_ollama Ollama API Integration api_openai_comp Compatible OpenAI API Integration for local LLMs api_openai OpenAI API Integration for Chatgpt new feature Sparks Features to be added to the "ThunderAI Sparks" add-on.
Projects
None yet
Development

No branches or pull requests

2 participants