Skip to content

Commit

Permalink
refactor: rename for function names
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 2, 2023
1 parent a226c5e commit 5185028
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Editor } from "@tiptap/core";
import { ChangeForm, OutputForm, PromptAction } from "@/components/editor/defs/custom-action.type";
import { ActionExecutor, actionPosition } from "@/components/editor/action/ActionExecutor";
import { PromptCompiler, actionPosition } from "@/components/editor/action/PromptCompiler";

// @ts-ignore
import { MarkdownParser } from "node_modules/tiptap-markdown/src/parse/MarkdownParser";

export class AiActionHandler {
export class AiActionExecutor {
private readonly editor: Editor;

constructor(editor: Editor) {
Expand Down Expand Up @@ -93,7 +93,8 @@ export class AiActionHandler {
}

public async execute(action: PromptAction) {
const actionExecutor = new ActionExecutor(action, this.editor);
// builtinFunction
const actionExecutor = new PromptCompiler(action, this.editor);
actionExecutor.compile();

let prompt = action.compiledTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Editor, Range } from "@tiptap/core";
import { Selection } from "prosemirror-state";
import { PromptsManager } from "@/components/editor/prompts/prompts-manager";

export class ActionExecutor {
export class PromptCompiler {
private action: PromptAction;
private editor: Editor;

Expand Down
4 changes: 2 additions & 2 deletions editor/src/components/editor/action/custom-editor-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Transaction } from "prosemirror-state";
import { DefinedVariable, FacetType, OutputForm, PromptAction, } from "@/components/editor/defs/custom-action.type";
import { PromptsManager } from "@/components/editor/prompts/prompts-manager";
import { ARTICLE_TYPE_OPTIONS, TypeOptions } from "@/components/editor/defs/type-options.type";
import { AiActionHandler } from "@/components/editor/action/AiActionHandler";
import { AiActionExecutor } from "@/components/editor/action/AiActionExecutor";

declare module "@tiptap/core" {
interface Commands<ReturnType> {
Expand Down Expand Up @@ -55,7 +55,7 @@ export const CustomEditorCommands = Extension.create({
callLlm:
(action: PromptAction) =>
async ({ tr, commands, editor }: { tr: Transaction; commands: Commands, editor: Editor }) => {
let actionHandler = new AiActionHandler(editor);
let actionHandler = new AiActionExecutor(editor);
return await actionHandler.execute(action)
},
getAiActions:
Expand Down

0 comments on commit 5185028

Please sign in to comment.