Skip to content

Commit 6a7c26a

Browse files
committed
feat(model): introduce CustomRagApp and ResponseAction enum, refactor CodePayload to use text instead of payload_type, update AutoDevInputSection to use send icon, add examples to Tooling class as QAExample objects. #51
This commit introduces a new `CustomRagApp` data class and an `ResponseAction` enum to handle response actions in the counit model. Additionally, the `CodePayload` class has been refactored to use `text` instead of `payload_type`. The `AutoDevInputSection` has been updated to use the send icon for the presentation, and the `Tooling` class now includes `QAExample` objects for its examples.
1 parent 46b499e commit 6a7c26a

File tree

6 files changed

+58
-32
lines changed

6 files changed

+58
-32
lines changed

src/main/kotlin/cc/unitmesh/devti/counit/dto/PayloadType.kt

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/main/kotlin/cc/unitmesh/devti/counit/dto/QAExample.kt

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
package cc.unitmesh.devti.counit.model
22

3-
import cc.unitmesh.devti.counit.dto.PayloadType
4-
import com.google.gson.annotations.SerializedName
53
import kotlinx.serialization.Serializable
64

75
typealias Embedding = List<Float>
86

97
@Serializable
108
data class CodePayload(
11-
val lang: String,
12-
@SerializedName("repo_name") val repoName: String,
13-
@SerializedName("repo_ref") val repoRef: String,
14-
@SerializedName("payload_type") val payloadType: PayloadType,
15-
@SerializedName("relative_path") val relativePath: String,
16-
@SerializedName("content_hash") val contentHash: String,
17-
@SerializedName("display_text") val displayText: String,
18-
@SerializedName("origin_text") val originText: String,
19-
@SerializedName("branches") val branches: List<String>,
209
val id: String?,
10+
val text: String?,
2111
val embedding: Embedding?,
2212
val score: Float?,
2313
)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package cc.unitmesh.devti.counit.model
2+
3+
/**
4+
* Enumeration of possible response actions.
5+
*
6+
* @property Direct Direct display result
7+
* @property TextChunk Text splitting result
8+
* @property Flow Will be handled by the client
9+
*/
10+
enum class ResponseAction {
11+
/**
12+
* Direct display result
13+
*/
14+
Direct,
15+
16+
/**
17+
* Text splitting result
18+
*/
19+
TextChunk,
20+
21+
/**
22+
* will be handled by the client
23+
*/
24+
Flow
25+
}
26+
27+
data class CustomFlowTransition(
28+
/**
29+
* will be JsonPath
30+
*/
31+
val source: String,
32+
/**
33+
* will be JsonPath too
34+
*/
35+
val target: String,
36+
)
37+
38+
data class CustomRagApp(
39+
val name: String,
40+
val description: String = "",
41+
val url: String = "",
42+
val icon: String = "",
43+
val responseAction: ResponseAction = ResponseAction.Direct,
44+
val customFlowTransition: List<CustomFlowTransition> = emptyList(),
45+
)

src/main/kotlin/cc/unitmesh/devti/counit/model/Tooling.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package cc.unitmesh.devti.counit.model
22

3+
import kotlinx.serialization.Serializable
4+
35
/**
46
* `Tooling` class represents a tooling configuration.
57
*
@@ -12,5 +14,14 @@ data class Tooling(
1214
val name: String,
1315
val description: String,
1416
val schema: String,
15-
val examples: List<String>
17+
val examples: List<QAExample>,
18+
)
19+
20+
/**
21+
* `QAExample` is a data class that represents a question-answer pair.
22+
*/
23+
@Serializable
24+
data class QAExample(
25+
val question: String,
26+
val answer: String,
1627
)

src/main/kotlin/cc/unitmesh/devti/gui/chat/AutoDevInputSection.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class AutoDevInputSection(private val project: Project, val disposable: Disposab
6161
input.text = text
6262
}
6363

64-
6564
init {
6665
val presentation = Presentation(AutoDevBundle.message("chat.panel.send"))
6766
presentation.setIcon(AutoDevIcons.Send)

0 commit comments

Comments
 (0)