@@ -3,7 +3,6 @@ package ee.carlrobert.codegpt.toolwindow.chat
3
3
import ee.carlrobert.codegpt.CodeGPTKeys
4
4
import ee.carlrobert.codegpt.EncodingManager
5
5
import ee.carlrobert.codegpt.ReferencedFile
6
- import ee.carlrobert.codegpt.completions.CompletionRequestProvider.COMPLETION_SYSTEM_PROMPT
7
6
import ee.carlrobert.codegpt.completions.CompletionRequestProvider.FIX_COMPILE_ERRORS_SYSTEM_PROMPT
8
7
import ee.carlrobert.codegpt.completions.ConversationType
9
8
import ee.carlrobert.codegpt.completions.HuggingFaceModel
@@ -31,7 +30,7 @@ class ChatToolWindowTabPanelTest : IntegrationTest() {
31
30
32
31
fun testSendingOpenAIMessage () {
33
32
useOpenAIService()
34
- ConfigurationSettings .getCurrentState().systemPrompt = COMPLETION_SYSTEM_PROMPT
33
+ ConfigurationSettings .getCurrentState().systemPrompt = " TEST_SYSTEM_PROMPT "
35
34
val message = Message (" Hello!" )
36
35
val conversation = ConversationService .getInstance().startConversation()
37
36
val panel = ChatToolWindowTabPanel (project, conversation)
@@ -46,7 +45,7 @@ class ChatToolWindowTabPanelTest : IntegrationTest() {
46
45
.containsExactly(
47
46
" gpt-4" ,
48
47
listOf (
49
- mapOf (" role" to " system" , " content" to COMPLETION_SYSTEM_PROMPT ),
48
+ mapOf (" role" to " system" , " content" to " TEST_SYSTEM_PROMPT " ),
50
49
mapOf (" role" to " user" , " content" to " Hello!" )))
51
50
listOf (
52
51
jsonMapResponse(" choices" , jsonArray(jsonMap(" delta" , jsonMap(" role" , " assistant" )))),
@@ -68,7 +67,7 @@ class ChatToolWindowTabPanelTest : IntegrationTest() {
68
67
" userPromptTokens" ,
69
68
" highlightedTokens" )
70
69
.containsExactly(
71
- encodingManager.countTokens(COMPLETION_SYSTEM_PROMPT ),
70
+ encodingManager.countTokens(" TEST_SYSTEM_PROMPT " ),
72
71
encodingManager.countTokens(message.prompt),
73
72
0 ,
74
73
0 )
@@ -93,7 +92,7 @@ class ChatToolWindowTabPanelTest : IntegrationTest() {
93
92
ReferencedFile (" TEST_FILE_NAME_2" , " TEST_FILE_PATH_2" , " TEST_FILE_CONTENT_2" ),
94
93
ReferencedFile (" TEST_FILE_NAME_3" , " TEST_FILE_PATH_3" , " TEST_FILE_CONTENT_3" )))
95
94
useOpenAIService()
96
- ConfigurationSettings .getCurrentState().systemPrompt = COMPLETION_SYSTEM_PROMPT
95
+ ConfigurationSettings .getCurrentState().systemPrompt = " TEST_SYSTEM_PROMPT "
97
96
val message = Message (" TEST_MESSAGE" )
98
97
message.userMessage = " TEST_MESSAGE"
99
98
message.referencedFilePaths = listOf (" TEST_FILE_PATH_1" , " TEST_FILE_PATH_2" , " TEST_FILE_PATH_3" )
@@ -110,7 +109,7 @@ class ChatToolWindowTabPanelTest : IntegrationTest() {
110
109
.containsExactly(
111
110
" gpt-4" ,
112
111
listOf (
113
- mapOf (" role" to " system" , " content" to COMPLETION_SYSTEM_PROMPT ),
112
+ mapOf (" role" to " system" , " content" to " TEST_SYSTEM_PROMPT " ),
114
113
mapOf (" role" to " user" , " content" to """
115
114
Use the following context to answer question at the end:
116
115
@@ -153,7 +152,7 @@ class ChatToolWindowTabPanelTest : IntegrationTest() {
153
152
" userPromptTokens" ,
154
153
" highlightedTokens" )
155
154
.containsExactly(
156
- encodingManager.countTokens(COMPLETION_SYSTEM_PROMPT ),
155
+ encodingManager.countTokens(" TEST_SYSTEM_PROMPT " ),
157
156
encodingManager.countTokens(message.prompt),
158
157
0 ,
159
158
0 )
@@ -180,7 +179,7 @@ class ChatToolWindowTabPanelTest : IntegrationTest() {
180
179
val testImagePath = Objects .requireNonNull(javaClass.getResource(" /images/test-image.png" )).path
181
180
project.putUserData(CodeGPTKeys .IMAGE_ATTACHMENT_FILE_PATH , testImagePath)
182
181
useOpenAIService(" gpt-4-vision-preview" )
183
- ConfigurationSettings .getCurrentState().systemPrompt = COMPLETION_SYSTEM_PROMPT
182
+ ConfigurationSettings .getCurrentState().systemPrompt = " TEST_SYSTEM_PROMPT "
184
183
val message = Message (" TEST_MESSAGE" )
185
184
val conversation = ConversationService .getInstance().startConversation()
186
185
val panel = ChatToolWindowTabPanel (project, conversation)
@@ -196,7 +195,7 @@ class ChatToolWindowTabPanelTest : IntegrationTest() {
196
195
.containsExactly(
197
196
" gpt-4-vision-preview" ,
198
197
listOf (
199
- mapOf (" role" to " system" , " content" to COMPLETION_SYSTEM_PROMPT ),
198
+ mapOf (" role" to " system" , " content" to " TEST_SYSTEM_PROMPT " ),
200
199
mapOf (" role" to " user" , " content" to listOf (
201
200
mapOf (
202
201
" type" to " image_url" ,
@@ -226,7 +225,7 @@ class ChatToolWindowTabPanelTest : IntegrationTest() {
226
225
" userPromptTokens" ,
227
226
" highlightedTokens" )
228
227
.containsExactly(
229
- encodingManager.countTokens(COMPLETION_SYSTEM_PROMPT ),
228
+ encodingManager.countTokens(" TEST_SYSTEM_PROMPT " ),
230
229
encodingManager.countTokens(message.prompt),
231
230
0 ,
232
231
0 )
@@ -256,7 +255,7 @@ class ChatToolWindowTabPanelTest : IntegrationTest() {
256
255
ReferencedFile (" TEST_FILE_NAME_2" , " TEST_FILE_PATH_2" , " TEST_FILE_CONTENT_2" ),
257
256
ReferencedFile (" TEST_FILE_NAME_3" , " TEST_FILE_PATH_3" , " TEST_FILE_CONTENT_3" )))
258
257
useOpenAIService()
259
- ConfigurationSettings .getCurrentState().systemPrompt = COMPLETION_SYSTEM_PROMPT
258
+ ConfigurationSettings .getCurrentState().systemPrompt = " TEST_SYSTEM_PROMPT "
260
259
val message = Message (" TEST_MESSAGE" )
261
260
message.userMessage = " TEST_MESSAGE"
262
261
message.referencedFilePaths = listOf (" TEST_FILE_PATH_1" , " TEST_FILE_PATH_2" , " TEST_FILE_PATH_3" )
@@ -316,7 +315,7 @@ class ChatToolWindowTabPanelTest : IntegrationTest() {
316
315
" userPromptTokens" ,
317
316
" highlightedTokens" )
318
317
.containsExactly(
319
- encodingManager.countTokens(COMPLETION_SYSTEM_PROMPT ),
318
+ encodingManager.countTokens(" TEST_SYSTEM_PROMPT " ),
320
319
encodingManager.countTokens(message.prompt),
321
320
0 ,
322
321
0 )
@@ -342,7 +341,7 @@ class ChatToolWindowTabPanelTest : IntegrationTest() {
342
341
fun testSendingLlamaMessage () {
343
342
useLlamaService()
344
343
val configurationState = ConfigurationSettings .getCurrentState()
345
- configurationState.systemPrompt = COMPLETION_SYSTEM_PROMPT
344
+ configurationState.systemPrompt = " TEST_SYSTEM_PROMPT "
346
345
configurationState.maxTokens = 1000
347
346
configurationState.temperature = 0.1
348
347
val llamaSettings = LlamaSettings .getCurrentState()
@@ -369,7 +368,7 @@ class ChatToolWindowTabPanelTest : IntegrationTest() {
369
368
" repeat_penalty" )
370
369
.containsExactly(
371
370
LLAMA .buildPrompt(
372
- COMPLETION_SYSTEM_PROMPT ,
371
+ " TEST_SYSTEM_PROMPT " ,
373
372
" TEST_PROMPT" ,
374
373
conversation.messages),
375
374
configurationState.maxTokens,
0 commit comments