Fixed variable naming, better jsdoc
| @@ -272,7 +272,7 @@ export class TextCompletionService { | |||
| 272 | formattedMessages.push(messageContent); | 272 | formattedMessages.push(messageContent); |
| 273 | } | 273 | } |
| 274 | requestData.prompt = formattedMessages.join(''); | 274 | requestData.prompt = formattedMessages.join(''); |
| 275 | const stoppingStrings = getInstructStoppingSequences({ customInstruct: instructPreset, useStopString: false }); | 275 | const stoppingStrings = getInstructStoppingSequences({ customInstruct: instructPreset, useStopStrings: false }); |
| 276 | requestData.stop = stoppingStrings; | 276 | requestData.stop = stoppingStrings; |
| 277 | requestData.stopping_strings = stoppingStrings; | 277 | requestData.stopping_strings = stoppingStrings; |
| 278 | } else { | 278 | } else { |
| @@ -299,7 +299,7 @@ export class ConnectionManagerRequestService { | |||
| 299 | * @param {string} profileId | 299 | * @param {string} profileId |
| 300 | * @param {string | (import('../custom-request.js').ChatCompletionMessage & {ignoreInstruct?: boolean})[]} prompt | 300 | * @param {string | (import('../custom-request.js').ChatCompletionMessage & {ignoreInstruct?: boolean})[]} prompt |
| 301 | * @param {number} maxTokens | 301 | * @param {number} maxTokens |
| 302 | * @param {object} custom | 302 | * @param {Object} custom |
| 303 | * @param {boolean?} [custom.stream=false] | 303 | * @param {boolean?} [custom.stream=false] |
| 304 | * @param {AbortSignal?} [custom.signal] | 304 | * @param {AbortSignal?} [custom.signal] |
| 305 | * @param {boolean?} [custom.extractData=true] | 305 | * @param {boolean?} [custom.extractData=true] |
| @@ -243,10 +243,12 @@ export function autoSelectInstructPreset(modelId) { | |||
| 243 | 243 | ||
| 244 | /** | 244 | /** |
| 245 | * Converts instruct mode sequences to an array of stopping strings. | 245 | * Converts instruct mode sequences to an array of stopping strings. |
| 246 | * @param {{customInstruct?: InstructSettings, useStopString?: boolean}} options | 246 | * @param {Object} options |
| 247 | * @param {InstructSettings?} [options.customInstruct=null] - Custom instruct settings. | ||
| 248 | * @param {boolean?} [options.useStopStrings=false] - Decides whether to use "Chat Start" and "Example Separator" | ||
| 247 | * @returns {string[]} Array of instruct mode stopping strings. | 249 | * @returns {string[]} Array of instruct mode stopping strings. |
| 248 | */ | 250 | */ |
| 249 | export function getInstructStoppingSequences({ customInstruct = null, useStopString = false } = {}) { | 251 | export function getInstructStoppingSequences({ customInstruct = null, useStopStrings = false } = {}) { |
| 250 | const instruct = structuredClone(customInstruct ?? power_user.instruct); | 252 | const instruct = structuredClone(customInstruct ?? power_user.instruct); |
| 251 | 253 | ||
| 252 | /** | 254 | /** |
| @@ -296,7 +298,7 @@ export function getInstructStoppingSequences({ customInstruct = null, useStopStr | |||
| 296 | combined_sequence.split('\n').filter((line, index, self) => self.indexOf(line) === index).forEach(addInstructSequence); | 298 | combined_sequence.split('\n').filter((line, index, self) => self.indexOf(line) === index).forEach(addInstructSequence); |
| 297 | } | 299 | } |
| 298 | 300 | ||
| 299 | if (useStopString ?? power_user.context.use_stop_strings) { | 301 | if (useStopStrings ?? power_user.context.use_stop_strings) { |
| 300 | if (power_user.context.chat_start) { | 302 | if (power_user.context.chat_start) { |
| 301 | result.push(`\n${substituteParams(power_user.context.chat_start)}`); | 303 | result.push(`\n${substituteParams(power_user.context.chat_start)}`); |
| 302 | } | 304 | } |