refactor persona prompt
This commit is contained in:
@@ -7,7 +7,7 @@ import { get } from 'svelte/store';
|
||||
import css from '@adobe/css-tools'
|
||||
import { CurrentCharacter, CurrentChat, SizeStore, selectedCharID } from './stores';
|
||||
import { calcString } from './process/infunctions';
|
||||
import { findCharacterbyId, getUserIcon, getUserName, parseKeyValue, sfc32, sleep, uuidtoNumber } from './util';
|
||||
import { findCharacterbyId, getPersonaPrompt, getUserIcon, getUserName, parseKeyValue, sfc32, sleep, uuidtoNumber } from './util';
|
||||
import { getInlayImage, writeInlayImage } from './process/files/image';
|
||||
import { getModuleLorebooks } from './process/modules';
|
||||
import { HypaProcesser } from './process/memory/hypamemory';
|
||||
@@ -700,7 +700,7 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
|
||||
}
|
||||
case 'persona':
|
||||
case 'user_persona':{
|
||||
return db.personaPrompt
|
||||
return getPersonaPrompt()
|
||||
}
|
||||
case 'main_prompt':
|
||||
case 'system_prompt':{
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ChatTokenizer, tokenize, tokenizeNum } from "../tokenizer";
|
||||
import { language } from "../../lang";
|
||||
import { alertError } from "../alert";
|
||||
import { loadLoreBookPrompt, loadLoreBookV3Prompt } from "./lorebook";
|
||||
import { findCharacterbyId, getAuthorNoteDefaultText, getUserName, isLastCharPunctuation, trimUntilPunctuation } from "../util";
|
||||
import { findCharacterbyId, getAuthorNoteDefaultText, getPersonaPrompt, getUserName, isLastCharPunctuation, trimUntilPunctuation } from "../util";
|
||||
import { requestChatData } from "./request";
|
||||
import { stableDiff } from "./stableDiff";
|
||||
import { processScript, processScriptFull, risuChatParser } from "./scripts";
|
||||
@@ -372,7 +372,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
||||
if(db.personaPrompt){
|
||||
unformated.personaPrompt.push({
|
||||
role: 'system',
|
||||
content: risuChatParser(db.personaPrompt, {chara: currentChar})
|
||||
content: risuChatParser(getPersonaPrompt(), {chara: currentChar})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ export function getUserIcon(){
|
||||
return db.userIcon ?? ''
|
||||
}
|
||||
|
||||
export function getUserPersonaDesc(){
|
||||
export function getPersonaPrompt(){
|
||||
const db = get(DataBase)
|
||||
return db.personaPrompt ?? ''
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user