Skip to content
Snippets Groups Projects
Commit a2c32781 authored by chris's avatar chris
Browse files

rename method

parent 75a2cda5
No related branches found
No related tags found
1 merge request!466Chatgpt demo
......@@ -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,
......
......@@ -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,
);
......
......@@ -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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment