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.
- Loading branch information
Showing
6 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
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,5 @@ | ||
package cc.unitmesh.devti.counit | ||
|
||
class PatternMatching { | ||
|
||
} |
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,11 @@ | ||
package cc.unitmesh.devti.counit | ||
|
||
import cc.unitmesh.devti.settings.configurable.coUnitSettings | ||
import com.intellij.openapi.project.Project | ||
|
||
class PreProcessor(val project: Project) { | ||
fun isCoUnit(input: String): Boolean { | ||
return project.coUnitSettings.enableCoUnit && input.startsWith("/counit") | ||
} | ||
} | ||
|
19 changes: 19 additions & 0 deletions
19
src/main/kotlin/cc/unitmesh/devti/counit/client/CoUnitApi.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.devti.counit.client | ||
|
||
import cc.unitmesh.devti.counit.model.PromptResult | ||
import cc.unitmesh.devti.counit.model.Tool | ||
import retrofit2.Call | ||
import retrofit2.http.GET | ||
import retrofit2.http.POST | ||
import retrofit2.http.Query | ||
|
||
interface CoUnitApi { | ||
@GET("/prompt/explain") | ||
fun explainQuery(@Query("q") q: String): Call<PromptResult> | ||
|
||
@POST("/prompt/functions/matching") | ||
fun toolPrompter(@Query("q") q: String): Call<PromptResult> | ||
|
||
@GET("/prompt/functions/list") | ||
fun functions(): Call<List<Tool>> | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/kotlin/cc/unitmesh/devti/counit/model/ExplainQuery.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,18 @@ | ||
package cc.unitmesh.devti.counit.model | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ExplainQuery( | ||
val domain: String, | ||
val query: String, | ||
@SerialName("hypothetical_document") | ||
val hypotheticalDocument: String | ||
) | ||
|
||
@Serializable | ||
data class QAExample( | ||
val question: String, | ||
val answer: ExplainQuery | ||
) |
5 changes: 5 additions & 0 deletions
5
src/main/kotlin/cc/unitmesh/devti/counit/model/PromptResult.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,5 @@ | ||
package cc.unitmesh.devti.counit.model | ||
|
||
data class PromptResult( | ||
val prompt: String | ||
) |
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,8 @@ | ||
package cc.unitmesh.devti.counit.model | ||
|
||
data class Tool( | ||
val name: String, | ||
val description: String, | ||
val schema: String, | ||
val examples: String | ||
) |