generated from JetBrains/intellij-platform-plugin-template
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: init basic python prompter for context
- Loading branch information
Showing
6 changed files
with
104 additions
and
35 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
pycharm/src/main/kotlin/cc/unitmesh/ide/pycharm/provider/DjangoAutoDevFlow.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package cc.unitmesh.ide.pycharm.provider | ||
|
||
import cc.unitmesh.devti.context.DtClass | ||
import cc.unitmesh.devti.flow.kanban.Kanban | ||
import cc.unitmesh.devti.flow.model.TargetEndpoint | ||
import cc.unitmesh.devti.gui.chat.ChatCodingComponent | ||
import cc.unitmesh.devti.models.openai.OpenAIProvider | ||
import cc.unitmesh.devti.provider.DevFlowProvider | ||
import com.intellij.openapi.project.Project | ||
|
||
class DjangoAutoDevFlow : DevFlowProvider { | ||
override fun initContext( | ||
gitHubIssue: Kanban, | ||
openAIRunner: OpenAIProvider, | ||
contentPanel: ChatCodingComponent, | ||
project: Project | ||
) { | ||
} | ||
|
||
override fun getOrCreateStoryDetail(id: String): String { | ||
return "" | ||
} | ||
|
||
override fun updateOrCreateDtoAndEntity(storyDetail: String) {} | ||
override fun fetchSuggestEndpoint(storyDetail: String): TargetEndpoint { | ||
return TargetEndpoint("", DtClass("", listOf()), false) | ||
} | ||
|
||
override fun updateOrCreateEndpointCode(target: TargetEndpoint, storyDetail: String) {} | ||
override fun updateOrCreateServiceAndRepository() {} | ||
} |
37 changes: 37 additions & 0 deletions
37
pycharm/src/main/kotlin/cc/unitmesh/ide/pycharm/provider/PythonContextPrompter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package cc.unitmesh.ide.pycharm.provider | ||
|
||
import cc.unitmesh.devti.gui.chat.ChatBotActionType | ||
import cc.unitmesh.devti.provider.ContextPrompter | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.psi.PsiFile | ||
|
||
class PythonContextPrompter : ContextPrompter { | ||
private var action: ChatBotActionType? = null | ||
private var selectedText: String = "" | ||
private var file: PsiFile? = null | ||
private var project: Project? = null | ||
|
||
private val lang: String = file?.language?.displayName ?: "" | ||
override fun initContext(actionType: ChatBotActionType, prefixText: String, file: PsiFile?, project: Project) { | ||
this.action = actionType | ||
this.selectedText = prefixText | ||
this.file = file | ||
this.project = project | ||
} | ||
|
||
override fun getUIPrompt(): String { | ||
return """$action for the code: | ||
```${lang} | ||
$selectedText | ||
``` | ||
""".trimIndent() | ||
} | ||
|
||
override fun getRequestPrompt(): String { | ||
return """$action for the code: | ||
```${lang} | ||
$selectedText | ||
``` | ||
""".trimIndent() | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
pycharm/src/main/kotlin/cc/unitmesh/ide/pycharm/provider/PythonPromptStrategyAdvisor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package cc.unitmesh.ide.pycharm.provider | ||
|
||
import cc.unitmesh.devti.prompting.model.FinalCodePrompt | ||
import cc.unitmesh.devti.provider.PromptStrategy | ||
import com.intellij.psi.PsiElement | ||
|
||
class PythonPromptStrategyAdvisor : PromptStrategy { | ||
override fun advice(prefixCode: String, suffixCode: String): FinalCodePrompt { | ||
return FinalCodePrompt("", "") | ||
} | ||
|
||
override fun advice(psiFile: PsiElement, calleeName: String): FinalCodePrompt { | ||
return FinalCodePrompt("", "") | ||
} | ||
|
||
override fun advice(psiFile: PsiElement, usedMethod: List<String>, noExistMethods: List<String>): FinalCodePrompt { | ||
return FinalCodePrompt("", "") | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
pycharm/src/main/kotlin/cc/unitmesh/ide/pycharm/provider/PythonTechStackService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package cc.unitmesh.ide.pycharm.provider | ||
|
||
import cc.unitmesh.devti.prompting.model.TestStack | ||
import cc.unitmesh.devti.provider.TechStackProvider | ||
|
||
class PythonTechStackService : TechStackProvider { | ||
override fun prepareLibrary(): TestStack { | ||
return TestStack() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
<idea-plugin package="cc.unitmesh.ide.pycharm"> | ||
<extensions defaultExtensionNs="cc.unitmesh"> | ||
|
||
<contextPrompter implementation="cc.unitmesh.ide.pycharm.provider.PythonContextPrompter"/> | ||
<techStackProvider implementation="cc.unitmesh.ide.pycharm.provider.PythonTechStackService"/> | ||
<devFlowProvider implementation="cc.unitmesh.ide.pycharm.provider.DjangoAutoDevFlow"/> | ||
<promptStrategy implementation="cc.unitmesh.ide.pycharm.provider.PythonPromptStrategyAdvisor"/> | ||
</extensions> | ||
</idea-plugin> |
35 changes: 0 additions & 35 deletions
35
src/main/kotlin/cc/unitmesh/devti/gui/chat/IntentionContextPrompter.kt
This file was deleted.
Oops, something went wrong.