Skip to content

Commit 2e2e91b

Browse files
committed
refactor(template): refactor TeamPromptTemplateCompiler to VariableTemplateCompiler
The TeamPromptTemplateCompiler has been refactored to VariableTemplateCompiler to better reflect its functionality and to avoid confusion with the team-specific context. The refactoring includes a change in the import statements and the package name, as well as a modification to the class name and the initialization of the context class loader.
1 parent 7e381f0 commit 2e2e91b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/main/kotlin/cc/unitmesh/devti/custom/TeamPromptBaseIntention.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package cc.unitmesh.devti.custom
22

33
import cc.unitmesh.devti.custom.team.TeamPromptAction
44
import cc.unitmesh.devti.custom.team.TeamPromptExecTask
5-
import cc.unitmesh.devti.custom.team.TeamPromptTemplateCompiler
5+
import cc.unitmesh.devti.custom.variable.VariableTemplateCompiler
66
import cc.unitmesh.devti.gui.chat.ChatActionType
77
import cc.unitmesh.devti.intentions.action.base.ChatBaseIntention
88
import com.intellij.openapi.editor.Editor
@@ -42,7 +42,7 @@ class TeamPromptBaseIntention(val intentionConfig: TeamPromptAction, val trySele
4242
elementPair?.second
4343
}
4444

45-
val compiler = TeamPromptTemplateCompiler(language, file, element, editor, elementPair?.first ?: "")
45+
val compiler = VariableTemplateCompiler(language, file, element, editor, elementPair?.first ?: "")
4646

4747
val chatMessages = intentionConfig.actionPrompt.msgs
4848
val msgs = chatMessages.map {

src/main/kotlin/cc/unitmesh/devti/custom/team/TeamPromptTemplateCompiler.kt renamed to src/main/kotlin/cc/unitmesh/devti/custom/variable/VariableTemplateCompiler.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package cc.unitmesh.devti.custom.team
1+
package cc.unitmesh.devti.custom.variable
22

3-
import cc.unitmesh.devti.custom.variable.CustomVariable
3+
import cc.unitmesh.devti.custom.team.DefaultTeamContextProvider
44
import cc.unitmesh.devti.gui.chat.ChatActionType
55
import cc.unitmesh.devti.provider.context.ChatContextProvider
66
import cc.unitmesh.devti.provider.context.ChatCreationContext
@@ -16,14 +16,14 @@ import org.apache.velocity.VelocityContext
1616
import org.apache.velocity.app.Velocity
1717
import java.io.StringWriter
1818

19-
class TeamPromptTemplateCompiler(
19+
class VariableTemplateCompiler(
2020
val language: Language,
2121
val file: PsiFile,
2222
val element: PsiElement?,
2323
val editor: Editor,
2424
val selectedText: String = "",
2525
) {
26-
private val log = logger<TeamPromptTemplateCompiler>()
26+
private val log = logger<VariableTemplateCompiler>()
2727
private val velocityContext = VelocityContext()
2828

2929
init {
@@ -50,7 +50,7 @@ class TeamPromptTemplateCompiler(
5050
configForFramework()
5151

5252
val oldContextClassLoader = Thread.currentThread().getContextClassLoader()
53-
Thread.currentThread().setContextClassLoader(TeamPromptTemplateCompiler::class.java.getClassLoader())
53+
Thread.currentThread().setContextClassLoader(VariableTemplateCompiler::class.java.getClassLoader())
5454

5555
val sw = StringWriter()
5656
try {

0 commit comments

Comments
 (0)