refactor name and icon get

This commit is contained in:
kwaroran
2024-07-29 23:36:52 +09:00
parent 47c3fab589
commit 9d5b5da351
13 changed files with 73 additions and 45 deletions

View File

@@ -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, isLastCharPunctuation, trimUntilPunctuation } from "../util";
import { findCharacterbyId, getAuthorNoteDefaultText, getUserName, isLastCharPunctuation, trimUntilPunctuation } from "../util";
import { requestChatData } from "./request";
import { stableDiff } from "./stableDiff";
import { processScript, processScriptFull, risuChatParser } from "./scripts";
@@ -574,7 +574,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
}
}
const examples = exampleMessage(currentChar, db.username)
const examples = exampleMessage(currentChar, getUserName())
for(const example of examples){
currentTokens += await tokenizer.tokenizeChat(example)
@@ -634,7 +634,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
}
}
else if(msg.role === 'user'){
name = `${db.username}`
name = `${getUserName()}`
}
if(!msg.chatId){
msg.chatId = v4()