Closed gtraxx closed 5 months ago
Hi, can you provide the config without the api key? Are you using tiny 5/6/7 ? Best,
@murdercode Hi here is my modified script for the beginning, the rest is the original one. TinyMCE v 6.7.2
tinymce.PluginManager.add('chatgpt', function (editor) {
const OPENAI = editor.getParam('openai')
var prompts = [
"Translate from English to Italian",
"Summarize",
"Proofread",
"Write a blog post about",
]
var apiKey = "sk-****";
var model= "text-davinci-003";
var temperature= 0.5;
var maxTokens= 150;
const openDialog = function () {`
I was actually referring to the configuration, as per the README (https://github.com/The-3Labs-Team/tinymce-chatgpt-plugin?tab=readme-ov-file#installation). Was it followed correctly? That error says it can't find the configuration parameters, that is, at the time you instantiate the editor.
What you have done I understand is to modify the plugin to force the creation of the variables, but they are taken directly from init.
@murdercode I deleted my variables and placed the following code in the config, but I got exactly the same error. As it is internal and not external, I declared the plugin in the plugin table in addition to toolbar. Is it because of the model or something else ?
chatgpt: {
apiKey: "sk-******", // Your OpenAI API key
model: "text-davinci-003",
temperature: 0.5,
maxTokens: 150,
prompts: [
"Translate from English to Italian",
"Summarize",
"Proofread",
"Write a blog post about",
],
},
I think i've solved it, you can rename the tinymce param "chatgpt" which contains the prompts by "openai" :
external_plugins: {
chatgpt:
'https://cdn.jsdelivr.net/gh/The-3Labs-Team/tinymce-chatgpt-plugin@1/dist/chatgpt.min.js'
},
openai: {
apiKey: 'sk-***', // OpenAI API key
model: 'text-davinci-003',
temperature: 0.5,
maxTokens: 150,
prompts: [
//
]
}
I think i've solved it, you can rename the tinymce param "chatgpt" which contains the prompts by "openai" :
external_plugins: { chatgpt: 'https://cdn.jsdelivr.net/gh/The-3Labs-Team/tinymce-chatgpt-plugin@1/dist/chatgpt.min.js' }, openai: { apiKey: 'sk-***', // OpenAI API key model: 'text-davinci-003', temperature: 0.5, maxTokens: 150, prompts: [ // ] }
Hi, Thanks, have you tested the plugin locally? My goal is to not use "external_plugins" and to be able to put a key in an (external) js variable :)
Best Regards :)
I think i've solved it, you can rename the tinymce param "chatgpt" which contains the prompts by "openai" :
external_plugins: { chatgpt: 'https://cdn.jsdelivr.net/gh/The-3Labs-Team/tinymce-chatgpt-plugin@1/dist/chatgpt.min.js' }, openai: { apiKey: 'sk-***', // OpenAI API key model: 'text-davinci-003', temperature: 0.5, maxTokens: 150, prompts: [ // ] }
Nice catch, it was a typo in JS config :) Readme is fixed now 👍
I think i've solved it, you can rename the tinymce param "chatgpt" which contains the prompts by "openai" :
external_plugins: { chatgpt: 'https://cdn.jsdelivr.net/gh/The-3Labs-Team/tinymce-chatgpt-plugin@1/dist/chatgpt.min.js' }, openai: { apiKey: 'sk-***', // OpenAI API key model: 'text-davinci-003', temperature: 0.5, maxTokens: 150, prompts: [ // ] }
Hi, Thanks, have you tested the plugin locally? My goal is to not use "external_plugins" and to be able to put a key in an (external) js variable :)
Best Regards :)
The plugin as it stands reads the variable from the env, if you need to put it out you should fork the project, it is not meant to have this support.
May I ask what benefit you would get? Just to consider whether you should apply a new behaviour, but in case I ask you to create a new issue, let's discuss it there :)
Bye :)
Hi, I tested your plugin as an internal plugin but impossible to make it work (same with the version presented)
Best Regards Aurélien