Skip to content

Commit

Permalink
feat(flow): add support for custom flows #109
Browse files Browse the repository at this point in the history
Added a new method to retrieve custom prompt files from the "flows" directory in the prompts directory. The method searches for ".devin" files and returns the list of custom prompt files.
  • Loading branch information
phodal committed Mar 20, 2024
1 parent a6a04ce commit 4bd0b56
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -14,8 +14,8 @@ class TeamPromptsBuilder(private val project: Project) {

fun default(): List<TeamPromptAction> {
val promptsDir = project.guessProjectDir()?.findChild(baseDir) ?: return emptyList()

val filterPrompts = promptsDir.children.filter { it.name.endsWith(".vm") }

return buildPrompts(filterPrompts)
}

Expand All @@ -27,6 +27,14 @@ class TeamPromptsBuilder(private val project: Project) {
return buildPrompts(quickPromptFiles)
}

fun flows(): List<VirtualFile> {
val promptsDir = project.guessProjectDir()?.findChild(baseDir) ?: return emptyList()
val customPromptDir = promptsDir.findChild("flows") ?: return emptyList()
val customPromptFiles = customPromptDir.children.filter { it.name.endsWith(".devin") }

return customPromptFiles
}

private fun buildPrompts(prompts: List<VirtualFile>): List<TeamPromptAction> {
return prompts.map {
// a prompt should be named as <actionName>.vm, and we need to replace - with " "
Expand Down

0 comments on commit 4bd0b56

Please sign in to comment.