Mistral: Change tool call id algorithm

4f46a8ff10ae68a65742415304036267ea129e15

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +2 -1Showing whitespace changes
src/prompt-converters.js+2 -1
@@ -1,5 +1,6 @@
1require('./polyfill.js');1require('./polyfill.js');
2const { getConfigValue } = require('./util.js');2const { getConfigValue } = require('./util.js');
3const crypto = require('crypto');
34
4const PROMPT_PLACEHOLDER = getConfigValue('promptPlaceholder', 'Let\'s get started.');5const PROMPT_PLACEHOLDER = getConfigValue('promptPlaceholder', 'Let\'s get started.');
56
@@ -522,7 +523,7 @@ function convertMistralMessages(messages, charName = '', userName = '') {
522 lastMsg.prefix = true;523 lastMsg.prefix = true;
523 }524 }
524525
525 const sanitizeToolId = (id) => id.replace(/[^a-zA-Z0-9]/g, '').slice(0, 9);526 const sanitizeToolId = (id) => crypto.hash('sha512', id, 'base64').slice(0, 9);
526527
527 // Doesn't support completion names, so prepend if not already done by the frontend (e.g. for group chats).528 // Doesn't support completion names, so prepend if not already done by the frontend (e.g. for group chats).
528 messages.forEach(msg => {529 messages.forEach(msg => {