mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Allow multiple stop strings for TogetherAI
This commit is contained in:
@ -187,6 +187,7 @@ const TOGETHERAI_KEYS = [
|
|||||||
'top_k',
|
'top_k',
|
||||||
'repetition_penalty',
|
'repetition_penalty',
|
||||||
'stream',
|
'stream',
|
||||||
|
'stop',
|
||||||
];
|
];
|
||||||
|
|
||||||
// https://github.com/jmorganca/ollama/blob/main/docs/api.md#request-with-options
|
// https://github.com/jmorganca/ollama/blob/main/docs/api.md#request-with-options
|
||||||
|
@ -257,11 +257,7 @@ router.post('/generate', jsonParser, async function (request, response) {
|
|||||||
setAdditionalHeaders(request, args, baseUrl);
|
setAdditionalHeaders(request, args, baseUrl);
|
||||||
|
|
||||||
if (request.body.api_type === TEXTGEN_TYPES.TOGETHERAI) {
|
if (request.body.api_type === TEXTGEN_TYPES.TOGETHERAI) {
|
||||||
const stop = Array.isArray(request.body.stop) ? request.body.stop[0] : '';
|
|
||||||
request.body = _.pickBy(request.body, (_, key) => TOGETHERAI_KEYS.includes(key));
|
request.body = _.pickBy(request.body, (_, key) => TOGETHERAI_KEYS.includes(key));
|
||||||
if (typeof stop === 'string' && stop.length > 0) {
|
|
||||||
request.body.stop = stop;
|
|
||||||
}
|
|
||||||
args.body = JSON.stringify(request.body);
|
args.body = JSON.stringify(request.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user