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