Skip to content

Commit

Permalink
refactor: keep docs
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 29, 2023
1 parent 8f0b49d commit 4e93dd1
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions docs/instruction/instruction.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ for example:
| InBlockCompletion | | |
| AfterBlockCompletion | | |
| TestCode | | |
| Documentation | lines >= 5 | |

If you want to add a new instruction, you need to add a new CodeContextStrategy and CompletionBuilderType.

Expand Down
6 changes: 3 additions & 3 deletions docs/instruction/similar-code-completion.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
layout: default
title: Similar Code Completion
title: SimilarChunks Strategy
parent: Instruction Builder
nav_order: 2
---

# Similar Code Completion
# SimilarChunks Strategy

Implement class: SimilarChunksCompletionBuilder
Implement class: SimilarChunks Strategy

## Core Logic

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class SingleProjectCodePicker(private val config: InsPickerOption) {

val workerManager = WorkerManager(
WorkerContext(
config.buildPlan,
config.codeStrategyTypes,
config.codeQualityTypes,
config.insOutputConfig,
pureDataFileName = config.pureDataFileName(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cc.unitmesh.pick.option

import cc.unitmesh.pick.strategy.BuildPlanType
import cc.unitmesh.pick.strategy.CodeStrategyType
import cc.unitmesh.core.completion.CompletionBuilderType
import cc.unitmesh.pick.threshold.InsQualityThreshold
import cc.unitmesh.quality.CodeQualityType
Expand All @@ -25,7 +25,7 @@ const val MAX_COMPLETION_EACH_FILE = 10
* @property branch The branch of the repository. Default value is "master".
* @property language The programming language of the code in the repository. Default value is "java".
* @property baseDir The base directory where the datasets are stored. Default value is "datasets".
* @property buildPlan The strategies to determine the code context. Default value is [BuildPlanType.RELATED_CODE].
* @property codeStrategyTypes The strategies to determine the code context. Default value is [CodeStrategyType.RELATED_CODE].
* Possible values are:
* - [CodeContextStrategy.SIMILAR_CHUNKS]: Determines the code context based on similar code chunks.
* - [CodeContextStrategy.RELATED_CODE]: Determines the code context based on related code.
Expand Down Expand Up @@ -53,15 +53,15 @@ data class InsPickerOption(
val language: String = "java",
val baseDir: String = "datasets",
/**
* The [BuildPlanType], suggest to be one of:.
* The [CodeStrategyType], suggest to be one of:.
*
* - [BuildPlanType.SIMILAR_CHUNKS]
* - [BuildPlanType.RELATED_CODE]
* - [CodeStrategyType.SIMILAR_CHUNKS]
* - [CodeStrategyType.RELATED_CODE]
*
*/
val buildPlan: List<BuildPlanType> = listOf(
BuildPlanType.RELATED_CODE,
// BuildPlanType.SIMILAR_CHUNKS,
val codeStrategyTypes: List<CodeStrategyType> = listOf(
CodeStrategyType.RELATED_CODE,
CodeStrategyType.SIMILAR_CHUNKS,
),
/**
* The [CompletionBuilderType], which will according you IDE strategy to generate the type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import kotlinx.serialization.SerializationException
* The `BuildPlanType` enum class represents different strategies for generating code context in AutoDev.
*
* There are two available strategies:
* 1. [BuildPlanType.SIMILAR_CHUNKS]: This prompt is used with pre-built context for unsupported languages.
* 1. [CodeStrategyType.SIMILAR_CHUNKS]: This prompt is used with pre-built context for unsupported languages.
* It allows AutoDev to generate code context with similar code chunks builder.
* 2. [BuildPlanType.RELATED_CODE]: This prompt is used with pre-built context. It allows AutoDev to
* 2. [CodeStrategyType.RELATED_CODE]: This prompt is used with pre-built context. It allows AutoDev to
* generate code context with similar code builder.
*
* The strategies are used through the `builder` function, which takes an `InstructionContext` parameter and returns an `InstructionBuilder` object.
*
* Note that the `builder` function throws a `SerializationException` if the prompt is unknown.
*/
enum class BuildPlanType {
enum class CodeStrategyType {
/**
* the AutoDev with pre-build context for un-support language
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cc.unitmesh.pick.worker

import cc.unitmesh.pick.option.InsOutputConfig
import cc.unitmesh.pick.strategy.BuildPlanType
import cc.unitmesh.pick.strategy.CodeStrategyType
import cc.unitmesh.core.completion.CompletionBuilderType
import cc.unitmesh.pick.project.ProjectContext
import cc.unitmesh.pick.threshold.InsQualityThreshold
Expand All @@ -12,7 +12,7 @@ import org.jetbrains.annotations.TestOnly

@Serializable
data class WorkerContext(
val codeContextStrategies: List<BuildPlanType>,
val codeContextStrategies: List<CodeStrategyType>,
val qualityTypes: List<CodeQualityType>,
val insOutputConfig: InsOutputConfig,
val pureDataFileName: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cc.unitmesh.pick
import cc.unitmesh.core.Instruction
import cc.unitmesh.core.completion.CompletionBuilderType
import cc.unitmesh.pick.option.InsPickerOption
import cc.unitmesh.pick.strategy.BuildPlanType
import cc.unitmesh.pick.strategy.CodeStrategyType
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
Expand Down Expand Up @@ -39,7 +39,7 @@ class SingleProjectCodePickerTest {
language = "kotlin",
url = root,
maxTokenLength = 8192,
buildPlan = listOf(BuildPlanType.RELATED_CODE),
codeStrategyTypes = listOf(CodeStrategyType.RELATED_CODE),
completionTypes = listOf(
CompletionBuilderType.DOCUMENTATION, CompletionBuilderType.TEST_CODE_GEN
),
Expand Down

0 comments on commit 4e93dd1

Please sign in to comment.