Fixed variable naming, better jsdoc

This commit is contained in:
bmen25124
2025-03-26 23:30:09 +03:00
parent a7d48b1aed
commit 972b1e5fa7
3 changed files with 7 additions and 5 deletions

View File

@ -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 {

View File

@ -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]

View File

@ -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)}`);
} }