From a2c32781433a94962e43ff72633b2c9e8c606c3b Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Thu, 16 Mar 2023 18:18:13 +0200 Subject: [PATCH] rename method --- editors/demo/src/HHMI/config/config.js | 6 +++--- .../src/AnyStyleService/AnyStyleTool.js | 3 ++- wax-prosemirror-services/src/AnyStyleService/replaceText.js | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/editors/demo/src/HHMI/config/config.js b/editors/demo/src/HHMI/config/config.js index 51441eab0..2d3edda9e 100644 --- a/editors/demo/src/HHMI/config/config.js +++ b/editors/demo/src/HHMI/config/config.js @@ -29,7 +29,7 @@ import { DefaultSchema } from 'wax-prosemirror-core'; import invisibles, { hardBreak } from '@guardian/prosemirror-invisibles'; const API_KEY = ''; -async function AnyStyleTransformation(prompt) { +async function ExternalAPIContentTransformation(prompt) { const response = await fetch('https://api.openai.com/v1/chat/completions', { method: 'POST', headers: { @@ -62,7 +62,7 @@ async function AnyStyleTransformation(prompt) { return prompt; } -// async function AnyStyleTransformation(prompt) { +// async function ExternalAPIContentTransformation(prompt) { // const response = await fetch('https://api.openai.com/v1/completions', { // method: 'POST', // headers: { @@ -126,7 +126,7 @@ export default { }, ], AnyStyleService: { - AnyStyleTransformation: AnyStyleTransformation, + ExternalAPIContentTransformation: ExternalAPIContentTransformation, }, SchemaService: DefaultSchema, diff --git a/wax-prosemirror-services/src/AnyStyleService/AnyStyleTool.js b/wax-prosemirror-services/src/AnyStyleService/AnyStyleTool.js index d070dd0cf..619646470 100644 --- a/wax-prosemirror-services/src/AnyStyleService/AnyStyleTool.js +++ b/wax-prosemirror-services/src/AnyStyleService/AnyStyleTool.js @@ -31,7 +31,8 @@ class AnyStyleTool extends Tools { const context = useContext(WaxContext); const anyStyle = replaceText( view, - this.config.get('config.AnyStyleService').AnyStyleTransformation, + this.config.get('config.AnyStyleService') + .ExternalAPIContentTransformation, this.pmplugins.get('anyStylePlaceHolder'), context, ); diff --git a/wax-prosemirror-services/src/AnyStyleService/replaceText.js b/wax-prosemirror-services/src/AnyStyleService/replaceText.js index 20b258fdd..e54ae8af2 100644 --- a/wax-prosemirror-services/src/AnyStyleService/replaceText.js +++ b/wax-prosemirror-services/src/AnyStyleService/replaceText.js @@ -15,7 +15,7 @@ const elementFromString = string => { export default ( view, - AnyStyleTransformation, + ExternalAPIContentTransformation, placeholderPlugin, context, ) => data => { @@ -33,7 +33,7 @@ export default ( view.dispatch(tr); - AnyStyleTransformation(data).then( + ExternalAPIContentTransformation(data).then( text => { const pos = findPlaceholder(view.state, id, placeholderPlugin); // If the content around the placeholder has been deleted, drop -- GitLab