fix: stop seq backslash issue

This commit is contained in:
Timothy J. Baek 2024-04-27 20:46:34 -04:00
parent 7f3daa19cd
commit e71ef42155
2 changed files with 13 additions and 5 deletions

View file

@ -347,9 +347,6 @@
)
.flat(1);
console.log($settings.options.stop);
// console.log($settings.options.stop.map((str) => str));
const [res, controller] = await generateChatCompletion(localStorage.token, {
model: model,
messages: messagesBody,

View file

@ -365,7 +365,13 @@
model: model,
messages: messagesBody,
options: {
...($settings.options ?? {})
...($settings.options ?? {}),
stop:
$settings?.options?.stop ?? undefined
? $settings.options.stop.map((str) =>
decodeURIComponent(JSON.parse('"' + str.replace(/\"/g, '\\"') + '"'))
)
: undefined
},
format: $settings.requestFormat ?? undefined,
keep_alive: $settings.keepAlive ?? undefined,
@ -588,7 +594,12 @@
})
})),
seed: $settings?.options?.seed ?? undefined,
stop: $settings?.options?.stop ?? undefined,
stop:
$settings?.options?.stop ?? undefined
? $settings.options.stop.map((str) =>
decodeURIComponent(JSON.parse('"' + str.replace(/\"/g, '\\"') + '"'))
)
: undefined,
temperature: $settings?.options?.temperature ?? undefined,
top_p: $settings?.options?.top_p ?? undefined,
num_ctx: $settings?.options?.num_ctx ?? undefined,