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