Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
acharneski committed Dec 12, 2024
1 parent e6e69dd commit 302c6f5
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ open class PlanChatApp(
val planSettings = (getSettings(session, user, PlanSettings::class.java) ?: PlanSettings(
defaultModel = model,
parsingModel = parsingModel,
command = planSettings.command,
shellCmd = planSettings.shellCmd,
temperature = planSettings.temperature,
workingDir = planSettings.workingDir,
env = planSettings.env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class GitHubSearchTask(
) : AbstractTask<GitHubSearchTask.GitHubSearchTaskConfigData>(planSettings, planTask) {
class GitHubSearchTaskConfigData(
@Description("The search query to use for GitHub search")
val search_query: String,
val search_query: String = "",
@Description("The type of GitHub search to perform (code, commits, issues, repositories, topics, users)")
val search_type: String,
val search_type: String = "repositories",
@Description("The number of results to return (max 100)")
val per_page: Int = 30,
@Description("Sort order for results")
Expand Down Expand Up @@ -64,11 +64,18 @@ GitHubSearch - Search GitHub for code, commits, issues, repositories, topics, or

private fun performGitHubSearch(planSettings: PlanSettings): String {
val client = HttpClient.newBuilder().build()
val uriBuilder = StringBuilder("https://api.github.com/search/${taskConfig?.search_type}?q=${taskConfig?.search_query}&per_page=${taskConfig?.per_page}")
taskConfig?.sort?.let { uriBuilder.append("&sort=$it") }
taskConfig?.order?.let { uriBuilder.append("&order=$it") }
val uriBuilder = URI("https://api.github.com")
.resolve("/search/${taskConfig?.search_type}")
.toURL()
.toString()
val queryParams = mutableListOf<String>()
queryParams.add("q=${java.net.URLEncoder.encode(taskConfig?.search_query ?: "", "UTF-8")}")
queryParams.add("per_page=${taskConfig?.per_page}")
taskConfig?.sort?.let { queryParams.add("sort=${java.net.URLEncoder.encode(it, "UTF-8")}") }
taskConfig?.order?.let { queryParams.add("order=${java.net.URLEncoder.encode(it, "UTF-8")}") }
val finalUrl = "$uriBuilder?${queryParams.joinToString("&")}"
val request = HttpRequest.newBuilder()
.uri(URI.create(uriBuilder.toString()))
.uri(URI.create(finalUrl))
.header("Accept", "application/vnd.github+json")
.header("Authorization", "Bearer ${planSettings.githubToken}")
.header("X-GitHub-Api-Version", "2022-11-28")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class GoogleSearchTask(
) : AbstractTask<GoogleSearchTask.GoogleSearchTaskConfigData>(planSettings, planTask) {
class GoogleSearchTaskConfigData(
@Description("The search query to use for Google search")
val search_query: String,
val search_query: String = "",
@Description("The number of results to return (max 10)")
val num_results: Int = 5,
task_description: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import com.simiacryptus.skyenet.core.actors.ParsedActor
open class PlanSettings(
var defaultModel: ChatModel,
var parsingModel: ChatModel,
val command: List<String> = listOf(if (isWindows) "powershell" else "bash"),
val shellCmd: List<String> = listOf(if (isWindows) "powershell" else "bash"),
var temperature: Double = 0.2,
val budget: Double = 2.0,
val taskSettings: MutableMap<String, TaskSettingsBase> = TaskType.values().associateWith { taskType ->
Expand Down Expand Up @@ -47,7 +47,7 @@ open class PlanSettings(
fun copy(
model: ChatModel = this.defaultModel,
parsingModel: ChatModel = this.parsingModel,
command: List<String> = this.command,
command: List<String> = this.shellCmd,
temperature: Double = this.temperature,
budget: Double = this.budget,
taskSettings: MutableMap<String, TaskSettingsBase> = this.taskSettings,
Expand All @@ -59,7 +59,7 @@ open class PlanSettings(
) = PlanSettings(
defaultModel = model,
parsingModel = parsingModel,
command = command,
shellCmd = command,
temperature = temperature,
budget = budget,
taskSettings = taskSettings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Note: This task is for running simple and safe commands. Avoid executing command
planSettings.workingDir
).absolutePath),
"language" to (planSettings.language ?: "bash"),
"command" to (planTask?.command ?: planSettings.command),
"command" to (planSettings.shellCmd),
),
model = planSettings.getTaskSettings(TaskType.valueOf(planTask?.task_type!!)).model
?: planSettings.defaultModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ class CodeOptimizationTask(
) : AbstractAnalysisTask<CodeOptimizationTaskConfigData>(planSettings, planTask) {

class CodeOptimizationTaskConfigData(
@Description("Files to be optimized")
val filesToOptimize: List<String>? = null,
@Description("Specific areas of focus for the optimization")
val optimizationFocus: List<String>? = null,
task_description: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ class CodeReviewTask(
planTask: CodeReviewTaskConfigData?
) : AbstractAnalysisTask<CodeReviewTaskConfigData>(planSettings, planTask) {
class CodeReviewTaskConfigData(
@Description("List of files to be reviewed")
val filesToReview: List<String>? = null,
@Description("Specific areas of focus for the review (optional)")
val focusAreas: List<String>? = null,
task_description: String? = null,
Expand Down Expand Up @@ -44,7 +42,7 @@ class CodeReviewTask(
""".trimIndent()

override fun getAnalysisInstruction(): String {
val filesToReview = taskConfig?.filesToReview?.joinToString(", ") ?: "all provided files"
val filesToReview = taskConfig?.input_files?.joinToString(", ") ?: "all provided files"
val focusAreas = taskConfig?.focusAreas?.joinToString(", ")
return "Review the following code files: $filesToReview" +
if (focusAreas != null) ". Focus on these areas: $focusAreas" else ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ class PerformanceAnalysisTask(
planTask: PerformanceAnalysisTaskConfigData?
) : AbstractAnalysisTask<PerformanceAnalysisTaskConfigData>(planSettings, planTask) {
class PerformanceAnalysisTaskConfigData(
@Description("Files to be analyzed for performance issues")
val files_to_analyze: List<String>? = null,
@Description("Specific areas of focus for the analysis (e.g., time complexity, memory usage, I/O operations)")
val analysis_focus: List<String>? = null,
task_description: String? = null,
Expand Down Expand Up @@ -56,7 +54,7 @@ PerformanceAnalysis - Analyze code for performance issues and suggest improvemen
}

fun getFiles(): List<String> {
return taskConfig?.files_to_analyze ?: emptyList()
return taskConfig?.input_files ?: emptyList()
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ class RefactorTask(
planTask: RefactorTaskConfigData?
) : AbstractAnalysisTask<RefactorTaskConfigData>(planSettings, planTask) {
class RefactorTaskConfigData(
@Description("List of files to be refactored")
val filesToRefactor: List<String>? = null,
@Description("Specific areas of focus for the refactoring (e.g., modularity, design patterns, naming conventions)")
val refactoringFocus: List<String>? = null,
task_description: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ class SecurityAuditTask(


class SecurityAuditTaskConfigData(
@Description("List of files to be audited")
val filesToAudit: List<String>? = null,
@Description("Specific areas of focus for the security audit")
val focusAreas: List<String>? = null,
task_description: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ class TestGenerationTask(
) : AbstractAnalysisTask<TestGenerationTaskConfigData>(planSettings, planTask) {

class TestGenerationTaskConfigData(
@Description("List of files for which tests should be generated")
val filesToTest: List<String>? = null,
@Description("List of input files or tasks to be examined when generating tests")
val inputReferences: List<String>? = null,
task_description: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ object ActorTestAppServer : com.simiacryptus.skyenet.webui.application.Applicati
planSettings = PlanSettings(
defaultModel = OpenAIModels.GPT4o,
parsingModel = OpenAIModels.GPT4oMini,
command = listOf("task"),
shellCmd = listOf("task"),
temperature = 0.2,
budget = 2.0,
autoFix = true,
Expand Down

0 comments on commit 302c6f5

Please sign in to comment.