Remove userPlaceholder #2962

This commit is contained in:
Cohee
2024-10-09 10:23:49 +03:00
parent 9db761cea4
commit face9462aa
2 changed files with 3 additions and 11 deletions

View File

@ -155,9 +155,5 @@ claude:
# (e.g {{random}} macro or lorebooks not as in-chat injections). # (e.g {{random}} macro or lorebooks not as in-chat injections).
# Otherwise, you'll just waste money on cache misses. # Otherwise, you'll just waste money on cache misses.
enableSystemPromptCache: false enableSystemPromptCache: false
# -- COHERE API CONFIGURATION --
cohere:
# A placeholder prompt to be used when the message array doesn't end with a user message
userPlaceholder: "Continue"
# -- SERVER PLUGIN CONFIGURATION -- # -- SERVER PLUGIN CONFIGURATION --
enableServerPlugins: false enableServerPlugins: false

View File

@ -294,7 +294,7 @@ function convertCohereMessages(messages, charName = '', userName = '') {
msg.content = messages[index - 1].content; msg.content = messages[index - 1].content;
messages.splice(index - 1, 1); messages.splice(index - 1, 1);
} else { } else {
msg.content = `I'm going to call the tool for that: ${msg.tool_calls.map(tc => tc?.function?.name).join(', ')}`; msg.content = `I'm going to call a tool for that: ${msg.tool_calls.map(tc => tc?.function?.name).join(', ')}`;
} }
} }
// No names support (who would've thought) // No names support (who would've thought)
@ -317,12 +317,8 @@ function convertCohereMessages(messages, charName = '', userName = '') {
}); });
// A prompt should end with a user/tool message // A prompt should end with a user/tool message
if (!['user', 'tool'].includes(messages[messages.length - 1].role)) { if (messages.length && !['user', 'tool'].includes(messages[messages.length - 1].role)) {
const userPlaceholder = getConfigValue('cohere.userPlaceholder', PROMPT_PLACEHOLDER || 'Continue'); messages[messages.length - 1].role = 'user';
messages.push({
role: 'user',
content: userPlaceholder,
});
} }
return { chatHistory: messages }; return { chatHistory: messages };