Perplex.AI.ContentBuddy
0.4.1
dotnet add package Perplex.AI.ContentBuddy --version 0.4.1
NuGet\Install-Package Perplex.AI.ContentBuddy -Version 0.4.1
<PackageReference Include="Perplex.AI.ContentBuddy" Version="0.4.1" />
paket add Perplex.AI.ContentBuddy --version 0.4.1
#r "nuget: Perplex.AI.ContentBuddy, 0.4.1"
// Install Perplex.AI.ContentBuddy as a Cake Addin #addin nuget:?package=Perplex.AI.ContentBuddy&version=0.4.1 // Install Perplex.AI.ContentBuddy as a Cake Tool #tool nuget:?package=Perplex.AI.ContentBuddy&version=0.4.1
Perplex.AI.ContentBuddy
Manage and submit AI prompts directly from the Umbraco backoffice.
Configuration
The package can be configured in appsettings.json
at key "Perplex_AI_ContentBuddy"
.
Note we use underscores (_
) rather than dots (.
) because Azure does not support setting configuration values with dots in them.
// appsettings.json:
"Perplex_AI_ContentBuddy": {
"OpenAI": {
// https://platform.openai.com/api-keys
"SecretKey": "<your OpenAI secret key>",
// https://platform.openai.com/docs/models
"Model": "<GPT model to use>", // Default: gpt-4o-mini
// https://platform.openai.com/docs/api-reference/assistants/createAssistant#assistants-createassistant-top_p
"TopP": "<between 0 and 1>" // Default: 0.5
},
"UI": {
// Determines for which properties to show/hide the UI
"VisibilityRules": [
{
"Action": "show|hide",
// If ommitted: all document types
"DocumentType": "<document type alias>",
// If ommitted: all properties
"Properties": ["<property alias 1>", "<property alias 2>", "..."],
// If ommitted: all property editors
"PropertyEditors": ["<property editor alias 1>", "<property editor alias 2>", "..."]
}
]
}
}
Perplex_AI_ContentBuddy:OpenAI:SecretKey
You will have to provide your own secret key for use with OpenAI's API. An API key can created in your account at https://platform.openai.com/account/api-keys.
Perplex_AI_ContentBuddy:UI
The VisibilityRules
setting allows granular control over when to show the ContentBuddy UI on a property which is used to manage and submit prompts.
By default the UI is shown by default on all property editors of these types:
- Umbraco.TextBox
- Umbraco.TextArea
- Umbraco.TinyMCE
That is, VisibilityRules
starts like this:
[
{
"Action": "show",
"PropertyEditors": [
"Umbraco.TextBox",
"Umbraco.TextArea",
"Umbraco.TinyMCE"
]
}
]
Rules are applied in the specified order to all properties.
Within a rule, all the specific types (DocumentType, Properties, PropertyEditors) must match.
If ommitted it will match everything (e.g. a rule without DocumentType
specified will match all document types).
You can also use the special value "*"
to match everything if you want to be explicit.
Any rules you add will apply after the default rule specified above.
For example, to only show the UI on the title
property of the Page
document type and the title
+ text
properties of the Blog
document type you can use this:
"VisibilityRules": [
{
// Clear the defaults by hiding everything
"Action": "hide"
},
// Then show the UI on the desired properties only
{
"Action": "show",
"DocumentType": "page",
"Properties": ["title"]
},
{
"Action": "show",
"DocumentType": "blog",
"Properties": ["title", "text"]
}
]
Similarly if you want to hide the UI on all properties of the Settings
document type you can use:
"VisibilityRules": [
{
"Action": "hide",
"DocumentType": "settings"
}
]
Supported Property Editors
Out of the box only these editors are supported:
- Umbraco.TextBox
- Umbraco.TextArea
- Umbraco.TinyMCE
Note that these properties can either be used directly on a document type or within any of these complex editors:
- Umbraco.BlockList
- Umbraco.NestedContent
- Perplex.ContentBlocks
- Install
Perplex.AI.ContentBuddy.ContentBlocks
to support this editor
- Install
In general any plain text editor will work if its value can be set from AngularJS using $scope.model.value = <value>
.
Any custom editors can be added to Perplex_AI_ContentBuddy:UI:VisibilityRules
.
The default property editors listed above will always be implicitly added to VisibilityRules
, there is no need to repeat them when you want to add a custom editor.
For example, if you want to have the UI show up for a property editor My.Custom.Editor
in addition to the default property editors, use this:
"VisibilityRules": [
{
"Action": "show",
"PropertyEditors": [ "My.Custom.Editor" ]
}
]
If you want to remove the UI from some of the default property editors, you can do so as well.
For example, to no longer show the UI on Umbraco.TextBox
(but keep it on Umbraco.TextArea
+ Umbraco.TinyMCE
):
"VisibilityRules": [
{
"Action": "hide",
"PropertyEditors": [ "Umbraco.TextBox" ]
}
]
Magic Strings
In the prompts you can use Magic Strings to reference various contextual values to use in your prompt.
The format of a magic string is [#magic-string-name]
Below is a list of current Magic Strings:
Name | Description |
---|---|
this.value | The value of the current property |
page.props.<alias> | The value of the property with alias "alias" in the current culture, e.g. page.props.title |
page.text | All text content of the last version (saved or published) of the page from the rendered front-end HTML |
page.url | The URL of the page or image |
page.props.<alias>.base64 | At the moment only available on Media items. If the the property with alias "alias" is an Umbraco.ImageCropper the base64 data of the image will be available in this variable. For default Umbraco installations, this will be page.props.umbracoFile.base64 . If used in the prompt it will be sent to OpenAI as an attached image |
Examples
Some examples of prompts are listed below.
- Request AI to write the meta title of a page for you based on the rendered text in the front-end:
- "Create a meta title based on this content, using at most 70 characters: [#page.text]"
- Let AI generate an alt text based on a Media item:
- "Generate an alt text for the attached image. Use at most 100 characters. [#page.props.umbracoFile.base64]"
- Rewrite an RTE text using simpler language
- "Rewrite this text using simpler language: [#this.value]"
- Create a summary of another property. The other property has alias
rte
in this example.- "Write a title for this text: [#page.props.rte]"
License
You can create 3 prompts without a license. If you want to define more prompts you will need to purchase a license. This license is tied to all the domains of one project. Make sure to include all dev/test/acceptance domain names when requesting a license, e.g. localhost
+ dev.mysite.com
+ tst.mysite.com
+ acc.mysite.com
+ mysite.com
.
The license file Perplex.AI.ContentBuddy.license
should be placed in the root of your website, i.e. in the same directory as appsettings.json
.
Make sure the license is deployed alongside your website files. A simple way to achieve this is by adding this to your project's .csproj
file. This assumes the file Perplex.AI.ContentBuddy.license
is in your project root directory.
<ItemGroup>
<None Include="Perplex.AI.ContentBuddy.license" CopyToPublishDirectory="Always" />
</ItemGroup>
Debug log
To log the system message + user message + AI response in the log set the log level to Debug.
You can view the log in Umbraco at Settings > Log Viewer.
// appsettings.json
{
"Serilog": {
"MinimumLevel": {
"Override": {
"Perplex.AI.ContentBuddy": "Debug"
}
}
}
}
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Perplex.AI.ContentBuddy.Core (>= 0.4.1)
- Perplex.AI.ContentBuddy.StaticAssets (>= 0.4.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.4.1 | 46 | 2/28/2025 |