[fix] oobabooga (#225)
# PR Checklist - [x] Did you check if it works normally in all models? *ignore this when it dosen't uses models* - [x] Did you check if it works normally in all of web, local and node hosted versions? if it dosen't, did you blocked it in those versions? - [x] Did you added a type def? # Description - Fix the sampling parameter inputs and remove unused settings (#224) - Add the streaming features - Force to use the model's prompt template - Strict end-of-text checking with many stop strings - Replace the oobabooga prebuilt preset with simple-1 (oobabooga preset arena winner) - Increase the default oobabooga truncation length from 2048 to 4096 (LLaMA 1 -> LLaMA 2)
This commit is contained in:
@@ -64,7 +64,7 @@
|
|||||||
let lastMessages:Message[] = messages.slice(Math.max(messages.length - 10, 0));
|
let lastMessages:Message[] = messages.slice(Math.max(messages.length - 10, 0));
|
||||||
if(lastMessages.length === 0)
|
if(lastMessages.length === 0)
|
||||||
return
|
return
|
||||||
const promptbody:OpenAIChat[] = [
|
let promptbody:OpenAIChat[] = [
|
||||||
{
|
{
|
||||||
role:'system',
|
role:'system',
|
||||||
content: replacePlaceholders($DataBase.autoSuggestPrompt, currentChar.name)
|
content: replacePlaceholders($DataBase.autoSuggestPrompt, currentChar.name)
|
||||||
@@ -75,6 +75,21 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if($DataBase.subModel === "textgen_webui"){
|
||||||
|
promptbody = [
|
||||||
|
{
|
||||||
|
role: 'system',
|
||||||
|
content: replacePlaceholders($DataBase.autoSuggestPrompt, currentChar.name)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'user',
|
||||||
|
content: lastMessages.map(({ role, data }) => `${
|
||||||
|
role === 'char' ? currentChar.name : $DataBase.username
|
||||||
|
}: ${data}`).join("\n\n") + `\n\n${$DataBase.username}:`
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
progress = true
|
progress = true
|
||||||
progressChatPage = chatPage
|
progressChatPage = chatPage
|
||||||
abortController = new AbortController()
|
abortController = new AbortController()
|
||||||
|
|||||||
@@ -54,6 +54,10 @@
|
|||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
unsub()
|
unsub()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$: if($DataBase.aiModel === 'textgen_webui'){
|
||||||
|
$DataBase.useStreaming = $DataBase.textgenWebUIStreamURL.startsWith("wss://")
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h2 class="mb-2 text-2xl font-bold mt-2">{language.chatBot}</h2>
|
<h2 class="mb-2 text-2xl font-bold mt-2">{language.chatBot}</h2>
|
||||||
@@ -217,9 +221,11 @@
|
|||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
{#if $DataBase.aiModel === 'textgen_webui' || $DataBase.subModel === 'textgen_webui'}
|
{#if $DataBase.aiModel === 'textgen_webui' || $DataBase.subModel === 'textgen_webui'}
|
||||||
<span class="text-neutral-200 mt-2">TextGen {language.providerURL}</span>
|
<span class="text-neutral-200 mt-2">Oobabooga Blocking {language.providerURL}</span>
|
||||||
<TextInput marginBottom={true} bind:value={$DataBase.textgenWebUIURL} placeholder="https://..."/>
|
<TextInput marginBottom={true} bind:value={$DataBase.textgenWebUIBlockingURL} placeholder="https://..."/>
|
||||||
<span class="text-draculared text-xs mb-2">You must use textgen webui with --api, and use api server's port (default is 5000)</span>
|
<span class="text-draculared text-xs mb-2">You must use textgen webui with --public-api</span>
|
||||||
|
<span class="text-neutral-200 mt-2">Oobabooga Stream {language.providerURL}</span>
|
||||||
|
<TextInput marginBottom={true} bind:value={$DataBase.textgenWebUIStreamURL} placeholder="wss://..."/>
|
||||||
{#if !isTauri}
|
{#if !isTauri}
|
||||||
<span class="text-draculared text-xs mb-2">You are using web version. you must use ngrok or other tunnels to use your local webui.</span>
|
<span class="text-draculared text-xs mb-2">You are using web version. you must use ngrok or other tunnels to use your local webui.</span>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -246,12 +252,17 @@
|
|||||||
<SliderInput min={0} max={200} bind:value={$DataBase.temperature}/>
|
<SliderInput min={0} max={200} bind:value={$DataBase.temperature}/>
|
||||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.temperature / 100).toFixed(2)}</span>
|
<span class="text-gray-400 mb-6 text-sm">{($DataBase.temperature / 100).toFixed(2)}</span>
|
||||||
{#if $DataBase.aiModel === 'textgen_webui'}
|
{#if $DataBase.aiModel === 'textgen_webui'}
|
||||||
|
<span class="text-neutral-200">Repetition Penalty</span>
|
||||||
|
<SliderInput min={1} max={1.5} step={0.01} bind:value={$DataBase.ooba.repetition_penalty}/>
|
||||||
|
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.repetition_penalty).toFixed(2)}</span>
|
||||||
|
<span class="text-neutral-200">Length Penalty</span>
|
||||||
|
<SliderInput min={-5} max={5} step={0.05} bind:value={$DataBase.ooba.length_penalty}/>
|
||||||
|
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.length_penalty).toFixed(2)}</span>
|
||||||
<span class="text-neutral-200">Top K</span>
|
<span class="text-neutral-200">Top K</span>
|
||||||
<SliderInput min={0} max={2} step={0.01} bind:value={$DataBase.ooba.top_k} />
|
<SliderInput min={0} max={100} step={1} bind:value={$DataBase.ooba.top_k} />
|
||||||
|
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.top_k).toFixed(0)}</span>
|
||||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.top_k).toFixed(2)}</span>
|
|
||||||
<span class="text-neutral-200">Top P</span>
|
<span class="text-neutral-200">Top P</span>
|
||||||
<SliderInput min={0} max={2} step={0.01} bind:value={$DataBase.ooba.top_p}/>
|
<SliderInput min={0} max={1} step={0.01} bind:value={$DataBase.ooba.top_p}/>
|
||||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.top_p).toFixed(2)}</span>
|
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.top_p).toFixed(2)}</span>
|
||||||
<span class="text-neutral-200">Typical P</span>
|
<span class="text-neutral-200">Typical P</span>
|
||||||
<SliderInput min={0} max={1} step={0.01} bind:value={$DataBase.ooba.typical_p}/>
|
<SliderInput min={0} max={1} step={0.01} bind:value={$DataBase.ooba.typical_p}/>
|
||||||
@@ -259,24 +270,9 @@
|
|||||||
<span class="text-neutral-200">Top A</span>
|
<span class="text-neutral-200">Top A</span>
|
||||||
<SliderInput min={0} max={1} step={0.01} bind:value={$DataBase.ooba.top_a}/>
|
<SliderInput min={0} max={1} step={0.01} bind:value={$DataBase.ooba.top_a}/>
|
||||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.top_a).toFixed(2)}</span>
|
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.top_a).toFixed(2)}</span>
|
||||||
<span class="text-neutral-200">Tail Free Sampling</span>
|
<span class="text-neutral-200">No Repeat n-gram Size</span>
|
||||||
<SliderInput min={0} max={1} step={0.01} bind:value={$DataBase.ooba.tfs}/>
|
<SliderInput min={0} max={20} step={1} bind:value={$DataBase.ooba.no_repeat_ngram_size}/>
|
||||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.tfs).toFixed(2)}</span>
|
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.no_repeat_ngram_size).toFixed(0)}</span>
|
||||||
<span class="text-neutral-200">Epsilon Cutoff</span>
|
|
||||||
<SliderInput min={0} max={9} step={0.01} bind:value={$DataBase.ooba.epsilon_cutoff}/>
|
|
||||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.epsilon_cutoff).toFixed(2)}</span>
|
|
||||||
<span class="text-neutral-200">Eta Cutoff</span>
|
|
||||||
<SliderInput min={0} max={20} step={0.01} bind:value={$DataBase.ooba.eta_cutoff}/>
|
|
||||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.eta_cutoff).toFixed(2)}</span>
|
|
||||||
<span class="text-neutral-200">Number of Beams</span>
|
|
||||||
<SliderInput min={1} max={20} step={1} bind:value={$DataBase.ooba.num_beams}/>
|
|
||||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.num_beams).toFixed(2)}</span>
|
|
||||||
<span class="text-neutral-200">Length Penalty</span>
|
|
||||||
<SliderInput min={-5} max={5} step={0.1} bind:value={$DataBase.ooba.length_penalty}/>
|
|
||||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.length_penalty).toFixed(2)}</span>
|
|
||||||
<span class="text-neutral-200">Penalty Alpha</span>
|
|
||||||
<SliderInput min={0} max={5} step={0.05} bind:value={$DataBase.ooba.penalty_alpha}/>
|
|
||||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.penalty_alpha).toFixed(2)}</span>
|
|
||||||
<div class="flex items-center mt-4">
|
<div class="flex items-center mt-4">
|
||||||
<Check bind:check={$DataBase.ooba.do_sample} name={'Do Sample'}/>
|
<Check bind:check={$DataBase.ooba.do_sample} name={'Do Sample'}/>
|
||||||
</div>
|
</div>
|
||||||
@@ -289,24 +285,30 @@
|
|||||||
<div class="flex items-center mt-4">
|
<div class="flex items-center mt-4">
|
||||||
<Check bind:check={$DataBase.ooba.skip_special_tokens} name={'Skip Special Tokens'}/>
|
<Check bind:check={$DataBase.ooba.skip_special_tokens} name={'Skip Special Tokens'}/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center mt-4">
|
<div class="flex flex-col p-3 bg-darkbg mt-4">
|
||||||
<Check bind:check={$DataBase.ooba.formating.custom} name={'Instruct Format'}/>
|
<span class="text-neutral-200">Header</span>
|
||||||
|
<TextAreaInput fullwidth autocomplete="off" height={"24"} bind:value={$DataBase.ooba.formating.header} />
|
||||||
|
<span class="text-neutral-200">System Prefix</span>
|
||||||
|
<TextAreaInput fullwidth autocomplete="off" height={"24"} bind:value={$DataBase.ooba.formating.systemPrefix} />
|
||||||
|
<span class="text-neutral-200">User Prefix</span>
|
||||||
|
<TextAreaInput fullwidth autocomplete="off" height={"24"} bind:value={$DataBase.ooba.formating.userPrefix} />
|
||||||
|
<span class="text-neutral-200">Assistant Prefix</span>
|
||||||
|
<TextAreaInput fullwidth autocomplete="off" height={"24"} bind:value={$DataBase.ooba.formating.assistantPrefix} />
|
||||||
|
<span class="text-neutral-200">Seperator</span>
|
||||||
|
<TextAreaInput fullwidth autocomplete="off" height={"24"} bind:value={$DataBase.ooba.formating.seperator} />
|
||||||
</div>
|
</div>
|
||||||
{#if $DataBase.ooba.formating.custom}
|
|
||||||
<div class="flex flex-col p-3 bg-darkbg mt-4">
|
<span class="text-neutral-200 mt-2">{language.autoSuggest} <Help key="autoSuggest"/></span>
|
||||||
<span class="text-neutral-200">User Prefix</span>
|
<TextAreaInput fullwidth autocomplete="off" height={"32"} bind:value={$DataBase.autoSuggestPrompt} />
|
||||||
<TextInput marginBottom bind:value={$DataBase.ooba.formating.userPrefix} />
|
<span class="text-gray-400 mb-6 text-sm">{tokens.autoSuggest} {language.tokens}</span>
|
||||||
<span class="text-neutral-200">Assistant Prefix</span>
|
|
||||||
<TextInput marginBottom bind:value={$DataBase.ooba.formating.assistantPrefix} />
|
<span class="text-neutral-200">{language.autoSuggest} Prefix</span>
|
||||||
<span class="text-neutral-200">Seperator</span>
|
<TextInput marginBottom={true} bind:value={$DataBase.autoSuggestPrefix} />
|
||||||
<TextInput marginBottom bind:value={$DataBase.ooba.formating.seperator} />
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{:else if $DataBase.aiModel.startsWith('novelai')}
|
{:else if $DataBase.aiModel.startsWith('novelai')}
|
||||||
<span class="text-neutral-200">Top P</span>
|
<span class="text-neutral-200">Top P</span>
|
||||||
<SliderInput min={0} max={1} step={0.01} bind:value={$DataBase.NAIsettings.topP}/>
|
<SliderInput min={0} max={1} step={0.01} bind:value={$DataBase.NAIsettings.topP}/>
|
||||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.NAIsettings.topP).toFixed(2)}</span>
|
<span class="text-gray-400 mb-6 text-sm">{($DataBase.NAIsettings.topP).toFixed(2)}</span>
|
||||||
<span class="text-neutral-200">Top P</span>
|
<span class="text-neutral-200">Top K</span>
|
||||||
<SliderInput min={0} max={100} step={1} bind:value={$DataBase.NAIsettings.topK}/>
|
<SliderInput min={0} max={100} step={1} bind:value={$DataBase.NAIsettings.topK}/>
|
||||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.NAIsettings.topK).toFixed(0)}</span>
|
<span class="text-gray-400 mb-6 text-sm">{($DataBase.NAIsettings.topK).toFixed(0)}</span>
|
||||||
<span class="text-neutral-200">Top A</span>
|
<span class="text-neutral-200">Top A</span>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export function exampleMessage(char:character, userName:string):OpenAIChat[]{
|
|||||||
add()
|
add()
|
||||||
currentMessage = {
|
currentMessage = {
|
||||||
role: "assistant",
|
role: "assistant",
|
||||||
content: trimed.split(':', 2)[1],
|
content: trimed.split(':', 2)[1].trimStart(),
|
||||||
name: 'example_assistant'
|
name: 'example_assistant'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ export function exampleMessage(char:character, userName:string):OpenAIChat[]{
|
|||||||
add()
|
add()
|
||||||
currentMessage = {
|
currentMessage = {
|
||||||
role: "user",
|
role: "user",
|
||||||
content: trimed.split(':', 2)[1],
|
content: trimed.split(':', 2)[1].trimStart(),
|
||||||
name: 'example_user'
|
name: 'example_user'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type { OpenAIChat, OpenAIChatFull } from ".";
|
|||||||
import { DataBase, setDatabase, type character } from "../storage/database";
|
import { DataBase, setDatabase, type character } from "../storage/database";
|
||||||
import { pluginProcess } from "../plugins/plugins";
|
import { pluginProcess } from "../plugins/plugins";
|
||||||
import { language } from "../../lang";
|
import { language } from "../../lang";
|
||||||
import { stringlizeAINChat, stringlizeChat, stringlizeChatOba, unstringlizeAIN, unstringlizeChat } from "./stringlize";
|
import { stringlizeAINChat, stringlizeChat, stringlizeChatOba, getStopStrings, unstringlizeAIN, unstringlizeChat } from "./stringlize";
|
||||||
import { globalFetch, isNodeServer, isTauri } from "../storage/globalApi";
|
import { globalFetch, isNodeServer, isTauri } from "../storage/globalApi";
|
||||||
import { sleep } from "../util";
|
import { sleep } from "../util";
|
||||||
import { createDeep } from "./deepai";
|
import { createDeep } from "./deepai";
|
||||||
@@ -379,14 +379,14 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "textgen_webui":{
|
case "textgen_webui":{
|
||||||
let DURL = db.textgenWebUIURL
|
let streamUrl = db.textgenWebUIStreamURL.replace(/\/api.*/, "/api/v1/stream")
|
||||||
|
let blockingUrl = db.textgenWebUIBlockingURL.replace(/\/api.*/, "/api/v1/generate")
|
||||||
let bodyTemplate:any
|
let bodyTemplate:any
|
||||||
const proompt = stringlizeChatOba(formated, currentChar?.name ?? '')
|
const suggesting = model === "submodel"
|
||||||
if(!DURL.endsWith('generate')){
|
const proompt = stringlizeChatOba(formated, suggesting)
|
||||||
DURL = DURL + "/v1/generate"
|
const stopStrings = getStopStrings(suggesting)
|
||||||
}
|
|
||||||
const stopStrings = [`\nUser:`,`\nuser:`,`\n${db.username}:`]
|
|
||||||
console.log(proompt)
|
console.log(proompt)
|
||||||
|
console.log(stopStrings)
|
||||||
bodyTemplate = {
|
bodyTemplate = {
|
||||||
'max_new_tokens': db.maxResponse,
|
'max_new_tokens': db.maxResponse,
|
||||||
'do_sample': true,
|
'do_sample': true,
|
||||||
@@ -409,7 +409,55 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
add_bos_token: true,
|
add_bos_token: true,
|
||||||
prompt: proompt
|
prompt: proompt
|
||||||
}
|
}
|
||||||
const res = await globalFetch(DURL, {
|
if(db.useStreaming && arg.useStreaming){
|
||||||
|
const oobaboogaSocket = new WebSocket(streamUrl);
|
||||||
|
const statusCode = await new Promise((resolve) => {
|
||||||
|
oobaboogaSocket.onopen = () => resolve(0)
|
||||||
|
oobaboogaSocket.onerror = () => resolve(1001)
|
||||||
|
oobaboogaSocket.onclose = ({ code }) => resolve(code)
|
||||||
|
})
|
||||||
|
if(abortSignal.aborted || statusCode !== 0) {
|
||||||
|
oobaboogaSocket.close()
|
||||||
|
return ({
|
||||||
|
type: "fail",
|
||||||
|
result: abortSignal.reason || `WebSocket connection failed to '${streamUrl}' failed!`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const close = () => {
|
||||||
|
oobaboogaSocket.close()
|
||||||
|
}
|
||||||
|
const stream = new ReadableStream({
|
||||||
|
start(controller){
|
||||||
|
let readed = "";
|
||||||
|
oobaboogaSocket.onmessage = async (event) => {
|
||||||
|
const json = JSON.parse(event.data);
|
||||||
|
if (json.event === "stream_end") {
|
||||||
|
close()
|
||||||
|
controller.close()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (json.event !== "text_stream") return
|
||||||
|
readed += json.text
|
||||||
|
controller.enqueue(readed)
|
||||||
|
};
|
||||||
|
oobaboogaSocket.send(JSON.stringify(bodyTemplate));
|
||||||
|
},
|
||||||
|
cancel(){
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
oobaboogaSocket.onerror = close
|
||||||
|
oobaboogaSocket.onclose = close
|
||||||
|
abortSignal.addEventListener("abort", close)
|
||||||
|
|
||||||
|
return {
|
||||||
|
type: 'streaming',
|
||||||
|
result: stream
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await globalFetch(blockingUrl, {
|
||||||
body: bodyTemplate,
|
body: bodyTemplate,
|
||||||
headers: {},
|
headers: {},
|
||||||
abortSignal
|
abortSignal
|
||||||
@@ -419,6 +467,9 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
if(res.ok){
|
if(res.ok){
|
||||||
try {
|
try {
|
||||||
let result:string = dat.results[0].text
|
let result:string = dat.results[0].text
|
||||||
|
if(suggesting){
|
||||||
|
result = "\n" + db.autoSuggestPrefix + result
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: 'success',
|
type: 'success',
|
||||||
|
|||||||
@@ -23,43 +23,85 @@ export function stringlizeChat(formated:OpenAIChat[], char:string = ''){
|
|||||||
return resultString.join('\n\n') + `\n\n${char}:`
|
return resultString.join('\n\n') + `\n\n${char}:`
|
||||||
}
|
}
|
||||||
|
|
||||||
export function stringlizeChatOba(formated:OpenAIChat[], char:string = ''){
|
function appendWhitespace(prefix:string, seperator:string=" ") {
|
||||||
|
if(prefix && !"> \n".includes(prefix[prefix.length-1])){
|
||||||
|
prefix += seperator.includes("\n\n") ? "\n" : " "
|
||||||
|
}
|
||||||
|
return prefix
|
||||||
|
}
|
||||||
|
export function stringlizeChatOba(formated:OpenAIChat[], suggesting:boolean=false){
|
||||||
const db = get(DataBase)
|
const db = get(DataBase)
|
||||||
let resultString:string[] = []
|
let resultString:string[] = []
|
||||||
if(db.ooba.formating.custom){
|
let { header, systemPrefix, userPrefix, assistantPrefix, seperator } = db.ooba.formating;
|
||||||
for(const form of formated){
|
if(!seperator){
|
||||||
if(form.role === 'system'){
|
seperator = "\n\n"
|
||||||
resultString.push(form.content)
|
}
|
||||||
}
|
|
||||||
else if(form.name){
|
|
||||||
resultString.push(db.ooba.formating.userPrefix + form.content + db.ooba.formating.seperator)
|
|
||||||
}
|
|
||||||
else if(form.role === 'assistant' && char){
|
|
||||||
resultString.push(db.ooba.formating.assistantPrefix + form.content + db.ooba.formating.seperator)
|
|
||||||
|
|
||||||
}
|
if(header) {
|
||||||
else{
|
resultString.push(header)
|
||||||
resultString.push(form.content)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return resultString.join('\n\n') + `\n\n${db.ooba.formating.assistantPrefix}:`
|
|
||||||
}
|
}
|
||||||
for(const form of formated){
|
for(const form of formated){
|
||||||
if(form.role === 'system'){
|
if(form.content === "[Start a new chat]"){
|
||||||
resultString.push(form.content)
|
continue
|
||||||
}
|
}
|
||||||
else if(form.name){
|
let prefix = ""
|
||||||
resultString.push(form.name + ": " + form.content)
|
if(form.role === 'user'){
|
||||||
|
prefix = appendWhitespace(userPrefix, seperator)
|
||||||
}
|
}
|
||||||
else if(form.role === 'assistant' && char){
|
else if(form.role === 'assistant'){
|
||||||
resultString.push(char + ": " + form.content)
|
prefix = appendWhitespace(assistantPrefix, seperator)
|
||||||
|
}
|
||||||
|
else if(form.role === 'system'){
|
||||||
|
prefix = appendWhitespace(systemPrefix, seperator)
|
||||||
|
}
|
||||||
|
resultString.push(prefix + form.content)
|
||||||
|
}
|
||||||
|
if (suggesting){
|
||||||
|
resultString.push(appendWhitespace(assistantPrefix, seperator) + "\n" + db.autoSuggestPrefix)
|
||||||
|
} else {
|
||||||
|
resultString.push(assistantPrefix)
|
||||||
|
}
|
||||||
|
return resultString.join(seperator)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
const userStrings = ["user", "human", "input", "inst", "instruction"]
|
||||||
else{
|
function toTitleCase(s:string){
|
||||||
resultString.push(form.content)
|
return s[0].toUpperCase() + s.slice(1).toLowerCase()
|
||||||
|
}
|
||||||
|
export function getStopStrings(suggesting:boolean=false){
|
||||||
|
const db = get(DataBase)
|
||||||
|
let { userPrefix, seperator } = db.ooba.formating;
|
||||||
|
if(!seperator){
|
||||||
|
seperator = "\n"
|
||||||
|
}
|
||||||
|
const { username } = db
|
||||||
|
const stopStrings = [
|
||||||
|
"GPT4 User",
|
||||||
|
"</s>",
|
||||||
|
"<|end",
|
||||||
|
"<|im_end",
|
||||||
|
userPrefix,
|
||||||
|
`\n${username} `,
|
||||||
|
`${username}:`,
|
||||||
|
]
|
||||||
|
if(seperator !== " "){
|
||||||
|
stopStrings.push(seperator + username)
|
||||||
|
}
|
||||||
|
if(suggesting){
|
||||||
|
stopStrings.push("\n\n")
|
||||||
|
}
|
||||||
|
for (const user of userStrings){
|
||||||
|
for (const u of [
|
||||||
|
user.toLowerCase(),
|
||||||
|
user.toUpperCase(),
|
||||||
|
user.replace(/\w\S*/g, toTitleCase),
|
||||||
|
]){
|
||||||
|
stopStrings.push(`${u}:`)
|
||||||
|
stopStrings.push(`<<${u}>>`)
|
||||||
|
stopStrings.push(`### ${u}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return resultString.join('\n\n') + `\n\n${char}:`
|
return [...new Set(stopStrings)]
|
||||||
}
|
}
|
||||||
|
|
||||||
export function unstringlizeChat(text:string, formated:OpenAIChat[], char:string = ''){
|
export function unstringlizeChat(text:string, formated:OpenAIChat[], char:string = ''){
|
||||||
@@ -160,7 +202,6 @@ export function stringlizeAINChat(formated:OpenAIChat[], char:string = ''){
|
|||||||
else{
|
else{
|
||||||
resultString.push(form.content)
|
resultString.push(form.content)
|
||||||
}
|
}
|
||||||
console.log(resultString)
|
|
||||||
}
|
}
|
||||||
return resultString.join('\n\n') + `\n\n${char} 「`
|
return resultString.join('\n\n') + `\n\n${char} 「`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { DataBase, setPreset, type botPreset, setDatabase } from "src/ts/storage/database";
|
import { DataBase, setPreset, type botPreset, setDatabase } from "src/ts/storage/database";
|
||||||
|
import { defaultAutoSuggestPrefixOoba, defaultAutoSuggestPrompt, defaultAutoSuggestPromptOoba } from "src/ts/storage/defaultPrompts";
|
||||||
import { get } from "svelte/store";
|
import { get } from "svelte/store";
|
||||||
import { prebuiltNAIpresets, prebuiltPresets } from "./templates";
|
import { prebuiltNAIpresets, prebuiltPresets } from "./templates";
|
||||||
import { alertConfirm, alertSelect } from "src/ts/alert";
|
import { alertConfirm, alertSelect } from "src/ts/alert";
|
||||||
@@ -9,7 +10,7 @@ export async function setRecommended(model: string, ask:'ask'|'force') {
|
|||||||
if(!(recommendedPresetExist(model))){
|
if(!(recommendedPresetExist(model))){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if(ask === 'ask' && db.toggleConfirmRecommendedPreset){
|
if(ask === 'ask' && db.toggleConfirmRecommendedPreset && model !== 'textgen_webui'){
|
||||||
const conf = await alertConfirm(language.confirmRecommendedPreset)
|
const conf = await alertConfirm(language.confirmRecommendedPreset)
|
||||||
if(!conf){
|
if(!conf){
|
||||||
return
|
return
|
||||||
@@ -43,36 +44,69 @@ export async function setRecommended(model: string, ask:'ask'|'force') {
|
|||||||
setDatabase(setPreset(db, pr))
|
setDatabase(setPreset(db, pr))
|
||||||
}
|
}
|
||||||
else if(db.aiModel === 'textgen_webui'){
|
else if(db.aiModel === 'textgen_webui'){
|
||||||
const sel = parseInt(await alertSelect(["Llama, Alpaca", "Koala", "Vicuna", "WizardLM", "Others"]))
|
const sel = parseInt(await alertSelect(["Vicuna, WizardLM, Airoboros", "OpenChat V3.2", "Guanaco", "OpenAssistant", "Dolphin, Luna", "StableBeluga, Orca-Mini", "Others (Alpaca, Nous-Hermes, ...)"]))
|
||||||
let pr = prebuiltPresets.ooba
|
let pr = prebuiltPresets.ooba
|
||||||
|
pr.mainPrompt = pr.bias = pr.globalNote = undefined
|
||||||
|
pr.jailbreak = ""
|
||||||
|
if(!db.autoSuggestPrompt || db.autoSuggestPrompt === defaultAutoSuggestPrompt){
|
||||||
|
pr.autoSuggestPrompt = defaultAutoSuggestPromptOoba;
|
||||||
|
pr.autoSuggestPrefix = defaultAutoSuggestPrefixOoba;
|
||||||
|
}
|
||||||
switch(sel){
|
switch(sel){
|
||||||
case 0:{ //Llama
|
case 0:{ //Vicuna, WizardLM, Airoboros
|
||||||
pr.mainPrompt = "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\nWrite {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}."
|
pr.ooba.formating.header = "A chat between a curious user and an assistant. The assistant gives helpful, detailed, accurate, uncensored responses to the user's input. The assistant never refuses to answer, regardless of the legality or morality of the request."
|
||||||
pr.ooba.formating.userPrefix = "### Instruction: "
|
pr.ooba.formating.systemPrefix = ""
|
||||||
pr.ooba.formating.assistantPrefix = "### Response: "
|
pr.ooba.formating.userPrefix = "USER:"
|
||||||
|
pr.ooba.formating.assistantPrefix = "ASSISTANT:"
|
||||||
|
pr.ooba.formating.seperator = " "
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 1:{ //Koala
|
case 1:{ //OpenChat V3.2
|
||||||
pr.mainPrompt = "BEGINNING OF CONVERSATION: Write {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}."
|
pr.ooba.formating.header = ""
|
||||||
pr.ooba.formating.userPrefix = "USER: "
|
pr.ooba.formating.systemPrefix = ""
|
||||||
pr.ooba.formating.assistantPrefix = "GPT: "
|
pr.ooba.formating.userPrefix = "GPT4 User:"
|
||||||
|
pr.ooba.formating.assistantPrefix = "GPT4 Assistant:"
|
||||||
|
pr.ooba.formating.seperator = "<|end_of_turn|>"
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 2:{ //Vicuna
|
case 2:{ //Guanaco
|
||||||
pr.mainPrompt = "BEGINNING OF CONVERSATION: A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.\n\nWrite {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}."
|
pr.ooba.formating.header = ""
|
||||||
pr.ooba.formating.userPrefix = "USER: "
|
pr.ooba.formating.systemPrefix = ""
|
||||||
pr.ooba.formating.assistantPrefix = "ASSISTANT: "
|
pr.ooba.formating.userPrefix = "### Human:"
|
||||||
pr.ooba.formating.seperator = '</s>'
|
pr.ooba.formating.assistantPrefix = "### Assistant:"
|
||||||
|
pr.ooba.formating.seperator = "\n"
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 3:{ //WizardLM
|
case 3:{ //OpenAssistant
|
||||||
pr.mainPrompt = "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.\n\nWrite {{char}}'s next detailed reply in a fictional roleplay chat between {{user}} and {{char}}."
|
pr.ooba.formating.header = ""
|
||||||
pr.ooba.formating.userPrefix = "USER: "
|
pr.ooba.formating.systemPrefix = "<|system|>"
|
||||||
pr.ooba.formating.assistantPrefix = "ASSISTANT: "
|
pr.ooba.formating.userPrefix = "<|prompter|>"
|
||||||
|
pr.ooba.formating.assistantPrefix = "<|assistant|>"
|
||||||
|
pr.ooba.formating.seperator = "</s>"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
case 4:{ //Dolphin, Luna
|
||||||
|
pr.ooba.formating.header = ""
|
||||||
|
pr.ooba.formating.systemPrefix = "SYSTEM:"
|
||||||
|
pr.ooba.formating.userPrefix = "USER:"
|
||||||
|
pr.ooba.formating.assistantPrefix = "ASSISTANT:"
|
||||||
|
pr.ooba.formating.seperator = "\n"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
case 5:{ //StableBeluga, Orca-Mini
|
||||||
|
pr.ooba.formating.header = ""
|
||||||
|
pr.ooba.formating.systemPrefix = "### System:"
|
||||||
|
pr.ooba.formating.userPrefix = "### User:"
|
||||||
|
pr.ooba.formating.assistantPrefix = "### Assistant:"
|
||||||
|
pr.ooba.formating.seperator = ""
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
default:{
|
default:{
|
||||||
pr.mainPrompt = "Write {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}."
|
pr.ooba.formating.header = "Below is an instruction that describes a task. Write a response that appropriately completes the request."
|
||||||
|
pr.ooba.formating.systemPrefix = "### Instruction:"
|
||||||
|
pr.ooba.formating.userPrefix = "### Input:"
|
||||||
|
pr.ooba.formating.assistantPrefix = "### Response:"
|
||||||
|
pr.ooba.formating.seperator = ""
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ export const prebuiltPresets:{OAI:botPreset,ooba:botPreset} = {
|
|||||||
"ooba": {
|
"ooba": {
|
||||||
"max_new_tokens": 180,
|
"max_new_tokens": 180,
|
||||||
"do_sample": true,
|
"do_sample": true,
|
||||||
"temperature": 0.5,
|
"temperature": 0.7,
|
||||||
"top_p": 0.9,
|
"top_p": 0.9,
|
||||||
"typical_p": 1,
|
"typical_p": 1,
|
||||||
"repetition_penalty": 1.1,
|
"repetition_penalty": 1.15,
|
||||||
"encoder_repetition_penalty": 1,
|
"encoder_repetition_penalty": 1,
|
||||||
"top_k": 0,
|
"top_k": 20,
|
||||||
"min_length": 0,
|
"min_length": 0,
|
||||||
"no_repeat_ngram_size": 0,
|
"no_repeat_ngram_size": 0,
|
||||||
"num_beams": 1,
|
"num_beams": 1,
|
||||||
@@ -42,7 +42,7 @@ export const prebuiltPresets:{OAI:botPreset,ooba:botPreset} = {
|
|||||||
"early_stopping": false,
|
"early_stopping": false,
|
||||||
"seed": -1,
|
"seed": -1,
|
||||||
"add_bos_token": true,
|
"add_bos_token": true,
|
||||||
"truncation_length": 2048,
|
"truncation_length": 4096,
|
||||||
"ban_eos_token": false,
|
"ban_eos_token": false,
|
||||||
"skip_special_tokens": true,
|
"skip_special_tokens": true,
|
||||||
"top_a": 0,
|
"top_a": 0,
|
||||||
@@ -50,9 +50,10 @@ export const prebuiltPresets:{OAI:botPreset,ooba:botPreset} = {
|
|||||||
"epsilon_cutoff": 0,
|
"epsilon_cutoff": 0,
|
||||||
"eta_cutoff": 0,
|
"eta_cutoff": 0,
|
||||||
"formating": {
|
"formating": {
|
||||||
"custom": false,
|
"header": "Below is an instruction that describes a task. Write a response that appropriately completes the request.",
|
||||||
"userPrefix": "user:",
|
"systemPrefix": "### Instruction:",
|
||||||
"assistantPrefix": "assistant:",
|
"userPrefix": "### Input:",
|
||||||
|
"assistantPrefix": "### Response:",
|
||||||
"seperator": "",
|
"seperator": "",
|
||||||
"useName": false
|
"useName": false
|
||||||
}
|
}
|
||||||
@@ -70,10 +71,10 @@ export const prebuiltPresets:{OAI:botPreset,ooba:botPreset} = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ooba":{
|
"ooba":{
|
||||||
"mainPrompt": "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\nWrite {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}.",
|
"mainPrompt": "Write {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}.",
|
||||||
"jailbreak": "",
|
"jailbreak": "",
|
||||||
"globalNote": "",
|
"globalNote": "",
|
||||||
"temperature": 80,
|
"temperature": 70,
|
||||||
"maxContext": 4000,
|
"maxContext": 4000,
|
||||||
"maxResponse": 300,
|
"maxResponse": 300,
|
||||||
"frequencyPenalty": 70,
|
"frequencyPenalty": 70,
|
||||||
@@ -84,25 +85,25 @@ export const prebuiltPresets:{OAI:botPreset,ooba:botPreset} = {
|
|||||||
"description",
|
"description",
|
||||||
"personaPrompt",
|
"personaPrompt",
|
||||||
"lorebook",
|
"lorebook",
|
||||||
"chats",
|
|
||||||
"lastChat",
|
|
||||||
"globalNote",
|
"globalNote",
|
||||||
"authorNote"
|
"authorNote",
|
||||||
|
"chats",
|
||||||
|
"lastChat"
|
||||||
],
|
],
|
||||||
"aiModel": "textgen_webui",
|
"aiModel": "textgen_webui",
|
||||||
"subModel": "gpt35",
|
"subModel": "textgen_webui",
|
||||||
"promptPreprocess": false,
|
"promptPreprocess": false,
|
||||||
"bias": [],
|
"bias": [],
|
||||||
"koboldURL": null,
|
"koboldURL": null,
|
||||||
"ooba": {
|
"ooba": {
|
||||||
"max_new_tokens": 180,
|
"max_new_tokens": 180,
|
||||||
"do_sample": true,
|
"do_sample": true,
|
||||||
"temperature": 0.5,
|
"temperature": 0.7,
|
||||||
"top_p": 0.9,
|
"top_p": 0.9,
|
||||||
"typical_p": 1,
|
"typical_p": 1,
|
||||||
"repetition_penalty": 1.1,
|
"repetition_penalty": 1.15,
|
||||||
"encoder_repetition_penalty": 1,
|
"encoder_repetition_penalty": 1,
|
||||||
"top_k": 0,
|
"top_k": 20,
|
||||||
"min_length": 0,
|
"min_length": 0,
|
||||||
"no_repeat_ngram_size": 0,
|
"no_repeat_ngram_size": 0,
|
||||||
"num_beams": 1,
|
"num_beams": 1,
|
||||||
@@ -111,7 +112,7 @@ export const prebuiltPresets:{OAI:botPreset,ooba:botPreset} = {
|
|||||||
"early_stopping": false,
|
"early_stopping": false,
|
||||||
"seed": -1,
|
"seed": -1,
|
||||||
"add_bos_token": true,
|
"add_bos_token": true,
|
||||||
"truncation_length": 2048,
|
"truncation_length": 4096,
|
||||||
"ban_eos_token": false,
|
"ban_eos_token": false,
|
||||||
"skip_special_tokens": true,
|
"skip_special_tokens": true,
|
||||||
"top_a": 0,
|
"top_a": 0,
|
||||||
@@ -119,9 +120,10 @@ export const prebuiltPresets:{OAI:botPreset,ooba:botPreset} = {
|
|||||||
"epsilon_cutoff": 0,
|
"epsilon_cutoff": 0,
|
||||||
"eta_cutoff": 0,
|
"eta_cutoff": 0,
|
||||||
"formating": {
|
"formating": {
|
||||||
"custom": true,
|
"header": "Below is an instruction that describes a task. Write a response that appropriately completes the request.",
|
||||||
"userPrefix": "user:",
|
"systemPrefix": "### Instruction:",
|
||||||
"assistantPrefix": "assistant:",
|
"userPrefix": "### Input:",
|
||||||
|
"assistantPrefix": "### Response:",
|
||||||
"seperator": "",
|
"seperator": "",
|
||||||
"useName": false
|
"useName": false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,8 +106,11 @@ export function setDatabase(data:Database){
|
|||||||
if(checkNullish(data.customBackground)){
|
if(checkNullish(data.customBackground)){
|
||||||
data.customBackground = ''
|
data.customBackground = ''
|
||||||
}
|
}
|
||||||
if(checkNullish(data.textgenWebUIURL)){
|
if(checkNullish(data.textgenWebUIStreamURL)){
|
||||||
data.textgenWebUIURL = 'http://127.0.0.1:7860/api/'
|
data.textgenWebUIStreamURL = 'wss://localhost/api/'
|
||||||
|
}
|
||||||
|
if(checkNullish(data.textgenWebUIBlockingURL)){
|
||||||
|
data.textgenWebUIBlockingURL = 'https://localhost/api/'
|
||||||
}
|
}
|
||||||
if(checkNullish(data.autoTranslate)){
|
if(checkNullish(data.autoTranslate)){
|
||||||
data.autoTranslate = false
|
data.autoTranslate = false
|
||||||
@@ -265,6 +268,9 @@ export function setDatabase(data:Database){
|
|||||||
if(checkNullish(data.autoSuggestPrompt)){
|
if(checkNullish(data.autoSuggestPrompt)){
|
||||||
data.autoSuggestPrompt = defaultAutoSuggestPrompt
|
data.autoSuggestPrompt = defaultAutoSuggestPrompt
|
||||||
}
|
}
|
||||||
|
if(checkNullish(data.autoSuggestPrefix)){
|
||||||
|
data.autoSuggestPrompt = ""
|
||||||
|
}
|
||||||
if(checkNullish(data.imageCompression)){
|
if(checkNullish(data.imageCompression)){
|
||||||
data.imageCompression = true
|
data.imageCompression = true
|
||||||
}
|
}
|
||||||
@@ -435,7 +441,8 @@ export interface botPreset{
|
|||||||
aiModel?: string
|
aiModel?: string
|
||||||
subModel?:string
|
subModel?:string
|
||||||
currentPluginProvider?:string
|
currentPluginProvider?:string
|
||||||
textgenWebUIURL?:string
|
textgenWebUIStreamURL?:string
|
||||||
|
textgenWebUIBlockingURL?:string
|
||||||
forceReplaceUrl?:string
|
forceReplaceUrl?:string
|
||||||
forceReplaceUrl2?:string
|
forceReplaceUrl2?:string
|
||||||
promptPreprocess: boolean,
|
promptPreprocess: boolean,
|
||||||
@@ -447,6 +454,8 @@ export interface botPreset{
|
|||||||
ainconfig: AINsettings
|
ainconfig: AINsettings
|
||||||
koboldURL?: string
|
koboldURL?: string
|
||||||
NAISettings?: NAISettings
|
NAISettings?: NAISettings
|
||||||
|
autoSuggestPrompt?: string
|
||||||
|
autoSuggestPrefix?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Database{
|
export interface Database{
|
||||||
@@ -490,7 +499,8 @@ export interface Database{
|
|||||||
zoomsize:number
|
zoomsize:number
|
||||||
lastup:string
|
lastup:string
|
||||||
customBackground:string
|
customBackground:string
|
||||||
textgenWebUIURL:string
|
textgenWebUIStreamURL:string
|
||||||
|
textgenWebUIBlockingURL:string
|
||||||
autoTranslate: boolean
|
autoTranslate: boolean
|
||||||
fullScreen:boolean
|
fullScreen:boolean
|
||||||
playMessage:boolean
|
playMessage:boolean
|
||||||
@@ -555,7 +565,8 @@ export interface Database{
|
|||||||
koboldURL:string
|
koboldURL:string
|
||||||
advancedBotSettings:boolean
|
advancedBotSettings:boolean
|
||||||
useAutoSuggestions:boolean
|
useAutoSuggestions:boolean
|
||||||
autoSuggestPrompt:string,
|
autoSuggestPrompt:string
|
||||||
|
autoSuggestPrefix:string
|
||||||
claudeAPIKey:string,
|
claudeAPIKey:string,
|
||||||
useChatCopy:boolean,
|
useChatCopy:boolean,
|
||||||
novellistAPI:string,
|
novellistAPI:string,
|
||||||
@@ -678,7 +689,8 @@ interface OobaSettings{
|
|||||||
epsilon_cutoff: number,
|
epsilon_cutoff: number,
|
||||||
eta_cutoff: number,
|
eta_cutoff: number,
|
||||||
formating:{
|
formating:{
|
||||||
custom:boolean,
|
header:string,
|
||||||
|
systemPrefix:string,
|
||||||
userPrefix:string,
|
userPrefix:string,
|
||||||
assistantPrefix:string
|
assistantPrefix:string
|
||||||
seperator:string
|
seperator:string
|
||||||
@@ -704,12 +716,12 @@ export const defaultAIN:AINsettings = {
|
|||||||
export const defaultOoba:OobaSettings = {
|
export const defaultOoba:OobaSettings = {
|
||||||
max_new_tokens: 180,
|
max_new_tokens: 180,
|
||||||
do_sample: true,
|
do_sample: true,
|
||||||
temperature: 0.5,
|
temperature: 0.7,
|
||||||
top_p: 0.9,
|
top_p: 0.9,
|
||||||
typical_p: 1,
|
typical_p: 1,
|
||||||
repetition_penalty: 1.1,
|
repetition_penalty: 1.15,
|
||||||
encoder_repetition_penalty: 1,
|
encoder_repetition_penalty: 1,
|
||||||
top_k: 0,
|
top_k: 20,
|
||||||
min_length: 0,
|
min_length: 0,
|
||||||
no_repeat_ngram_size: 0,
|
no_repeat_ngram_size: 0,
|
||||||
num_beams: 1,
|
num_beams: 1,
|
||||||
@@ -718,7 +730,7 @@ export const defaultOoba:OobaSettings = {
|
|||||||
early_stopping: false,
|
early_stopping: false,
|
||||||
seed: -1,
|
seed: -1,
|
||||||
add_bos_token: true,
|
add_bos_token: true,
|
||||||
truncation_length: 2048,
|
truncation_length: 4096,
|
||||||
ban_eos_token: false,
|
ban_eos_token: false,
|
||||||
skip_special_tokens: true,
|
skip_special_tokens: true,
|
||||||
top_a: 0,
|
top_a: 0,
|
||||||
@@ -726,10 +738,11 @@ export const defaultOoba:OobaSettings = {
|
|||||||
epsilon_cutoff: 0,
|
epsilon_cutoff: 0,
|
||||||
eta_cutoff: 0,
|
eta_cutoff: 0,
|
||||||
formating:{
|
formating:{
|
||||||
custom:false,
|
header: "Below is an instruction that describes a task. Write a response that appropriately completes the request.",
|
||||||
userPrefix:'user:',
|
systemPrefix: "### Instruction:",
|
||||||
assistantPrefix:'assistant:',
|
userPrefix: "### Input:",
|
||||||
seperator:'',
|
assistantPrefix: "### Response:",
|
||||||
|
seperator:"",
|
||||||
useName:false,
|
useName:false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -751,7 +764,8 @@ export const presetTemplate:botPreset = {
|
|||||||
aiModel: "gpt35",
|
aiModel: "gpt35",
|
||||||
subModel: "gpt35",
|
subModel: "gpt35",
|
||||||
currentPluginProvider: "",
|
currentPluginProvider: "",
|
||||||
textgenWebUIURL: '',
|
textgenWebUIStreamURL: '',
|
||||||
|
textgenWebUIBlockingURL: '',
|
||||||
forceReplaceUrl: '',
|
forceReplaceUrl: '',
|
||||||
forceReplaceUrl2: '',
|
forceReplaceUrl2: '',
|
||||||
promptPreprocess: false,
|
promptPreprocess: false,
|
||||||
@@ -825,7 +839,8 @@ export function saveCurrentPreset(){
|
|||||||
aiModel: db.aiModel,
|
aiModel: db.aiModel,
|
||||||
subModel: db.subModel,
|
subModel: db.subModel,
|
||||||
currentPluginProvider: db.currentPluginProvider,
|
currentPluginProvider: db.currentPluginProvider,
|
||||||
textgenWebUIURL: db.textgenWebUIURL,
|
textgenWebUIStreamURL: db.textgenWebUIStreamURL,
|
||||||
|
textgenWebUIBlockingURL: db.textgenWebUIBlockingURL,
|
||||||
forceReplaceUrl: db.forceReplaceUrl,
|
forceReplaceUrl: db.forceReplaceUrl,
|
||||||
forceReplaceUrl2: db.forceReplaceUrl2,
|
forceReplaceUrl2: db.forceReplaceUrl2,
|
||||||
promptPreprocess: db.promptPreprocess,
|
promptPreprocess: db.promptPreprocess,
|
||||||
@@ -879,7 +894,8 @@ export function setPreset(db:Database, newPres: botPreset){
|
|||||||
db.aiModel = newPres.aiModel ?? db.aiModel
|
db.aiModel = newPres.aiModel ?? db.aiModel
|
||||||
db.subModel = newPres.subModel ?? db.subModel
|
db.subModel = newPres.subModel ?? db.subModel
|
||||||
db.currentPluginProvider = newPres.currentPluginProvider ?? db.currentPluginProvider
|
db.currentPluginProvider = newPres.currentPluginProvider ?? db.currentPluginProvider
|
||||||
db.textgenWebUIURL = newPres.textgenWebUIURL ?? db.textgenWebUIURL
|
db.textgenWebUIStreamURL = newPres.textgenWebUIStreamURL ?? db.textgenWebUIStreamURL
|
||||||
|
db.textgenWebUIBlockingURL = newPres.textgenWebUIBlockingURL ?? db.textgenWebUIBlockingURL
|
||||||
db.forceReplaceUrl = newPres.forceReplaceUrl ?? db.forceReplaceUrl
|
db.forceReplaceUrl = newPres.forceReplaceUrl ?? db.forceReplaceUrl
|
||||||
db.promptPreprocess = newPres.promptPreprocess ?? db.promptPreprocess
|
db.promptPreprocess = newPres.promptPreprocess ?? db.promptPreprocess
|
||||||
db.forceReplaceUrl2 = newPres.forceReplaceUrl2 ?? db.forceReplaceUrl2
|
db.forceReplaceUrl2 = newPres.forceReplaceUrl2 ?? db.forceReplaceUrl2
|
||||||
@@ -891,6 +907,8 @@ export function setPreset(db:Database, newPres: botPreset){
|
|||||||
db.openrouterRequestModel = newPres.openrouterRequestModel ?? db.openrouterRequestModel
|
db.openrouterRequestModel = newPres.openrouterRequestModel ?? db.openrouterRequestModel
|
||||||
db.proxyRequestModel = newPres.proxyRequestModel ?? db.proxyRequestModel
|
db.proxyRequestModel = newPres.proxyRequestModel ?? db.proxyRequestModel
|
||||||
db.NAIsettings = newPres.NAISettings ?? db.NAIsettings
|
db.NAIsettings = newPres.NAISettings ?? db.NAIsettings
|
||||||
|
db.autoSuggestPrompt = newPres.autoSuggestPrompt ?? db.autoSuggestPrompt
|
||||||
|
db.autoSuggestPrefix = newPres.autoSuggestPrefix ?? db.autoSuggestPrefix
|
||||||
return db
|
return db
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -902,7 +920,8 @@ export function downloadPreset(id:number){
|
|||||||
pres.forceReplaceUrl = ''
|
pres.forceReplaceUrl = ''
|
||||||
pres.forceReplaceUrl2 = ''
|
pres.forceReplaceUrl2 = ''
|
||||||
pres.proxyKey = ''
|
pres.proxyKey = ''
|
||||||
pres.textgenWebUIURL= ''
|
pres.textgenWebUIStreamURL= ''
|
||||||
|
pres.textgenWebUIBlockingURL= ''
|
||||||
downloadFile(pres.name + "_preset.json", Buffer.from(JSON.stringify(pres, null, 2)))
|
downloadFile(pres.name + "_preset.json", Buffer.from(JSON.stringify(pres, null, 2)))
|
||||||
alertNormal(language.successExport)
|
alertNormal(language.successExport)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,3 +28,15 @@ Out Examples:
|
|||||||
|
|
||||||
Let's read these guidelines step by step three times to be sure we have accurately adhered to the rules.
|
Let's read these guidelines step by step three times to be sure we have accurately adhered to the rules.
|
||||||
`
|
`
|
||||||
|
export const defaultAutoSuggestPromptOoba = `Write {{user}}'s next responses that meet the following criteria:
|
||||||
|
|
||||||
|
1. The purpose, intention, personality, and tendency must be consistent with the previous conversations.
|
||||||
|
2. It must contain {{user}}'s response only, NOT {{char}}'s.
|
||||||
|
3. The responses should be as diverse as feasible while remaining consistent.
|
||||||
|
4. It could be what {{char}} expects or does NOT expect.
|
||||||
|
5. It should be interesting and creative while NOT being obvious or boring.
|
||||||
|
6. It must make the future development and situation more detailed.
|
||||||
|
|
||||||
|
Write 5 possible {{user}}'s next responses in distinct categories.
|
||||||
|
Write only one {{user}}'s response per line; each line must start with a hyphen '-'.`
|
||||||
|
export const defaultAutoSuggestPrefixOoba = `- "`
|
||||||
|
|||||||
Reference in New Issue
Block a user