Change first message to chat dependent

This commit is contained in:
kwaroran
2024-09-18 23:25:02 +09:00
parent 6ad841e931
commit 85609e890e
15 changed files with 50 additions and 61 deletions

View File

@@ -612,7 +612,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{
}
if(nowChatroom.type !== 'group'){
const firstMsg = nowChatroom.firstMsgIndex === -1 ? nowChatroom.firstMessage : nowChatroom.alternateGreetings[nowChatroom.firstMsgIndex]
const firstMsg = currentChat.fmIndex === -1 ? nowChatroom.firstMessage : nowChatroom.alternateGreetings[currentChat.fmIndex]
const chat:OpenAIChat = {
role: 'assistant',

View File

@@ -383,7 +383,7 @@ export async function loadLoreBookV3Prompt(){
if(Number.isNaN(int)){
return false
}
if(((char.firstMsgIndex ?? -1) + 1) !== int){
if(((char.chats[page].fmIndex ?? -1) + 1) !== int){
activated = false
}
}

View File

@@ -2,7 +2,7 @@ import { getChatVar, hasher, risuChatParser, setChatVar, type simpleCharacterArg
import { LuaEngine, LuaFactory } from "wasmoon";
import { DataBase, setDatabase, type Chat, type character, type groupChat } from "../storage/database";
import { get } from "svelte/store";
import { CurrentCharacter, CurrentChat, CurrentVariablePointer, ReloadGUIPointer, selectedCharID } from "../stores";
import { CurrentCharacter, CurrentChat, ReloadGUIPointer, selectedCharID } from "../stores";
import { alertError, alertInput, alertNormal } from "../alert";
import { HypaProcesser } from "./memory/hypamemory";
import { generateAIImage } from "./stableDiff";

View File

@@ -180,7 +180,7 @@ export async function processScriptFull(char:character|groupChat|simpleCharacter
const v = outScript.split(' ', 2)[1]
const selchar = db.characters[get(selectedCharID)]
const chat = selchar.chats[selchar.chatPage]
let lastChat = selchar.firstMsgIndex === -1 ? selchar.firstMessage : selchar.alternateGreetings[selchar.firstMsgIndex]
let lastChat = chat.fmIndex === -1 ? selchar.firstMessage : selchar.alternateGreetings[chat.fmIndex]
let pointer = chatID - 1
while(pointer >= 0){
if(chat.message[pointer].role === chat.message[chatID].role){