Improve account and Add priority
This commit is contained in:
@@ -734,4 +734,5 @@ export const languageEnglish = {
|
|||||||
enableJsonSchema: "Enable Schema",
|
enableJsonSchema: "Enable Schema",
|
||||||
strictJsonSchema: "Strict Schema",
|
strictJsonSchema: "Strict Schema",
|
||||||
extractJson: "Extract JSON",
|
extractJson: "Extract JSON",
|
||||||
|
reloadSession: "Newer version of save data is found. reloading the session...",
|
||||||
}
|
}
|
||||||
@@ -288,8 +288,9 @@ export async function loadLoreBookV3Prompt(){
|
|||||||
pos:string,
|
pos:string,
|
||||||
prompt:string
|
prompt:string
|
||||||
role:'system'|'user'|'assistant'
|
role:'system'|'user'|'assistant'
|
||||||
priority:number
|
order:number
|
||||||
tokens:number
|
tokens:number
|
||||||
|
priority:number
|
||||||
}[] = []
|
}[] = []
|
||||||
let activatedIndexes:number[] = []
|
let activatedIndexes:number[] = []
|
||||||
let disabledUIPrompts:string[] = []
|
let disabledUIPrompts:string[] = []
|
||||||
@@ -307,6 +308,7 @@ export async function loadLoreBookV3Prompt(){
|
|||||||
let pos = ''
|
let pos = ''
|
||||||
let depth = 0
|
let depth = 0
|
||||||
let scanDepth = loreDepth
|
let scanDepth = loreDepth
|
||||||
|
let order = fullLore[i].insertorder
|
||||||
let priority = fullLore[i].insertorder
|
let priority = fullLore[i].insertorder
|
||||||
let forceState:string = 'none'
|
let forceState:string = 'none'
|
||||||
let role:'system'|'user'|'assistant' = 'system'
|
let role:'system'|'user'|'assistant' = 'system'
|
||||||
@@ -434,6 +436,10 @@ export async function loadLoreBookV3Prompt(){
|
|||||||
activated = false
|
activated = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case 'priority':{
|
||||||
|
priority = parseInt(arg[0])
|
||||||
|
return
|
||||||
|
}
|
||||||
default:{
|
default:{
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -486,8 +492,9 @@ export async function loadLoreBookV3Prompt(){
|
|||||||
pos: pos,
|
pos: pos,
|
||||||
prompt: content,
|
prompt: content,
|
||||||
role: role,
|
role: role,
|
||||||
priority: priority,
|
order: order,
|
||||||
tokens: await tokenize(content)
|
tokens: await tokenize(content),
|
||||||
|
priority: priority
|
||||||
})
|
})
|
||||||
activatedIndexes.push(i)
|
activatedIndexes.push(i)
|
||||||
if(recursiveScanning){
|
if(recursiveScanning){
|
||||||
@@ -512,8 +519,12 @@ export async function loadLoreBookV3Prompt(){
|
|||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const activesResorted = activesFiltered.sort((a,b) => {
|
||||||
|
return b.order - a.order
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
actives: activesFiltered.reverse()
|
actives: activesResorted.reverse()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ import { get, writable } from "svelte/store"
|
|||||||
import { DataBase } from "./database"
|
import { DataBase } from "./database"
|
||||||
import { hubURL } from "../characterCards"
|
import { hubURL } from "../characterCards"
|
||||||
import localforage from "localforage"
|
import localforage from "localforage"
|
||||||
import { alertLogin, alertStore } from "../alert"
|
import { alertError, alertLogin, alertStore, alertWait } from "../alert"
|
||||||
import { forageStorage, getUnpargeables, replaceDbResources } from "./globalApi"
|
import { forageStorage, getUnpargeables, replaceDbResources } from "./globalApi"
|
||||||
import { encodeRisuSave } from "./risuSave"
|
import { encodeRisuSave } from "./risuSave"
|
||||||
import { v4 } from "uuid"
|
import { v4 } from "uuid"
|
||||||
|
import { language } from "src/lang"
|
||||||
|
|
||||||
export const AccountWarning = writable('')
|
export const AccountWarning = writable('')
|
||||||
|
const risuSession = Date.now().toFixed(0)
|
||||||
|
|
||||||
let seenWarnings:string[] = []
|
let seenWarnings:string[] = []
|
||||||
|
|
||||||
@@ -26,7 +28,8 @@ export class AccountStorage{
|
|||||||
'content-type': 'application/json',
|
'content-type': 'application/json',
|
||||||
'x-risu-key': key,
|
'x-risu-key': key,
|
||||||
'x-risu-auth': this.auth,
|
'x-risu-auth': this.auth,
|
||||||
'X-Format': 'nocheck'
|
'X-Format': 'nocheck',
|
||||||
|
'x-risu-session': risuSession
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if(da.headers.get('Content-Type') === 'application/json'){
|
if(da.headers.get('Content-Type') === 'application/json'){
|
||||||
@@ -37,6 +40,11 @@ export class AccountStorage{
|
|||||||
AccountWarning.set(json.warning)
|
AccountWarning.set(json.warning)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(json?.reloadSession){
|
||||||
|
alertWait(language.reloadSession)
|
||||||
|
location.reload()
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(da.status === 304){
|
if(da.status === 304){
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { checkRisuUpdate } from "../update";
|
|||||||
import { MobileGUI, botMakerMode, selectedCharID } from "../stores";
|
import { MobileGUI, botMakerMode, selectedCharID } from "../stores";
|
||||||
import { Body, ResponseType, fetch as TauriFetch } from "@tauri-apps/api/http";
|
import { Body, ResponseType, fetch as TauriFetch } from "@tauri-apps/api/http";
|
||||||
import { loadPlugins } from "../plugins/plugins";
|
import { loadPlugins } from "../plugins/plugins";
|
||||||
import { alertConfirm, alertError, alertNormal, alertNormalWait, alertSelect, alertTOS } from "../alert";
|
import { alertConfirm, alertError, alertNormal, alertNormalWait, alertSelect, alertTOS, alertWait } from "../alert";
|
||||||
import { checkDriverInit, syncDrive } from "../drive/drive";
|
import { checkDriverInit, syncDrive } from "../drive/drive";
|
||||||
import { hasher } from "../parser";
|
import { hasher } from "../parser";
|
||||||
import { characterURLImport, hubURL } from "../characterCards";
|
import { characterURLImport, hubURL } from "../characterCards";
|
||||||
@@ -299,8 +299,8 @@ export async function saveDb(){
|
|||||||
}
|
}
|
||||||
if(!gotChannel){
|
if(!gotChannel){
|
||||||
gotChannel = true
|
gotChannel = true
|
||||||
await alertNormalWait(language.activeTabChange)
|
alertWait(language.activeTabChange)
|
||||||
gotChannel = false
|
location.reload()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user