@ckeditor/ckeditor5-ai 48.8.1-alpha.4 → 49.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/dist/aiactions/aiactions.d.ts +109 -73
- package/dist/aiactions/model/aiactionsinteraction.d.ts +58 -50
- package/dist/aiactions/model/aiactionsreply.d.ts +18 -11
- package/dist/aiassistant/adapters/aiadapter.d.ts +48 -48
- package/dist/aiassistant/adapters/aitextadapter.d.ts +133 -133
- package/dist/aiassistant/adapters/awstextadapter.d.ts +42 -42
- package/dist/aiassistant/adapters/openaitextadapter.d.ts +184 -184
- package/dist/aiassistant/aiassistant.d.ts +425 -436
- package/dist/aiassistant/aiassistantediting.d.ts +51 -51
- package/dist/aiassistant/aiassistantui.d.ts +50 -53
- package/dist/aiassistant/legacyerrors.d.ts +0 -4
- package/dist/aiassistant/ui/aiassistantcontroller.d.ts +106 -105
- package/dist/aiassistant/ui/form/aiformcontentarea.d.ts +43 -43
- package/dist/aiassistant/ui/form/aiformerrorview.d.ts +19 -19
- package/dist/aiassistant/ui/form/aiformpromptview.d.ts +38 -38
- package/dist/aiassistant/ui/form/aiformtoolbarview.d.ts +50 -50
- package/dist/aiassistant/ui/form/aiformview.d.ts +121 -121
- package/dist/aiassistant/ui/form/aihistorylistitemview.d.ts +13 -13
- package/dist/aiassistant/ui/form/aihistorylistview.d.ts +27 -27
- package/dist/aiassistant/ui/form/prompthistory.d.ts +15 -15
- package/dist/aiassistant/ui/showaiassistantcommand.d.ts +35 -35
- package/dist/aiassistant/utils/common-translations.d.ts +6 -6
- package/dist/aiassistant/utils/normalizecommandsconfig.d.ts +9 -9
- package/dist/aiballoon/aiballoon.d.ts +85 -89
- package/dist/aiballoon/ui/aiballoondisclaimerview.d.ts +17 -0
- package/dist/aiballoon/ui/aiballoontoolbarview.d.ts +56 -0
- package/dist/aiballoon/ui/aiballoonview.d.ts +74 -27
- package/dist/aiballoon/utils/contentwidth.d.ts +1 -0
- package/dist/aichat/aichat.d.ts +88 -87
- package/dist/aichat/aichatballoon.d.ts +88 -79
- package/dist/aichat/aichatcontroller.d.ts +284 -258
- package/dist/aichat/aichatui.d.ts +352 -328
- package/dist/aichat/model/aichatcontext.d.ts +655 -654
- package/dist/aichat/model/aichatconversation.d.ts +270 -269
- package/dist/aichat/model/aichatinteraction.d.ts +45 -49
- package/dist/aichat/ui/aichatballoonview.d.ts +73 -101
- package/dist/aichat/ui/aichatcontrolsview.d.ts +121 -125
- package/dist/aichat/ui/aichatfeedview.d.ts +145 -128
- package/dist/aichat/ui/aichatview.d.ts +42 -40
- package/dist/aichat/ui/controls/aichatchipsoverflowmanager.d.ts +73 -63
- package/dist/aichat/ui/controls/aichatcontextitembuttonview.d.ts +41 -41
- package/dist/aichat/ui/controls/aichatcontextpanelurlinputview.d.ts +79 -79
- package/dist/aichat/ui/controls/aichatcontextpanelview.d.ts +110 -100
- package/dist/aichat/ui/controls/aichatdropzoneview.d.ts +30 -0
- package/dist/aichat/ui/controls/aichatpromptcapabilitiesview.d.ts +72 -81
- package/dist/aichat/ui/controls/aichatpromptinputview.d.ts +50 -44
- package/dist/aichat/ui/controls/aichatpromptsuggestionslistview.d.ts +13 -13
- package/dist/aichat/ui/controls/resources/aichatcontextresourceslistview.d.ts +44 -44
- package/dist/aichat/ui/controls/resources/aichatcontextresourcesview.d.ts +52 -52
- package/dist/aichat/ui/controls/resources/aichatresourcelistitemview.d.ts +57 -56
- package/dist/aichat/ui/controls/resources/aichatresourcesballoonview.d.ts +104 -100
- package/dist/aichat/ui/controls/resources/aichatresourcessearchinputview.d.ts +53 -53
- package/dist/aichat/ui/feed/aichatfeedcontextchipsview.d.ts +22 -22
- package/dist/aichat/ui/feed/aichatfeedcustomelementview.d.ts +30 -34
- package/dist/aichat/ui/feed/aichatfeederroritemview.d.ts +30 -33
- package/dist/aichat/ui/feed/aichatfeedinteractionheaderview.d.ts +24 -24
- package/dist/aichat/ui/feed/aichatfeeditemview.d.ts +39 -39
- package/dist/aichat/ui/feed/aichatfeedreplyitemview.d.ts +40 -40
- package/dist/aichat/ui/feed/aichatfeedsuggestionitemactionsview.d.ts +62 -63
- package/dist/aichat/ui/feed/aichatfeedsuggestionitemview.d.ts +87 -82
- package/dist/aichat/ui/feed/aichatfeedusermessageitem.d.ts +33 -33
- package/dist/aichat/utils/eventnames.d.ts +8 -4
- package/dist/aichat/utils/parsesingleurl.d.ts +1 -0
- package/dist/aichat/utils/promisequeue.d.ts +26 -25
- package/dist/aichat/utils/readdatatransferfiles.d.ts +14 -0
- package/dist/aichat/utils/resolvepaste.d.ts +71 -0
- package/dist/aichathistory/aichathistory.d.ts +26 -26
- package/dist/aichathistory/aichathistorycontroller.d.ts +36 -35
- package/dist/aichathistory/aichathistoryui.d.ts +80 -89
- package/dist/aichathistory/model/aichathistoryconversations.d.ts +95 -102
- package/dist/aichathistory/model/aichathistoryitem.d.ts +52 -53
- package/dist/aichathistory/ui/aichathistorylistitemview.d.ts +41 -40
- package/dist/aichathistory/ui/aichathistorylistview.d.ts +28 -28
- package/dist/aichathistory/ui/aichathistorysectionlistview.d.ts +16 -16
- package/dist/aichathistory/ui/aichathistoryview.d.ts +33 -33
- package/dist/aichatshortcuts/aichatshortcuts.d.ts +295 -295
- package/dist/aichatshortcuts/ui/aichatshortcutsview.d.ts +24 -18
- package/dist/aichatshortcuts/ui/aichatshortcutview.d.ts +18 -18
- package/dist/aiconfig.d.ts +362 -227
- package/dist/aicore/aiconnector.d.ts +428 -334
- package/dist/aicore/aicore.d.ts +53 -0
- package/dist/aicore/aiediting.d.ts +103 -88
- package/dist/aicore/aierrorreporter.d.ts +101 -0
- package/dist/aicore/aigateway.d.ts +135 -0
- package/dist/aicore/errors/aicoreerror.d.ts +67 -0
- package/dist/aicore/errors/geterrorcode.d.ts +17 -0
- package/dist/aicore/errors/isaborterror.d.ts +12 -0
- package/dist/aicore/errors/normalizeerror.d.ts +23 -0
- package/dist/aicore/model/aicapabilities.d.ts +69 -53
- package/dist/aicore/model/aicontext.d.ts +116 -77
- package/dist/aicore/model/aicontextlibrary.d.ts +71 -0
- package/dist/aicore/model/aicontextref.d.ts +37 -0
- package/dist/aicore/model/aidefaultcontext.d.ts +83 -0
- package/dist/aicore/model/aieditorroot.d.ts +26 -0
- package/dist/aicore/model/aiinteraction.d.ts +162 -162
- package/dist/aicore/model/aimodels.d.ts +80 -76
- package/dist/aicore/model/aireply.d.ts +129 -121
- package/dist/aicore/model/airunresult.d.ts +43 -0
- package/dist/aicore/model/airunsinglerootresult.d.ts +104 -0
- package/dist/aicore/pipeline/airesponseapplier.d.ts +284 -296
- package/dist/aicore/pipeline/airesponseparser.d.ts +24 -23
- package/dist/aicore/ui/aidisclaimerview.d.ts +12 -13
- package/dist/aicore/ui/aidotsloader.d.ts +18 -0
- package/dist/aicore/ui/aiheaderview.d.ts +27 -28
- package/dist/aicore/ui/aimodelselectorview.d.ts +151 -0
- package/dist/aicore/ui/aiseparatorview.d.ts +25 -0
- package/dist/aicore/ui/aiskeleton.d.ts +43 -32
- package/dist/aicore/ui/aispinner.d.ts +10 -11
- package/dist/aicore/ui/suggestioncontainer/aiminitoolbarview.d.ts +55 -56
- package/dist/aicore/ui/suggestioncontainer/aisuggestionbodyview.d.ts +95 -80
- package/dist/aicore/ui/suggestioncontainer/aisuggestioncontainerview.d.ts +45 -46
- package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartheaderview.d.ts +67 -37
- package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartstateview.d.ts +21 -31
- package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentparttoolbarview.d.ts +46 -21
- package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartview.d.ts +91 -58
- package/dist/aicore/ui/suggestioncontainer/aisuggestionheaderview.d.ts +26 -35
- package/dist/aicore/ui/suggestioncontainer/aisuggestionstreamablecontentview.d.ts +30 -27
- package/dist/aicore/ui/suggestioncontainer/aiwebsourcesview.d.ts +24 -24
- package/dist/aicore/utils/abortabletimeout.d.ts +11 -11
- package/dist/aicore/utils/aitabids.d.ts +11 -0
- package/dist/aicore/utils/builddocumentsuggestionsmap.d.ts +30 -0
- package/dist/aicore/utils/buttonclasses.d.ts +17 -8
- package/dist/aicore/utils/cleanupstreamingartifacts.d.ts +12 -0
- package/dist/aicore/utils/common-translations.d.ts +6 -6
- package/dist/aicore/utils/contentparttranslationkeys.d.ts +27 -0
- package/dist/aicore/utils/createresizebutton.d.ts +8 -9
- package/dist/aicore/utils/createstartconversationbutton.d.ts +7 -8
- package/dist/aicore/utils/documentposition.d.ts +37 -37
- package/dist/aicore/utils/documentrange.d.ts +41 -41
- package/dist/aicore/utils/eventnames.d.ts +5 -5
- package/dist/aicore/utils/geteditorconfig.d.ts +107 -0
- package/dist/aicore/utils/geteditorsfromcontext.d.ts +18 -0
- package/dist/aicore/utils/getmodeldisplaymode.d.ts +21 -0
- package/dist/aicore/utils/getoperationsfordocumentsuggestions.d.ts +20 -0
- package/dist/aicore/utils/getrootinfo.d.ts +45 -0
- package/dist/aicore/utils/getsuggestionpartsfromreply.d.ts +24 -18
- package/dist/aicore/utils/htmlparser.d.ts +23 -16
- package/dist/aicore/utils/htmlstreamer.d.ts +79 -79
- package/dist/aicore/utils/inlineroot.d.ts +1 -0
- package/dist/aicore/utils/istrackchangesenabled.d.ts +23 -0
- package/dist/aicore/utils/markoperationsasai.d.ts +21 -0
- package/dist/aicore/utils/replyactions.d.ts +13 -0
- package/dist/aicore/utils/scrollmanager.d.ts +24 -23
- package/dist/aicore/utils/showaitab.d.ts +1 -0
- package/dist/aidocumentprocessing/aidocumentprocessinggateway.d.ts +110 -0
- package/dist/aidocumentprocessing/model/aidocumentprocessingrunresult.d.ts +19 -0
- package/dist/aieditorintegration/aieditorintegration.d.ts +42 -32
- package/dist/aieditorintegration/aitogglebutton/aitogglebuttonui.d.ts +33 -34
- package/dist/aieditorintegration/aitogglebutton/toggleaicommand.d.ts +12 -12
- package/dist/aiquickactions/aiquickactions.d.ts +303 -252
- package/dist/aiquickactions/aiquickactionscommand.d.ts +10 -10
- package/dist/aiquickactions/aiquickactionsediting.d.ts +22 -22
- package/dist/aiquickactions/aiquickactionsui.d.ts +131 -124
- package/dist/aiquickactions/ui/aiquickactionsbuttoncreator.d.ts +57 -57
- package/dist/aiquickactions/ui/aiquickactionsdropdowncontentview.d.ts +45 -45
- package/dist/aiquickactions/ui/aiquickactionsdropdowncreator.d.ts +59 -59
- package/dist/aiquickactions/ui/aiquickactionsfilteredlistview.d.ts +0 -4
- package/dist/aiquickactions/ui/balloon/aiactionsballoonview.d.ts +73 -136
- package/dist/aiquickactions/ui/dropdownmenubuttonwithhighlightview.d.ts +24 -24
- package/dist/aireviewcore/aireviewcorecheckregistry.d.ts +37 -0
- package/dist/aireviewcore/aireviewcorecontroller.d.ts +48 -23
- package/dist/aireviewcore/aireviewcoreediting.d.ts +296 -224
- package/dist/aireviewcore/aireviewcoreui.d.ts +109 -85
- package/dist/aireviewcore/model/aichecksinglerootresult.d.ts +22 -0
- package/dist/aireviewcore/model/aireviewcheck.d.ts +49 -49
- package/dist/aireviewcore/model/aireviewchecklist.d.ts +29 -28
- package/dist/aireviewcore/model/aireviewcheckresult.d.ts +36 -35
- package/dist/aireviewcore/model/aireviewcheckresultchange.d.ts +62 -50
- package/dist/aireviewcore/model/aireviewcheckrun.d.ts +174 -147
- package/dist/aireviewcore/model/aireviewsystemcheckrun.d.ts +16 -16
- package/dist/aireviewcore/types.d.ts +30 -24
- package/dist/aireviewcore/ui/aireviewcoreabstractchecklistview.d.ts +50 -0
- package/dist/aireviewcore/ui/aireviewcorechecklistitemresultview.d.ts +53 -76
- package/dist/aireviewcore/ui/aireviewcorecompletereviewdropdown.d.ts +29 -0
- package/dist/aireviewcore/ui/aireviewcorecustomcheckview.d.ts +38 -56
- package/dist/aireviewcore/ui/aireviewcorefinishreviewbuttonview.d.ts +8 -9
- package/dist/aireviewcore/ui/aireviewcoregeneralerrorview.d.ts +20 -20
- package/dist/aireviewcore/ui/aireviewcorenavigationpanelview.d.ts +169 -0
- package/dist/aireviewcore/ui/aireviewcoreprogressbarview.d.ts +32 -0
- package/dist/aireviewcore/ui/aireviewcorepromptinputview.d.ts +25 -25
- package/dist/aireviewcore/ui/aireviewcorereviewchecklistview.d.ts +42 -23
- package/dist/aireviewcore/ui/aireviewcorereviewcommandlistitemview.d.ts +49 -39
- package/dist/aireviewcore/ui/aireviewcorereviewcompletedview.d.ts +13 -14
- package/dist/aireviewcore/ui/aireviewcoreuicheckresultsview.d.ts +114 -87
- package/dist/aireviewcore/ui/aireviewcoreview.d.ts +54 -50
- package/dist/aireviewcore/ui/changeevents.d.ts +49 -0
- package/dist/aireviewcore/ui/form/aireviewcoreformdropdown.d.ts +16 -16
- package/dist/aireviewcore/ui/form/aireviewcoreformmanager.d.ts +12 -12
- package/dist/aireviewcore/utils/openleaveconfirmationdialog.d.ts +21 -0
- package/dist/aireviewcore/utils/reviewcontentpart.d.ts +25 -0
- package/dist/aireviewmode/aireviewcheckdefinitions.d.ts +12 -12
- package/dist/aireviewmode/aireviewgateway.d.ts +172 -0
- package/dist/aireviewmode/aireviewmode.d.ts +260 -126
- package/dist/aireviewmode/aireviewmodecheckregistry.d.ts +46 -0
- package/dist/aireviewmode/aireviewmodecontroller.d.ts +24 -17
- package/dist/aireviewmode/aireviewmodeui.d.ts +17 -17
- package/dist/aireviewmode/model/aireviewcheckcustom.d.ts +16 -16
- package/dist/aireviewmode/model/aireviewcheckextra.d.ts +35 -30
- package/dist/aireviewmode/model/aireviewcustomcheckrun.d.ts +18 -17
- package/dist/aireviewmode/model/aireviewextracheckrun.d.ts +15 -15
- package/dist/aireviewmode/model/aireviewmodechecklist.d.ts +22 -18
- package/dist/aireviewmode/ui/aireviewmodecheckresultsview.d.ts +41 -0
- package/dist/aisdk/dataidassigner.d.ts +20 -0
- package/dist/aisdk/documentchanges.d.ts +165 -0
- package/dist/aisdk/documentchangesutils.d.ts +15 -0
- package/dist/aisdk/documentcompare.d.ts +171 -0
- package/dist/aisdk/documentcompareutils.d.ts +16 -0
- package/dist/aisdk/documentsnapshot.d.ts +48 -0
- package/dist/aisdk/extractselectionfromhtml.d.ts +27 -0
- package/dist/aisdk/validateoperations.d.ts +43 -0
- package/dist/aitabs/aitabs.d.ts +104 -84
- package/dist/aitabs/aitabsmainview.d.ts +70 -46
- package/dist/aitabs/tabs/aitabsview.d.ts +191 -188
- package/dist/aitranslate/aitranslate.d.ts +165 -129
- package/dist/aitranslate/aitranslatecheckregistry.d.ts +27 -0
- package/dist/aitranslate/aitranslatecontroller.d.ts +18 -15
- package/dist/aitranslate/aitranslategateway.d.ts +89 -0
- package/dist/aitranslate/aitranslateui.d.ts +17 -18
- package/dist/aitranslate/model/aitranslatecheck.d.ts +12 -12
- package/dist/aitranslate/model/aitranslatechecklist.d.ts +11 -11
- package/dist/aitranslate/model/aitranslatecheckrun.d.ts +24 -23
- package/dist/aitranslate/ui/aitranslatechecklistview.d.ts +28 -7
- package/dist/aitranslate/ui/aitranslatecheckresultsview.d.ts +11 -11
- package/dist/augmentation.d.ts +79 -63
- package/dist/errors.d.ts +0 -4
- package/dist/errorsmap.d.ts +5 -5
- package/dist/index-content.css +0 -96
- package/dist/index-editor.css +3948 -3291
- package/dist/index.css +3959 -3307
- package/dist/index.d.ts +83 -59
- package/dist/index.js +19 -6
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/package.json +32 -13
- package/dist/aichat/ui/controls/aichatcontrolsloaderview.d.ts +0 -12
- package/dist/aicore/ui/suggestioncontainer/aisuggestionloaderview.d.ts +0 -16
- package/dist/aicore/utils/geteditorfromcontext.d.ts +0 -19
- package/dist/aicore/utils/getoperationsfromreply.d.ts +0 -24
- package/dist/aiquickactions/ui/balloon/aiactionsballoondisclaimerview.d.ts +0 -17
- package/dist/aiquickactions/ui/balloon/aiactionsballoontoolbarview.d.ts +0 -37
- package/dist/aireviewcore/ui/aireviewcoreballoonsuggestionview.d.ts +0 -38
- package/dist/aitabs/tabs/tabbuttonview.d.ts +0 -47
- package/dist/aitabs/tabs/tabpanelview.d.ts +0 -44
|
@@ -1,691 +1,692 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { type Editor } from
|
|
10
|
-
import { type AIConnector, type AIUserMessage } from
|
|
11
|
-
import { type AIContextItemType, type AIContextTextResourceType, type AIContextItem, type AIContextItemRequestData, type
|
|
6
|
+
* @module ai/aichat/model/aichatcontext
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { type Editor } from "@ckeditor/ckeditor5-core";
|
|
10
|
+
import { type AIConnector, type AIUserMessage } from "../../aicore/aiconnector.js";
|
|
11
|
+
import { AIContext, type AIContextItemType, type AIContextTextResourceType, type AIContextItem, type AIContextItemRequestData, type AIToolContextItem } from "../../aicore/model/aicontext.js";
|
|
12
12
|
export declare const AI_CONTEXT_MODEL_EVENT_NAMES: readonly ["contextItemAdded", "contextItemRemoved", "contextItemLoadingEnded", "contextSent", "error", "addContextOptionsChanged", "sourceResourcesLoaded", "resourceStateChanged", "uploadProgressChanged"];
|
|
13
|
-
declare const AIChatContext_base: {
|
|
14
|
-
new (): import("@ckeditor/ckeditor5-utils").Observable;
|
|
15
|
-
prototype: import("@ckeditor/ckeditor5-utils").Observable;
|
|
16
|
-
};
|
|
17
13
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export declare class AIChatContext extends
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
14
|
+
* Manages the context of the current conversation.
|
|
15
|
+
*
|
|
16
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
17
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
18
|
+
*/
|
|
19
|
+
export declare class AIChatContext extends AIContext {
|
|
20
|
+
constructor({ connector, config, ownerId }: {
|
|
21
|
+
connector: AIConnector;
|
|
22
|
+
config?: AIChatContextConfig;
|
|
23
|
+
ownerId: string;
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Initializes the context.
|
|
27
|
+
*
|
|
28
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
29
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
30
|
+
*/
|
|
31
|
+
init(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the pending context items that will be sent to the AI endpoint in the next interaction.
|
|
34
|
+
*
|
|
35
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
36
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
37
|
+
* @returns Map of pending context items keyed by their uiId
|
|
38
|
+
*/
|
|
39
|
+
getPendingContextItems(): ReadonlyMap<string, AIContextItem>;
|
|
40
|
+
/**
|
|
41
|
+
* Populates context items from a historical user message. Documents are batch-loaded and assembled into a single
|
|
42
|
+
* `current-document` context item whose `documents` array carries per-root metadata used downstream
|
|
43
|
+
* (notably by `AIReply`) to route modifications back to the source editor and root; non-document content items
|
|
44
|
+
* are turned into one context item each.
|
|
45
|
+
*
|
|
46
|
+
* The context references carried by the message are restored as pending items, so they keep being attached to
|
|
47
|
+
* every following message the way they were before the conversation was read back from history.
|
|
48
|
+
*
|
|
49
|
+
* Returns the assembled context items together with `unmatchedDocumentIds` — the IDs of documents that could
|
|
50
|
+
* not be matched to a live editor root via `attributes.channelId` (compared against the editor's
|
|
51
|
+
* `collaboration.channelId` config) and `attributes.rootName`. Callers resolve a per-document outdated reason
|
|
52
|
+
* from these IDs so suggestions from unmatched roots render as outdated while their matched siblings stay
|
|
53
|
+
* actionable.
|
|
54
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
55
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
56
|
+
*/
|
|
57
|
+
populateFromMessage(messageContents: AIUserMessage["content"], editors: ReadonlyArray<Editor>, defaultContextIds?: Set<string>): Promise<{
|
|
58
|
+
contextItems: Map<string, AIContextItem>;
|
|
59
|
+
hasUnmatched: boolean;
|
|
60
|
+
unmatchedDocumentIds: Set<string>;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a context item from a single non-document conversation content entry. Document content items are
|
|
64
|
+
* handled separately by {@link #_populateDocumentContextItem} because they need batch loading and per-root
|
|
65
|
+
* matching.
|
|
66
|
+
*/
|
|
67
|
+
private _createContextItemFromContent;
|
|
68
|
+
/**
|
|
69
|
+
* Returns all context items that have been sent to the AI endpoint in the current conversation.
|
|
70
|
+
*
|
|
71
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
72
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
73
|
+
* @returns Map of sent context items keyed by their uiId
|
|
74
|
+
*/
|
|
75
|
+
getSentContextItems(): ReadonlyMap<string, AIContextItem>;
|
|
76
|
+
/**
|
|
77
|
+
* Removes a context item from the pending context.
|
|
78
|
+
* Read-only items cannot be removed and the method returns early.
|
|
79
|
+
*
|
|
80
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
81
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
82
|
+
* @param uiId The unique identifier of the context item to remove
|
|
83
|
+
*/
|
|
84
|
+
removeFromContext(uiId: string): void;
|
|
85
|
+
/**
|
|
86
|
+
* Clears all pending context items, then re-adds the current document and the context references
|
|
87
|
+
* (`type: 'context'`) as read-only and hidden pending items, so that they are sent with the following messages.
|
|
88
|
+
* A context reference that is already read-only and hidden is left untouched.
|
|
89
|
+
*
|
|
90
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
91
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
92
|
+
*/
|
|
93
|
+
clearPendingContextItems(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Adds context items to the conversation context and clears the pending context items.
|
|
96
|
+
*
|
|
97
|
+
* A context reference never becomes a conversation item. It stays pending for as long as it is attached, which is
|
|
98
|
+
* what keeps it sent with every message and reported as being in context, so a second record of it could only go
|
|
99
|
+
* stale once it stops being attached.
|
|
100
|
+
*
|
|
101
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
102
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
103
|
+
*/
|
|
104
|
+
addToConversationContext(contextItems: Map<string, AIContextItem>): void;
|
|
105
|
+
/**
|
|
106
|
+
* Checks if the current document is in the pending context.
|
|
107
|
+
*
|
|
108
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
109
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
110
|
+
* @returns True if the current document is in pending context, false otherwise
|
|
111
|
+
*/
|
|
112
|
+
isCurrentDocumentInContext(): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
115
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
116
|
+
*/
|
|
117
|
+
isSelectionInContext(): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Checks if the current document is in the conversation context.
|
|
120
|
+
*
|
|
121
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
122
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
123
|
+
* @returns True if the current document is in conversation context, false otherwise
|
|
124
|
+
*/
|
|
125
|
+
isCurrentDocumentInConversation(): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Converts context items to request data format for API endpoint.
|
|
128
|
+
* This static method transforms the internal context item format to the format expected by the AI connector.
|
|
129
|
+
*
|
|
130
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
131
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
132
|
+
* @param contextItems Map of context items to convert
|
|
133
|
+
* @returns Array of context items in API request format
|
|
134
|
+
*/
|
|
135
|
+
static mapContextItemsToRequestData(contextItems: Map<string, AIContextItem>): Array<AIContextItemRequestData>;
|
|
136
|
+
/**
|
|
137
|
+
* Adds files to the context by uploading them and creating context items.
|
|
138
|
+
* This method handles multiple files concurrently and tracks upload progress.
|
|
139
|
+
*
|
|
140
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
141
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
142
|
+
* @param files Array of File objects to upload and add to context
|
|
143
|
+
* @param [attributes] Optional attributes object containing resourceId and label for tracking purposes and context chips
|
|
144
|
+
* @param [type] Context item type, defaults to 'file' to indicate that the file is being added as a file or text
|
|
145
|
+
* @returns Promise that resolves when all files are processed
|
|
146
|
+
*/
|
|
147
|
+
addFilesToContext(files: Array<File>, attributes?: {
|
|
148
|
+
resourceId: string;
|
|
149
|
+
label: string;
|
|
150
|
+
}, type?: "file" | "text"): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* Adds the current document to the pending context.
|
|
153
|
+
* If the document is already in context, this method returns early without changes.
|
|
154
|
+
*
|
|
155
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
156
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
157
|
+
* @param label Display label for the current document
|
|
158
|
+
*/
|
|
159
|
+
addCurrentDocumentToContext(label: string): void;
|
|
160
|
+
/**
|
|
161
|
+
* Returns context item for current document context, or undefined if the document context is not added.
|
|
162
|
+
*/
|
|
163
|
+
getCurrentDocumentContext(): AIContextItem | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
166
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
167
|
+
*/
|
|
168
|
+
addSelectionToContext(selection: string): void;
|
|
169
|
+
/**
|
|
170
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
171
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
172
|
+
*/
|
|
173
|
+
removeSelectionFromContext(): void;
|
|
174
|
+
/**
|
|
175
|
+
* Adds a reference to an admin-managed context from the Context Library to the pending context items.
|
|
176
|
+
*
|
|
177
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
178
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
179
|
+
* @param libraryContextId The identifier of the context to attach.
|
|
180
|
+
* @param [label] The label displayed on the context chip. Defaults to `libraryContextId`.
|
|
181
|
+
*/
|
|
182
|
+
addLibraryContextToContext(libraryContextId: string, label?: string): void;
|
|
183
|
+
/**
|
|
184
|
+
* Adds a URL to the context by uploading it and creating a context item.
|
|
185
|
+
* This method handles URL upload with proper error handling and progress tracking.
|
|
186
|
+
*
|
|
187
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
188
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
189
|
+
* @param url The URL to upload and add to context
|
|
190
|
+
* @param [attributes] Optional attributes object containing resourceId and label for tracking purposes and context chips
|
|
191
|
+
* @returns Promise that resolves when the URL is processed
|
|
192
|
+
*/
|
|
193
|
+
addUrlToContext(url: string, attributes?: {
|
|
194
|
+
resourceId: string;
|
|
195
|
+
label: string;
|
|
196
|
+
}): Promise<void>;
|
|
197
|
+
/**
|
|
198
|
+
* Adds an AI tool context item to the pending context items.
|
|
199
|
+
*
|
|
200
|
+
* Note, that these context items are ignored by the CKEditor AI agent and should be handled by your backend AI tool.
|
|
201
|
+
*
|
|
202
|
+
* The object which is passed as a parameter can contain the following properties:
|
|
203
|
+
* ```ts
|
|
204
|
+
* {
|
|
205
|
+
* // Must be set to `'mcp-tool-context'`.
|
|
206
|
+
* type: 'mcp-tool-context',
|
|
207
|
+
*
|
|
208
|
+
* // The name of the MCP server.
|
|
209
|
+
* mcpServerName: string;
|
|
210
|
+
*
|
|
211
|
+
* // The data for the tool. Can be anything.
|
|
212
|
+
* data: Record<string, any>;
|
|
213
|
+
*
|
|
214
|
+
* // The label of the item used to display it in the chat UI.
|
|
215
|
+
* label: string;
|
|
216
|
+
*
|
|
217
|
+
* // Optional, 1-21 characters. Auto-generated if omitted.
|
|
218
|
+
* id?: string;
|
|
219
|
+
*
|
|
220
|
+
* // The name of the tool. Omit to send context to all tools on the server.
|
|
221
|
+
* toolName?: string;
|
|
222
|
+
* }
|
|
223
|
+
* ```
|
|
224
|
+
*
|
|
225
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
226
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
227
|
+
*/
|
|
228
|
+
addToolItemToContext(contextItem: AIToolContextItem): void;
|
|
229
|
+
/**
|
|
230
|
+
* Loads resources for a given source provider with the specified query.
|
|
231
|
+
* This method calls the source's {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getResources}
|
|
232
|
+
* callback and updates resource states.
|
|
233
|
+
*
|
|
234
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
235
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
236
|
+
* @param sourceId The unique identifier of the source provider
|
|
237
|
+
* @param query Search query to filter resources
|
|
238
|
+
* @param uid Unique identifier for the request to prevent race conditions
|
|
239
|
+
* @returns Promise resolving to array of resources with context state
|
|
240
|
+
*/
|
|
241
|
+
loadSourceResources(sourceId: string, query: string, uid: string): Promise<Array<AIContextResourceState>>;
|
|
242
|
+
/**
|
|
243
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
244
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
245
|
+
*/
|
|
246
|
+
addResourceToContext(source: AIContextProvider, resource: AIContextResource): Promise<void>;
|
|
247
|
+
/**
|
|
248
|
+
* Toggles the visibility of the add current document option in the add context options.
|
|
249
|
+
*
|
|
250
|
+
* By default, the option is visible if the current document is not in the context or conversation.
|
|
251
|
+
*
|
|
252
|
+
* There's an option to force the visibility of the option by passing `true` or `false` to the method.
|
|
253
|
+
*
|
|
254
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
255
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
256
|
+
* @param isVisible Whether to force-show or force-hide the option.
|
|
257
|
+
* @default undefined
|
|
258
|
+
*/
|
|
259
|
+
toggleAddCurrentDocumentOptionVisibility(isVisible?: boolean): void;
|
|
251
260
|
}
|
|
252
|
-
/**
|
|
253
|
-
* A uploaded-document source stored on the chat context, keyed by the id returned by the `/documents/batch` endpoint.
|
|
254
|
-
*
|
|
255
|
-
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
256
|
-
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
257
|
-
*/
|
|
258
|
-
export type AIChatContextDocumentSource = {
|
|
259
|
-
editor: Editor;
|
|
260
|
-
rootName: string;
|
|
261
|
-
content: string;
|
|
262
|
-
version: number;
|
|
263
|
-
/**
|
|
264
|
-
* The document's stored `name` — the source root's identifier as reported when the document was uploaded.
|
|
265
|
-
*/
|
|
266
|
-
name?: string;
|
|
267
|
-
/**
|
|
268
|
-
* The document's stored `description`, taken from the source root's
|
|
269
|
-
* {@link module:core/editor/editorconfig~RootConfig root configuration}. The AI service uses descriptions to
|
|
270
|
-
* semantically distinguish roots when a user scopes a request to a specific area (e.g. "edit the title").
|
|
271
|
-
*/
|
|
272
|
-
description?: string;
|
|
273
|
-
};
|
|
274
261
|
export type AIChatContextItemAddedEvent = {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
];
|
|
262
|
+
name: "contextItemAdded";
|
|
263
|
+
args: [{
|
|
264
|
+
contextItem: AIContextItem;
|
|
265
|
+
isLoading: boolean;
|
|
266
|
+
}];
|
|
282
267
|
};
|
|
283
268
|
export type AIChatContextItemRemovedEvent = {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
];
|
|
269
|
+
name: "contextItemRemoved";
|
|
270
|
+
args: [{
|
|
271
|
+
uiId: string;
|
|
272
|
+
type?: AIContextItemType;
|
|
273
|
+
}];
|
|
291
274
|
};
|
|
292
275
|
export type AIChatContextSentEvent = {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
];
|
|
276
|
+
name: "contextSent";
|
|
277
|
+
args: [{
|
|
278
|
+
contextItems: Array<AIContextItem>;
|
|
279
|
+
}];
|
|
299
280
|
};
|
|
300
281
|
export type AIChatContextAddContextOptionsChangedEvent = {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}
|
|
306
|
-
];
|
|
282
|
+
name: "addContextOptionsChanged";
|
|
283
|
+
args: [{
|
|
284
|
+
options: AIAddContextOptionsState;
|
|
285
|
+
}];
|
|
307
286
|
};
|
|
308
287
|
export type AIChatContextUploadProgressChangedEvent = {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
314
|
-
];
|
|
288
|
+
name: "uploadProgressChanged";
|
|
289
|
+
args: [{
|
|
290
|
+
isUploadInProgress: boolean;
|
|
291
|
+
}];
|
|
315
292
|
};
|
|
316
293
|
export type AIAddContextOptionsState = {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
294
|
+
document: {
|
|
295
|
+
enabled: boolean;
|
|
296
|
+
isHidden: boolean;
|
|
297
|
+
};
|
|
298
|
+
urls: {
|
|
299
|
+
enabled: boolean;
|
|
300
|
+
};
|
|
301
|
+
files: {
|
|
302
|
+
enabled: boolean;
|
|
303
|
+
};
|
|
304
|
+
sources: Array<AIContextProviderState>;
|
|
305
|
+
customItems: Array<AIContextCustomItem>;
|
|
329
306
|
};
|
|
330
307
|
export type AIContextProviderState = AIContextProvider & {
|
|
331
|
-
|
|
308
|
+
resources: Array<AIContextResourceState>;
|
|
332
309
|
};
|
|
333
310
|
export type AIContextResourceState = AIContextResource & {
|
|
334
|
-
|
|
311
|
+
isInContext?: boolean;
|
|
335
312
|
};
|
|
336
313
|
/**
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
314
|
+
* The configuration of the AI Chat menu for adding resources to the prompt context.
|
|
315
|
+
*
|
|
316
|
+
* This menu allows users to attach additional resources (files, documents, URLs) to their AI chat prompts,
|
|
317
|
+
* providing the AI with more context for generating responses. The properties defined in this config are set
|
|
318
|
+
* in the `config.ai.chat.context` namespace.
|
|
319
|
+
*
|
|
320
|
+
* It also allows to change the minimal number of items in the context adding menu required to show the search input
|
|
321
|
+
* using `config.ai.chat.context.searchInputVisibleFrom` option.
|
|
322
|
+
*
|
|
323
|
+
* ```ts
|
|
324
|
+
* ClassicEditor
|
|
325
|
+
* .create( {
|
|
326
|
+
* ai: {
|
|
327
|
+
* chat: {
|
|
328
|
+
* context: {
|
|
329
|
+
* // Allow for adding the current document content to the conversation context.
|
|
330
|
+
* document: { enabled: true },
|
|
331
|
+
*
|
|
332
|
+
* // Allow for adding URLs (web pages, blogs, etc.) to the conversation context.
|
|
333
|
+
* urls: { enabled: false },
|
|
334
|
+
*
|
|
335
|
+
* // Allow for uploading files (PDF, Word, etc.) to the conversation context.
|
|
336
|
+
* files: { enabled: true },
|
|
337
|
+
*
|
|
338
|
+
* // Configuration of external resources (files, text, etc.) to the conversation context.
|
|
339
|
+
* sources: [
|
|
340
|
+
* {
|
|
341
|
+
* id: 'my-docs',
|
|
342
|
+
* label: 'My Documents',
|
|
343
|
+
* getResources: ( query ) => fetchMyDocuments( query ),
|
|
344
|
+
* getData: ( id ) => fetchDocumentContent( id )
|
|
345
|
+
* }
|
|
346
|
+
* ],
|
|
347
|
+
*
|
|
348
|
+
* // The minimum number of resources to show the search input.
|
|
349
|
+
* searchInputVisibleFrom: 5
|
|
350
|
+
* }
|
|
351
|
+
* }
|
|
352
|
+
* }
|
|
353
|
+
* } )
|
|
354
|
+
* .then( ... )
|
|
355
|
+
* .catch( ... );
|
|
356
|
+
* ```
|
|
357
|
+
*
|
|
358
|
+
* * The {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#document},
|
|
359
|
+
* {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#urls}, and
|
|
360
|
+
* {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#files} properties configure the **built-in** options in the context menu.
|
|
361
|
+
* Each option can be enabled or disabled using the `enabled` boolean property. See their respective documentation for more details.
|
|
362
|
+
*
|
|
363
|
+
* * The {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#sources} property introduces customizable menus to the
|
|
364
|
+
* conversation context user interface that display a list of **external** resources that can be attached to the AI prompt.
|
|
365
|
+
* The user can search resources and the minimal number of resources required to show the search input can be configured using
|
|
366
|
+
* the {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#searchInputVisibleFrom} option.
|
|
367
|
+
* See {@link module:ai/aichat/model/aichatcontext~AIContextProvider} and {@link module:ai/aichat/model/aichatcontext~AIContextResource}
|
|
368
|
+
* to learn more.
|
|
369
|
+
*/
|
|
393
370
|
export type AIChatContextConfig = {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
371
|
+
/**
|
|
372
|
+
* When this option is enabled (default), adding the editor document to the context of the conversation becomes possible.
|
|
373
|
+
* This allows the AI to interact with the content of the entire document if the user asks for it
|
|
374
|
+
* (e.g. "Write an introduction to the document." or "Shorten headings to make them more concise.").
|
|
375
|
+
*
|
|
376
|
+
* **Note**: When set `true`, the document content will be automatically added to the context of the new conversation. The user
|
|
377
|
+
* can still remove it using the user interface before sending the message if needed.
|
|
378
|
+
*
|
|
379
|
+
* **Note**: When set to `false`, the {@link module:ai/aiquickactions/aiquickactions~AIQuickActions AI Quick Actions} that use AI Chat
|
|
380
|
+
* will be disabled and removed from the UI. The selection can’t be sent to AI Chat without sending the entire document.
|
|
381
|
+
*
|
|
382
|
+
* @default true
|
|
383
|
+
*/
|
|
384
|
+
document?: {
|
|
385
|
+
enabled: boolean;
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* When this option is enabled (default), adding URLs to the context of the conversation becomes possible.
|
|
389
|
+
* This allows the AI to interact with the content of the URLs (e.g. web pages, blog posts, etc.) if the user adds them to the context
|
|
390
|
+
* (e.g. "Write a very brief summary of the linked blog post.").
|
|
391
|
+
*
|
|
392
|
+
* @default true
|
|
393
|
+
*/
|
|
394
|
+
urls?: {
|
|
395
|
+
enabled: boolean;
|
|
396
|
+
};
|
|
397
|
+
/**
|
|
398
|
+
* When this option is enabled (default), adding files to the context of the conversation becomes possible.
|
|
399
|
+
* This allows the AI to interact with the content of the files (e.g. Word documents, PDF files, etc.) if the user adds them
|
|
400
|
+
* to the context (e.g. "Write a very brief summary of the attached Word document.").
|
|
401
|
+
*
|
|
402
|
+
* @default true
|
|
403
|
+
*/
|
|
404
|
+
files?: {
|
|
405
|
+
enabled: boolean;
|
|
406
|
+
};
|
|
407
|
+
/**
|
|
408
|
+
* When this option is enabled, the contexts available to the current token are offered in the context picker as a
|
|
409
|
+
* built-in source, excluding any context referenced by the global `ai.defaultContext` configuration.
|
|
410
|
+
*
|
|
411
|
+
* @default false
|
|
412
|
+
*/
|
|
413
|
+
contextLibrary?: {
|
|
414
|
+
enabled: boolean;
|
|
415
|
+
};
|
|
416
|
+
/**
|
|
417
|
+
* The configuration of the custom options in the context menu.
|
|
418
|
+
*
|
|
419
|
+
* Each configured {@link module:ai/aichat/model/aichatcontext~AIContextProvider} represents a single menu option that, when clicked,
|
|
420
|
+
* displays a list of available resources that can be attached to the AI prompt.
|
|
421
|
+
*
|
|
422
|
+
* {@link module:ai/aichat/model/aichatcontext~AIContextProvider Learn more about the configuration of custom resources}.
|
|
423
|
+
*/
|
|
424
|
+
sources?: Array<AIContextProvider>;
|
|
425
|
+
/**
|
|
426
|
+
* When this option is enabled, the selection made in the editor will always be added to the context.
|
|
427
|
+
*
|
|
428
|
+
* By default, the selection is added to the context only after user explicitly requests it by clicking "Ask AI" button.
|
|
429
|
+
*
|
|
430
|
+
* **Note**: This setting will have no effect if the feature is configured to
|
|
431
|
+
* {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#document disallow setting document as the conversation context}.
|
|
432
|
+
*
|
|
433
|
+
* @default false
|
|
434
|
+
*/
|
|
435
|
+
alwaysAddSelection?: boolean;
|
|
436
|
+
/**
|
|
437
|
+
* The configuration of the custom items in the context menu.
|
|
438
|
+
*
|
|
439
|
+
* Each configured {@link module:ai/aichat/model/aichatcontext~AIContextCustomItem} represents a single menu option that, when clicked,
|
|
440
|
+
* will execute a custom callback (e.g. opening a file manager).
|
|
441
|
+
*
|
|
442
|
+
* {@link module:ai/aichat/model/aichatcontext~AIContextCustomItem Learn more about the configuration of custom items}.
|
|
443
|
+
*/
|
|
444
|
+
customItems?: Array<AIContextCustomItem>;
|
|
445
|
+
/**
|
|
446
|
+
* The minimum number of resources to show the search input.
|
|
447
|
+
*
|
|
448
|
+
* @default 7
|
|
449
|
+
*/
|
|
450
|
+
searchInputVisibleFrom?: number;
|
|
451
|
+
/**
|
|
452
|
+
* Configures how paste interactions in the AI Chat input are handled.
|
|
453
|
+
*/
|
|
454
|
+
paste?: AIChatContextPasteConfig;
|
|
455
|
+
};
|
|
456
|
+
/**
|
|
457
|
+
* Configuration for paste handling in the AI Chat input.
|
|
458
|
+
*/
|
|
459
|
+
export type AIChatContextPasteConfig = {
|
|
460
|
+
/**
|
|
461
|
+
* Minimum length of the pasted plain text (in characters) that triggers conversion to a
|
|
462
|
+
* `.txt` context item. Pasted text shorter than this lands inline in the input as usual.
|
|
463
|
+
*
|
|
464
|
+
* @default 1500
|
|
465
|
+
*/
|
|
466
|
+
textThreshold?: number;
|
|
465
467
|
};
|
|
466
468
|
/**
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
469
|
+
* The configuration of a custom option in the AI Chat menu for adding external resources to the prompt context.
|
|
470
|
+
*
|
|
471
|
+
* A `AIContextProvider` represents a single menu option that, when clicked, displays a list of available
|
|
472
|
+
* resources that can be attached to the AI prompt. The {@link module:ai/aichat/model/aichatcontext~AIContextProvider#label} is displayed
|
|
473
|
+
* as the menu option text, and the optional {@link module:ai/aichat/model/aichatcontext~AIContextProvider#icon} can be used to provide
|
|
474
|
+
* a visual representation.
|
|
475
|
+
*
|
|
476
|
+
* The {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getResources} callback is called when the user clicks on the menu
|
|
477
|
+
* option and should return an array of {@link module:ai/aichat/model/aichatcontext~AIContextResource available resources}.
|
|
478
|
+
* Resources returned by this callback are displayed as a list and each resource comes with an optional
|
|
479
|
+
* {@link module:ai/aichat/model/aichatcontext~AIContextResource#data} property that:
|
|
480
|
+
* * When present, it will be used as is.
|
|
481
|
+
* * When `undefined`, for instance, because the resource content is large and obtaining it along with the list is expensive,
|
|
482
|
+
* the data will be retrieved using the optional {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getData} callback on
|
|
483
|
+
* demand the moment the user selects this particular resource.
|
|
484
|
+
*
|
|
485
|
+
* The optional {@link module:ai/aichat/model/aichatcontext~AIContextProvider#useDefaultFiltering} property controls whether the
|
|
486
|
+
* built-in search filtering should be applied to the resources returned by `getResources()`.
|
|
487
|
+
* * When set to `true`, the resources will be filtered based on the user's search query.
|
|
488
|
+
* * When set to `false`, all resources will be displayed regardless of the search query, allowing the provider to handle filtering
|
|
489
|
+
* internally within the `getResources()` callback.
|
|
490
|
+
*
|
|
491
|
+
* ```ts
|
|
492
|
+
* {
|
|
493
|
+
* // The unique identifier of the provider.
|
|
494
|
+
* id: 'knowledge-base',
|
|
495
|
+
*
|
|
496
|
+
* // The human-readable name of the provider.
|
|
497
|
+
* label: 'Knowledge Base',
|
|
498
|
+
*
|
|
499
|
+
* // (Optional) The SVG string of the provider's icon. If not provided, a generic icon will be used instead.
|
|
500
|
+
* icon: '<svg xmlns="http://www.w3.org/2000/svg">...</svg>',
|
|
501
|
+
*
|
|
502
|
+
* // Whether to use the built-in search filtering.
|
|
503
|
+
* useDefaultFiltering: false,
|
|
504
|
+
*
|
|
505
|
+
* // The async callback to retrieve the list of available resources. Usually involves fetching data from a database or an external API
|
|
506
|
+
* // but here we use a simple array of resources for demonstration purposes.
|
|
507
|
+
* getResources: async ( query ) => [
|
|
508
|
+
* // Texts in various formats
|
|
509
|
+
* {
|
|
510
|
+
* id: 'text1',
|
|
511
|
+
* type: 'text',
|
|
512
|
+
* label: 'Internal note in plain text format',
|
|
513
|
+
* data: {
|
|
514
|
+
* content: 'Lorem ipsum dolor sit amet...',
|
|
515
|
+
* type: 'text'
|
|
516
|
+
* }
|
|
517
|
+
* },
|
|
518
|
+
* {
|
|
519
|
+
* id: 'text2',
|
|
520
|
+
* type: 'text',
|
|
521
|
+
* label: 'Internal note in Markdown format',
|
|
522
|
+
* data: {
|
|
523
|
+
* content: '## Markdown note\n\n**Lorem ipsum** dolor sit amet...',
|
|
524
|
+
* type: 'markdown'
|
|
525
|
+
* }
|
|
526
|
+
* },
|
|
527
|
+
* {
|
|
528
|
+
* id: 'text3',
|
|
529
|
+
* type: 'text',
|
|
530
|
+
* label: 'Internal note in HTML format',
|
|
531
|
+
* data: {
|
|
532
|
+
* content: '<h2>HTML note</h2><p>Lorem ipsum dolor sit amet...</p>',
|
|
533
|
+
* type: 'html'
|
|
534
|
+
* }
|
|
535
|
+
* },
|
|
536
|
+
* {
|
|
537
|
+
* id: 'text4',
|
|
538
|
+
* type: 'text',
|
|
539
|
+
* label: 'Internal note (fetched on demand)',
|
|
538
540
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
541
|
+
* // Note: Since `data` property is not provided, the content will be retrieved using the `getData()` callback (see below).
|
|
542
|
+
* // This, for instance, prevents fetching large resources along with the list of resources.
|
|
543
|
+
* },
|
|
544
|
+
*
|
|
545
|
+
* // URLs to resources in different formats
|
|
546
|
+
* {
|
|
547
|
+
* id: 'url1',
|
|
548
|
+
* type: 'web-resource',
|
|
549
|
+
* label: 'Blog post in Markdown',
|
|
550
|
+
* data: 'https://example.com/blog-post.md'
|
|
551
|
+
* },
|
|
552
|
+
* {
|
|
553
|
+
* id: 'url2',
|
|
554
|
+
* type: 'web-resource',
|
|
555
|
+
* label: 'Company brochure in PDF',
|
|
556
|
+
* data: 'https://example.com/brochure.pdf'
|
|
557
|
+
* },
|
|
558
|
+
* {
|
|
559
|
+
* id: 'url3',
|
|
560
|
+
* type: 'web-resource',
|
|
561
|
+
* label: 'Company website in HTML',
|
|
562
|
+
* data: 'https://example.com/index.html'
|
|
563
|
+
* },
|
|
564
|
+
* {
|
|
565
|
+
* id: 'url4',
|
|
566
|
+
* type: 'web-resource',
|
|
567
|
+
* label: 'Terms of service in plain text',
|
|
568
|
+
* data: 'https://example.com/terms-of-service.txt'
|
|
569
|
+
* },
|
|
570
|
+
*
|
|
571
|
+
* // ...
|
|
572
|
+
* ],
|
|
573
|
+
*
|
|
574
|
+
* // (Optional) Callback to retrieve the content of resources without `data` property provided by `getResources()` callback.
|
|
575
|
+
* // When the user picks a specific resource, the content will be fetched on demand (from database or external API) by this callback.
|
|
576
|
+
* // This prevents fetching large resources along with the list of resources.
|
|
577
|
+
* getData: async ( id ) => fetchDocumentContent( id )
|
|
578
|
+
* }
|
|
579
|
+
* ```
|
|
580
|
+
*/
|
|
579
581
|
export type AIContextProvider = {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
582
|
+
/**
|
|
583
|
+
* The unique identifier of the provider.
|
|
584
|
+
*/
|
|
585
|
+
id: string;
|
|
586
|
+
/**
|
|
587
|
+
* (Optional) The SVG string of the provider's icon. If not provided, a generic icon will be used instead.
|
|
588
|
+
*/
|
|
589
|
+
icon?: string;
|
|
590
|
+
/**
|
|
591
|
+
* The human-readable name of the provider.
|
|
592
|
+
*/
|
|
593
|
+
label: string;
|
|
594
|
+
/**
|
|
595
|
+
* Whether to use the built-in search filtering for resources returned by
|
|
596
|
+
* {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getResources}.
|
|
597
|
+
*/
|
|
598
|
+
useDefaultFiltering?: boolean;
|
|
599
|
+
/**
|
|
600
|
+
* The callback to retrieve the list of available resources. Usually involves fetching data from a database or an external API.
|
|
601
|
+
*/
|
|
602
|
+
getResources: (query?: string) => Promise<Array<AIContextResource>>;
|
|
603
|
+
/**
|
|
604
|
+
* The optional callback to retrieve the content of {@link module:ai/aichat/model/aichatcontext~AIContextResource resources}
|
|
605
|
+
* without `data` property provided by {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getResources} callback.
|
|
606
|
+
*
|
|
607
|
+
* It helps to prevent fetching large resources along with the list of resources.
|
|
608
|
+
*
|
|
609
|
+
* Usually involves fetching data from a database or an external API.
|
|
610
|
+
*/
|
|
611
|
+
getData?: (id: string) => Promise<string>;
|
|
610
612
|
};
|
|
611
613
|
/**
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
614
|
+
* An individual resource item within a {@link module:ai/aichat/model/aichatcontext~AIContextProvider}.
|
|
615
|
+
*
|
|
616
|
+
* Represents a single selectable item in the resources list displayed when a user clicks on a custom
|
|
617
|
+
* context menu option. The {@link module:ai/aichat/model/aichatcontext~AIContextResource#label} is displayed to the user as the
|
|
618
|
+
* resource name, and the {@link module:ai/aichat/model/aichatcontext~AIContextResource#type}
|
|
619
|
+
* indicates what kind of context item this represents (file, document, or URL).
|
|
620
|
+
*
|
|
621
|
+
* When selected, the resource will be attached to the AI prompt to provide additional context for
|
|
622
|
+
* generating responses. If the {@link module:ai/aichat/model/aichatcontext~AIContextResource#data} property is provided,
|
|
623
|
+
* it contains the content of the resource. If {@link module:ai/aichat/model/aichatcontext~AIContextResource#data} is `undefined`,
|
|
624
|
+
* the content will be retrieved using the {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getData} callback from the parent
|
|
625
|
+
* {@link module:ai/aichat/model/aichatcontext~AIContextProvider} when the resource is selected by the user.
|
|
626
|
+
*
|
|
627
|
+
* ```ts
|
|
628
|
+
* {
|
|
629
|
+
* id: 'user-guide-intro',
|
|
630
|
+
* type: 'text',
|
|
631
|
+
* label: 'User Guide - Introduction',
|
|
632
|
+
* data: {
|
|
633
|
+
* content: '<p>Lorem ipsum dolor sit amet...</p>',
|
|
634
|
+
* type: 'html'
|
|
635
|
+
* }
|
|
636
|
+
* }
|
|
637
|
+
* ```
|
|
638
|
+
*/
|
|
637
639
|
export type AIContextResource = {
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
640
|
+
/**
|
|
641
|
+
* The unique identifier of the resource.
|
|
642
|
+
*/
|
|
643
|
+
id: string;
|
|
644
|
+
/**
|
|
645
|
+
* The type of the resource.
|
|
646
|
+
*/
|
|
647
|
+
type: AIContextItemType;
|
|
648
|
+
/**
|
|
649
|
+
* The human-readable name of the resource.
|
|
650
|
+
*/
|
|
651
|
+
label: string;
|
|
652
|
+
/**
|
|
653
|
+
* The content of the resource.
|
|
654
|
+
*
|
|
655
|
+
* **Note**: When `undefined`, for instance, because the resource content is large and obtaining it should be done on demand,
|
|
656
|
+
* the content will be retrieved using the optional {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getData} callback
|
|
657
|
+
* from the parent {@link module:ai/aichat/model/aichatcontext~AIContextProvider} when the resource is selected by the user.
|
|
658
|
+
*
|
|
659
|
+
* **Note**: For the `'text'` {@link module:ai/aichat/model/aichatcontext~AIContextResource#type resource type}, `data` should be in the
|
|
660
|
+
* {@link module:ai/aichat/model/aichatcontext~AIContextTextResource} format.
|
|
661
|
+
*/
|
|
662
|
+
data?: string | File | AIContextTextResource;
|
|
661
663
|
};
|
|
662
664
|
/**
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
665
|
+
* A text resource that can be used as a context item. For instance:
|
|
666
|
+
*
|
|
667
|
+
* ```ts
|
|
668
|
+
* {
|
|
669
|
+
* content: '<h2>HTML note</h2><p>Lorem ipsum dolor sit amet...</p>',
|
|
670
|
+
* type: 'html'
|
|
671
|
+
* }
|
|
672
|
+
* ```
|
|
673
|
+
*/
|
|
672
674
|
export type AIContextTextResource = {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
675
|
+
/**
|
|
676
|
+
* The content of the text resource.
|
|
677
|
+
*/
|
|
678
|
+
content: string;
|
|
679
|
+
/**
|
|
680
|
+
* The type of the text resource.
|
|
681
|
+
*/
|
|
682
|
+
type: AIContextTextResourceType;
|
|
681
683
|
};
|
|
682
684
|
/**
|
|
683
|
-
|
|
684
|
-
|
|
685
|
+
* A custom item in the context menu, e.g. a button opening external file manager.
|
|
686
|
+
*/
|
|
685
687
|
export type AIContextCustomItem = {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
688
|
+
id: string;
|
|
689
|
+
label: string;
|
|
690
|
+
icon?: string;
|
|
691
|
+
callback: () => void;
|
|
690
692
|
};
|
|
691
|
-
export {};
|