Skip to content

Commit

Permalink
refactor(editor): remove unused imports and variables
Browse files Browse the repository at this point in the history
Update PromptCompiler.ts by eliminating unused imports and variables for cleaner code. This includes removing the SourceType import and unused state variable, as well as converting let to const for variables that are not reassigned.
  • Loading branch information
phodal committed Oct 9, 2024
1 parent 6770fe7 commit f7f43bc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions web/core/lib/editor/action/PromptCompiler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeForm, DefinedVariable, PromptAction, SourceType } from "@/editor/defs/custom-action.type";
import { ChangeForm, DefinedVariable, PromptAction } from "@/editor/defs/custom-action.type";
import { Editor, Range } from "@tiptap/core";
import { Selection } from "prosemirror-state";
import { PromptsManager } from "@/editor/prompts/prompts-manager";
Expand All @@ -14,7 +14,7 @@ export class PromptCompiler {

compile() {
const promptManager = PromptsManager.getInstance();
let state = this.editor.state;
const state = this.editor.state;

const range = actionPosition(this.action, state.selection);
const selection = state.doc.textBetween(range.from, range.to);
Expand All @@ -23,15 +23,15 @@ export class PromptCompiler {
const all = this.editor.getText();
let title = '';

state.doc.descendants((node, pos) => {
state.doc.descendants((node) => {
if (node.type.name === 'heading' && node.attrs.level === 1) {
title = node.textContent;
}
});

const similarChunks = "";

let context = {
const context = {
[DefinedVariable.BEFORE_CURSOR]: beforeCursor,
[DefinedVariable.AFTER_CURSOR]: afterCursor,
[DefinedVariable.SELECTION]: selection,
Expand Down

0 comments on commit f7f43bc

Please sign in to comment.