@@ -5,7 +5,6 @@ import ee.carlrobert.codegpt.completions.llama.PromptTemplate.LLAMA
5
5
import ee.carlrobert.codegpt.conversations.ConversationService
6
6
import ee.carlrobert.codegpt.conversations.message.Message
7
7
import ee.carlrobert.codegpt.settings.configuration.ConfigurationSettings
8
- import ee.carlrobert.codegpt.settings.persona.PersonaSettings
9
8
import ee.carlrobert.codegpt.settings.prompts.PromptsSettings
10
9
import ee.carlrobert.llm.client.http.RequestEntity
11
10
import ee.carlrobert.llm.client.http.exchange.NdJsonStreamHttpExchange
@@ -19,7 +18,8 @@ class DefaultToolwindowChatCompletionRequestHandlerTest : IntegrationTest() {
19
18
20
19
fun testOpenAIChatCompletionCall () {
21
20
useOpenAIService()
22
- service<PromptsSettings >().state.personas.selectedPersona.instructions = " TEST_SYSTEM_PROMPT"
21
+ service<PromptsSettings >().state.personas.selectedPersona.instructions =
22
+ " TEST_SYSTEM_PROMPT"
23
23
val message = Message (" TEST_PROMPT" )
24
24
val conversation = ConversationService .getInstance().startConversation()
25
25
expectOpenAI(StreamHttpExchange { request: RequestEntity ->
@@ -58,7 +58,8 @@ class DefaultToolwindowChatCompletionRequestHandlerTest : IntegrationTest() {
58
58
59
59
fun testAzureChatCompletionCall () {
60
60
useAzureService()
61
- service<PromptsSettings >().state.personas.selectedPersona.instructions = " TEST_SYSTEM_PROMPT"
61
+ service<PromptsSettings >().state.personas.selectedPersona.instructions =
62
+ " TEST_SYSTEM_PROMPT"
62
63
val conversationService = ConversationService .getInstance()
63
64
val prevMessage = Message (" TEST_PREV_PROMPT" )
64
65
prevMessage.response = " TEST_PREV_RESPONSE"
@@ -104,7 +105,8 @@ class DefaultToolwindowChatCompletionRequestHandlerTest : IntegrationTest() {
104
105
fun testLlamaChatCompletionCall () {
105
106
useLlamaService()
106
107
service<ConfigurationSettings >().state.maxTokens = 99
107
- service<PromptsSettings >().state.personas.selectedPersona.instructions = " TEST_SYSTEM_PROMPT"
108
+ service<PromptsSettings >().state.personas.selectedPersona.instructions =
109
+ " TEST_SYSTEM_PROMPT"
108
110
val message = Message (" TEST_PROMPT" )
109
111
val conversation = ConversationService .getInstance().startConversation()
110
112
conversation.addMessage(Message (" Ping" , " Pong" ))
@@ -145,7 +147,8 @@ class DefaultToolwindowChatCompletionRequestHandlerTest : IntegrationTest() {
145
147
fun testOllamaChatCompletionCall () {
146
148
useOllamaService()
147
149
service<ConfigurationSettings >().state.maxTokens = 99
148
- service<PromptsSettings >().state.personas.selectedPersona.instructions = " TEST_SYSTEM_PROMPT"
150
+ service<PromptsSettings >().state.personas.selectedPersona.instructions =
151
+ " TEST_SYSTEM_PROMPT"
149
152
val message = Message (" TEST_PROMPT" )
150
153
val conversation = ConversationService .getInstance().startConversation()
151
154
expectOllama(NdJsonStreamHttpExchange { request: RequestEntity ->
@@ -184,24 +187,21 @@ class DefaultToolwindowChatCompletionRequestHandlerTest : IntegrationTest() {
184
187
185
188
fun testGoogleChatCompletionCall () {
186
189
useGoogleService()
187
- service<PromptsSettings >().state.personas.selectedPersona.instructions = " TEST_SYSTEM_PROMPT"
190
+ service<PromptsSettings >().state.personas.selectedPersona.instructions =
191
+ " TEST_SYSTEM_PROMPT"
188
192
val message = Message (" TEST_PROMPT" )
189
193
val conversation = ConversationService .getInstance().startConversation()
190
194
expectGoogle(StreamHttpExchange { request: RequestEntity ->
191
195
assertThat(request.uri.path).isEqualTo(" /v1/models/gemini-pro:streamGenerateContent" )
192
196
assertThat(request.method).isEqualTo(" POST" )
193
197
assertThat(request.uri.query).isEqualTo(" key=TEST_API_KEY&alt=sse" )
194
198
assertThat(request.body)
195
- .extracting(" contents" )
196
- .isEqualTo (
199
+ .extracting(" contents" , " systemInstruction " )
200
+ .containsExactly (
197
201
listOf (
198
- mapOf (
199
- " parts" to listOf (mapOf (" text" to " TEST_SYSTEM_PROMPT" )),
200
- " role" to " user"
201
- ),
202
- mapOf (" parts" to listOf (mapOf (" text" to " Understood." )), " role" to " model" ),
203
202
mapOf (" parts" to listOf (mapOf (" text" to " TEST_PROMPT" )), " role" to " user" ),
204
- )
203
+ ),
204
+ mapOf (" parts" to listOf (mapOf (" text" to " TEST_SYSTEM_PROMPT" )))
205
205
)
206
206
listOf (
207
207
jsonMapResponse(
@@ -229,7 +229,8 @@ class DefaultToolwindowChatCompletionRequestHandlerTest : IntegrationTest() {
229
229
230
230
fun testCodeGPTServiceChatCompletionCall () {
231
231
useCodeGPTService()
232
- service<PromptsSettings >().state.personas.selectedPersona.instructions = " TEST_SYSTEM_PROMPT"
232
+ service<PromptsSettings >().state.personas.selectedPersona.instructions =
233
+ " TEST_SYSTEM_PROMPT"
233
234
val message = Message (" TEST_PROMPT" )
234
235
val conversation = ConversationService .getInstance().startConversation()
235
236
expectCodeGPT(StreamHttpExchange { request: RequestEntity ->
0 commit comments