[fix] local model's prompt template

This commit is contained in:
aegkmq
2023-08-02 12:23:50 +09:00
parent daf2118ebb
commit dfb03d08d4
9 changed files with 193 additions and 88 deletions

View File

@@ -106,8 +106,11 @@ export function setDatabase(data:Database){
if(checkNullish(data.customBackground)){
data.customBackground = ''
}
if(checkNullish(data.textgenWebUIURL)){
data.textgenWebUIURL = 'http://127.0.0.1:7860/api/'
if(checkNullish(data.textgenWebUIStreamURL)){
data.textgenWebUIStreamURL = 'wss://localhost/api/'
}
if(checkNullish(data.textgenWebUIBlockingURL)){
data.textgenWebUIBlockingURL = 'https://localhost/api/'
}
if(checkNullish(data.autoTranslate)){
data.autoTranslate = false
@@ -265,6 +268,9 @@ export function setDatabase(data:Database){
if(checkNullish(data.autoSuggestPrompt)){
data.autoSuggestPrompt = defaultAutoSuggestPrompt
}
if(checkNullish(data.autoSuggestPrefix)){
data.autoSuggestPrompt = ""
}
if(checkNullish(data.imageCompression)){
data.imageCompression = true
}
@@ -435,7 +441,8 @@ export interface botPreset{
aiModel?: string
subModel?:string
currentPluginProvider?:string
textgenWebUIURL?:string
textgenWebUIStreamURL?:string
textgenWebUIBlockingURL?:string
forceReplaceUrl?:string
forceReplaceUrl2?:string
promptPreprocess: boolean,
@@ -447,6 +454,8 @@ export interface botPreset{
ainconfig: AINsettings
koboldURL?: string
NAISettings?: NAISettings
autoSuggestPrompt?: string
autoSuggestPrefix?: string
}
export interface Database{
@@ -490,7 +499,8 @@ export interface Database{
zoomsize:number
lastup:string
customBackground:string
textgenWebUIURL:string
textgenWebUIStreamURL:string
textgenWebUIBlockingURL:string
autoTranslate: boolean
fullScreen:boolean
playMessage:boolean
@@ -555,7 +565,8 @@ export interface Database{
koboldURL:string
advancedBotSettings:boolean
useAutoSuggestions:boolean
autoSuggestPrompt:string,
autoSuggestPrompt:string
autoSuggestPrefix:string
claudeAPIKey:string,
useChatCopy:boolean,
novellistAPI:string,
@@ -678,7 +689,8 @@ interface OobaSettings{
epsilon_cutoff: number,
eta_cutoff: number,
formating:{
custom:boolean,
header:string,
systemPrefix:string,
userPrefix:string,
assistantPrefix:string
seperator:string
@@ -726,10 +738,11 @@ export const defaultOoba:OobaSettings = {
epsilon_cutoff: 0,
eta_cutoff: 0,
formating:{
custom:false,
userPrefix:'user:',
assistantPrefix:'assistant:',
seperator:'',
header: "Below is an instruction that describes a task. Write a response that appropriately completes the request.",
systemPrefix: "### Instruction:",
userPrefix: "### Input:",
assistantPrefix: "### Response:",
seperator:"",
useName:false,
}
}
@@ -751,7 +764,8 @@ export const presetTemplate:botPreset = {
aiModel: "gpt35",
subModel: "gpt35",
currentPluginProvider: "",
textgenWebUIURL: '',
textgenWebUIStreamURL: '',
textgenWebUIBlockingURL: '',
forceReplaceUrl: '',
forceReplaceUrl2: '',
promptPreprocess: false,
@@ -825,7 +839,8 @@ export function saveCurrentPreset(){
aiModel: db.aiModel,
subModel: db.subModel,
currentPluginProvider: db.currentPluginProvider,
textgenWebUIURL: db.textgenWebUIURL,
textgenWebUIStreamURL: db.textgenWebUIStreamURL,
textgenWebUIBlockingURL: db.textgenWebUIBlockingURL,
forceReplaceUrl: db.forceReplaceUrl,
forceReplaceUrl2: db.forceReplaceUrl2,
promptPreprocess: db.promptPreprocess,
@@ -879,7 +894,8 @@ export function setPreset(db:Database, newPres: botPreset){
db.aiModel = newPres.aiModel ?? db.aiModel
db.subModel = newPres.subModel ?? db.subModel
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.promptPreprocess = newPres.promptPreprocess ?? db.promptPreprocess
db.forceReplaceUrl2 = newPres.forceReplaceUrl2 ?? db.forceReplaceUrl2
@@ -891,6 +907,8 @@ export function setPreset(db:Database, newPres: botPreset){
db.openrouterRequestModel = newPres.openrouterRequestModel ?? db.openrouterRequestModel
db.proxyRequestModel = newPres.proxyRequestModel ?? db.proxyRequestModel
db.NAIsettings = newPres.NAISettings ?? db.NAIsettings
db.autoSuggestPrompt = newPres.autoSuggestPrompt ?? db.autoSuggestPrompt
db.autoSuggestPrefix = newPres.autoSuggestPrefix ?? db.autoSuggestPrefix
return db
}
@@ -902,7 +920,8 @@ export function downloadPreset(id:number){
pres.forceReplaceUrl = ''
pres.forceReplaceUrl2 = ''
pres.proxyKey = ''
pres.textgenWebUIURL= ''
pres.textgenWebUIStreamURL= ''
pres.textgenWebUIBlockingURL= ''
downloadFile(pres.name + "_preset.json", Buffer.from(JSON.stringify(pres, null, 2)))
alertNormal(language.successExport)
}

View File

@@ -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.
`
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 = `- "`