-
Notifications
You must be signed in to change notification settings - Fork 220
TINYDOC-3570: New option tinymceai_chat_default_sources to allow specifying predefined sources as chat default context.
#4306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/8.9/TINYDOC-3570
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -71,6 +71,23 @@ The {productname} {release-version} release includes an accompanying release of | |||||
|
|
||||||
| For information on the **<Premium plugin name 1>** plugin, see: xref:<plugincode>.adoc[<Premium plugin name 1>]. | ||||||
|
|
||||||
| === TinyMCE AI | ||||||
|
|
||||||
| The {productname} {release-version} release includes an accompanying release of the **TinyMCE AI** premium plugin. | ||||||
|
|
||||||
| **TinyMCE AI** includes the following addition. | ||||||
|
|
||||||
| ==== New option `tinymceai_chat_default_sources` to allow specifying predefined sources as chat default context. | ||||||
| // #TINYMCE-14703 | ||||||
|
|
||||||
| Previously, the **TinyMCE AI** plugin applied only the current document to the context of a new AI Chat conversation. Users had to add every other context source, such as a style guide or a reference document, to each new conversation by hand. | ||||||
|
|
||||||
| In {productname} {release-version}, the **TinyMCE AI** plugin supports the xref:tinymceai.adoc#tinymceai_chat_default_sources[`+tinymceai_chat_default_sources+`] option. The option accepts an array of source identifiers taken from the list supplied by xref:tinymceai.adoc#tinymceai_chat_fetch_sources[`+tinymceai_chat_fetch_sources+`], and the plugin applies those sources to the context of every new conversation. Users can remove a default source from a conversation and add it again from the sources menu. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| For details on configuring conversation context, see xref:tinymceai-chat.adoc#context-configuration[Adding custom context sources]. | ||||||
|
|
||||||
| For information on the **TinyMCE AI** plugin, see: xref:tinymceai.adoc[TinyMCE AI]. | ||||||
|
|
||||||
|
|
||||||
| [[accompanying-premium-plugin-end-of-life-announcement]] | ||||||
| == Accompanying Premium plugin end-of-life announcement | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -252,6 +252,50 @@ tinymce.init({ | |||||
| }); | ||||||
| ---- | ||||||
|
|
||||||
| [[tinymceai_chat_default_sources]] | ||||||
| === `+tinymceai_chat_default_sources+` | ||||||
|
|
||||||
| Adds one or more sources to the context of every new chat conversation, alongside the current document. Without this option, users add each source to a conversation themselves. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| Takes an array of source identifiers. Each identifier is the `+id+` of a source supplied by xref:tinymceai.adoc#tinymceai_chat_fetch_sources[`tinymceai_chat_fetch_sources`], and the content of each source is loaded through xref:tinymceai.adoc#tinymceai_chat_fetch_source[`tinymceai_chat_fetch_source`]. Identifiers that do not match a supplied source are ignored. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| Users can remove a default source from a conversation and add it again from the sources menu. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| *Type:* `+Array+` (`+string[]+`) | ||||||
|
|
||||||
| *Default value:* `+[]+` | ||||||
|
|
||||||
| .Example | ||||||
| [source,js] | ||||||
| ---- | ||||||
| tinymce.init({ | ||||||
| selector: 'textarea', | ||||||
| plugins: 'tinymceai', | ||||||
| toolbar: 'tinymceai-chat tinymceai-quickactions tinymceai-review', | ||||||
| tinymceai_chat_fetch_sources: async () => [ | ||||||
| { | ||||||
| label: 'My Documents', | ||||||
| icon: 'folder', | ||||||
| sources: [ | ||||||
| { id: 'doc-1', label: 'Style guide', type: 'file' }, | ||||||
| { id: 'doc-2', label: 'Document 2', type: 'file' } | ||||||
| ] | ||||||
| } | ||||||
| ], | ||||||
| tinymceai_chat_fetch_source: async (id) => { | ||||||
| const res = await fetch(`/api/documents/\$\{id\}`); | ||||||
| const blob = await res.blob(); | ||||||
| const filename = `\$\{id\}.pdf`; | ||||||
| return { type: 'file', file: new File([blob], filename, { type: blob.type }) }; | ||||||
| }, | ||||||
| tinymceai_chat_default_sources: [ 'doc-1' ], | ||||||
| // Required for authentication | ||||||
| tinymceai_token_provider: () => { | ||||||
| return fetch('/api/token').then(r => r.json()); | ||||||
| } | ||||||
| }); | ||||||
| ---- | ||||||
|
|
||||||
| [[tinymceai_chat_welcome_message]] | ||||||
| === `+tinymceai_chat_welcome_message+` | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.