Remove userPlaceholder #2962
| @@ -155,9 +155,5 @@ claude: | |||
| 155 | # (e.g {{random}} macro or lorebooks not as in-chat injections). | 155 | # (e.g {{random}} macro or lorebooks not as in-chat injections). |
| 156 | # Otherwise, you'll just waste money on cache misses. | 156 | # Otherwise, you'll just waste money on cache misses. |
| 157 | enableSystemPromptCache: false | 157 | enableSystemPromptCache: false |
| 158 | # -- COHERE API CONFIGURATION -- | ||
| 159 | cohere: | ||
| 160 | # A placeholder prompt to be used when the message array doesn't end with a user message | ||
| 161 | userPlaceholder: "Continue" | ||
| 162 | # -- SERVER PLUGIN CONFIGURATION -- | 158 | # -- SERVER PLUGIN CONFIGURATION -- |
| 163 | enableServerPlugins: false | 159 | enableServerPlugins: false |
| @@ -294,7 +294,7 @@ function convertCohereMessages(messages, charName = '', userName = '') { | |||
| 294 | msg.content = messages[index - 1].content; | 294 | msg.content = messages[index - 1].content; |
| 295 | messages.splice(index - 1, 1); | 295 | messages.splice(index - 1, 1); |
| 296 | } else { | 296 | } else { |
| 297 | msg.content = `I'm going to call the tool for that: ${msg.tool_calls.map(tc => tc?.function?.name).join(', ')}`; | 297 | msg.content = `I'm going to call a tool for that: ${msg.tool_calls.map(tc => tc?.function?.name).join(', ')}`; |
| 298 | } | 298 | } |
| 299 | } | 299 | } |
| 300 | // No names support (who would've thought) | 300 | // No names support (who would've thought) |
| @@ -317,12 +317,8 @@ function convertCohereMessages(messages, charName = '', userName = '') { | |||
| 317 | }); | 317 | }); |
| 318 | 318 | ||
| 319 | // A prompt should end with a user/tool message | 319 | // A prompt should end with a user/tool message |
| 320 | if (!['user', 'tool'].includes(messages[messages.length - 1].role)) { | 320 | if (messages.length && !['user', 'tool'].includes(messages[messages.length - 1].role)) { |
| 321 | const userPlaceholder = getConfigValue('cohere.userPlaceholder', PROMPT_PLACEHOLDER || 'Continue'); | 321 | messages[messages.length - 1].role = 'user'; |
| 322 | messages.push({ | ||
| 323 | role: 'user', | ||
| 324 | content: userPlaceholder, | ||
| 325 | }); | ||
| 326 | } | 322 | } |
| 327 | 323 | ||
| 328 | return { chatHistory: messages }; | 324 | return { chatHistory: messages }; |