AI assistant
A plugin that allows you to generate events by interacting with an AI chat assistant.
This is the first in a series of features of Schedule-X Platform. For getting early access, please get in touch via email (find address in imprint (opens in a new tab)) or on Discord.
2. Installation
npm install @schedule-x/platform-ai-assistant
Usage
API
createAIAssistant(config: { onAddEvent: (event: CalendarEvent) => void })
Create the plugin instance.
aiAssistant.render(element: HTMLElement)
Render the plugin to the DOM.
Example
import {
createCalendar,
viewWeek,
viewMonthGrid,
viewDay,
} from '@schedule-x/calendar'
import { createAIAssistant } from "@sx-platform/ai-assistant";
import { createEventRecurrencePlugin, createEventsServicePlugin } from "@schedule-x/event-recurrence";
import '@schedule-x/platform-ai-assistant/index.css'
import '@schedule-x/theme-default/dist/calendar.css'
const recurrencePlugin = createEventRecurrencePlugin();
const eventsServicePlugin = createEventsServicePlugin();
const aiAssistant = createAIAssistant({
bearerToken: 'Bearer {token from Schedule-X Platform, see below}',
eventsService: eventsServicePlugin,
onAddEvent: (event) => {
calendar.addEvent(event)
}
});
const calendar = createCalendar({
views: [viewMonthGrid, viewWeek, viewDay],
plugins: [
aiAssistant,
recurrencePlugin,
eventsServicePlugin
]
})
calendar.render(document.getElementById('calendar'))
aiAssistant.render(document.getElementById('ai-assistant'))
Retrieve a bearer token
Send a request to the Schedule-X Platform API to get a bearer token.
curl -X POST https://platform.schedule-x.com/user/login \
-H 'Content-Type: application/json' \
-d '{
"api_key": "your_key",
"group_id": your_group_number,
"id": "1"
}'
This will return a response with a token that you can use in the createAIAssistant
config.
Examples, including server side authentication
Last updated on