mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fixed variable naming, better jsdoc
This commit is contained in:
@ -272,7 +272,7 @@ export class TextCompletionService {
|
|||||||
formattedMessages.push(messageContent);
|
formattedMessages.push(messageContent);
|
||||||
}
|
}
|
||||||
requestData.prompt = formattedMessages.join('');
|
requestData.prompt = formattedMessages.join('');
|
||||||
const stoppingStrings = getInstructStoppingSequences({ customInstruct: instructPreset, useStopString: false });
|
const stoppingStrings = getInstructStoppingSequences({ customInstruct: instructPreset, useStopStrings: false });
|
||||||
requestData.stop = stoppingStrings;
|
requestData.stop = stoppingStrings;
|
||||||
requestData.stopping_strings = stoppingStrings;
|
requestData.stopping_strings = stoppingStrings;
|
||||||
} else {
|
} else {
|
||||||
|
@ -299,7 +299,7 @@ export class ConnectionManagerRequestService {
|
|||||||
* @param {string} profileId
|
* @param {string} profileId
|
||||||
* @param {string | (import('../custom-request.js').ChatCompletionMessage & {ignoreInstruct?: boolean})[]} prompt
|
* @param {string | (import('../custom-request.js').ChatCompletionMessage & {ignoreInstruct?: boolean})[]} prompt
|
||||||
* @param {number} maxTokens
|
* @param {number} maxTokens
|
||||||
* @param {object} custom
|
* @param {Object} custom
|
||||||
* @param {boolean?} [custom.stream=false]
|
* @param {boolean?} [custom.stream=false]
|
||||||
* @param {AbortSignal?} [custom.signal]
|
* @param {AbortSignal?} [custom.signal]
|
||||||
* @param {boolean?} [custom.extractData=true]
|
* @param {boolean?} [custom.extractData=true]
|
||||||
|
@ -243,10 +243,12 @@ export function autoSelectInstructPreset(modelId) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts instruct mode sequences to an array of stopping strings.
|
* Converts instruct mode sequences to an array of stopping strings.
|
||||||
* @param {{customInstruct?: InstructSettings, useStopString?: boolean}} options
|
* @param {Object} options
|
||||||
|
* @param {InstructSettings?} [options.customInstruct=null] - Custom instruct settings.
|
||||||
|
* @param {boolean?} [options.useStopStrings=false] - Decides whether to use "Chat Start" and "Example Separator"
|
||||||
* @returns {string[]} Array of instruct mode stopping strings.
|
* @returns {string[]} Array of instruct mode stopping strings.
|
||||||
*/
|
*/
|
||||||
export function getInstructStoppingSequences({ customInstruct = null, useStopString = false } = {}) {
|
export function getInstructStoppingSequences({ customInstruct = null, useStopStrings = false } = {}) {
|
||||||
const instruct = structuredClone(customInstruct ?? power_user.instruct);
|
const instruct = structuredClone(customInstruct ?? power_user.instruct);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -296,7 +298,7 @@ export function getInstructStoppingSequences({ customInstruct = null, useStopStr
|
|||||||
combined_sequence.split('\n').filter((line, index, self) => self.indexOf(line) === index).forEach(addInstructSequence);
|
combined_sequence.split('\n').filter((line, index, self) => self.indexOf(line) === index).forEach(addInstructSequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useStopString ?? power_user.context.use_stop_strings) {
|
if (useStopStrings ?? power_user.context.use_stop_strings) {
|
||||||
if (power_user.context.chat_start) {
|
if (power_user.context.chat_start) {
|
||||||
result.push(`\n${substituteParams(power_user.context.chat_start)}`);
|
result.push(`\n${substituteParams(power_user.context.chat_start)}`);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user