Add character card info in separate mode with muted filtering and scrollable Past Events
This commit is contained in:
@@ -122,7 +122,7 @@ export async function updateRPGData(renderUserStats, renderInfoBox, renderThough
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const prompt = generateSeparateUpdatePrompt();
|
const prompt = await generateSeparateUpdatePrompt();
|
||||||
|
|
||||||
// Generate using raw prompt (uses current preset, no chat history)
|
// Generate using raw prompt (uses current preset, no chat history)
|
||||||
const response = await generateRaw({
|
const response = await generateRaw({
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { getContext } from '../../../../../../extensions.js';
|
import { getContext } from '../../../../../../extensions.js';
|
||||||
import { chat, getCurrentChatDetails, characters, this_chid } from '../../../../../../../script.js';
|
import { chat, getCurrentChatDetails, characters, this_chid } from '../../../../../../../script.js';
|
||||||
import { selected_group, getGroupMembers } from '../../../../../../group-chats.js';
|
import { selected_group, getGroupMembers, getGroupChat } from '../../../../../../group-chats.js';
|
||||||
import { extensionSettings, committedTrackerData, FEATURE_FLAGS } from '../../core/state.js';
|
import { extensionSettings, committedTrackerData, FEATURE_FLAGS } from '../../core/state.js';
|
||||||
|
|
||||||
// Type imports
|
// Type imports
|
||||||
@@ -20,19 +20,31 @@ export const DEFAULT_HTML_PROMPT = `If appropriate, include inline HTML, CSS, an
|
|||||||
* Gets character card information for current chat (handles both single and group chats)
|
* Gets character card information for current chat (handles both single and group chats)
|
||||||
* @returns {string} Formatted character information
|
* @returns {string} Formatted character information
|
||||||
*/
|
*/
|
||||||
function getCharacterCardsInfo() {
|
async function getCharacterCardsInfo() {
|
||||||
let characterInfo = '';
|
let characterInfo = '';
|
||||||
|
|
||||||
// Check if in group chat
|
// Check if in group chat
|
||||||
if (selected_group) {
|
if (selected_group) {
|
||||||
|
const group = await getGroupChat(selected_group);
|
||||||
const groupMembers = getGroupMembers(selected_group);
|
const groupMembers = getGroupMembers(selected_group);
|
||||||
|
|
||||||
if (groupMembers && groupMembers.length > 0) {
|
if (groupMembers && groupMembers.length > 0) {
|
||||||
characterInfo += 'Characters in this roleplay:\n\n';
|
characterInfo += 'Characters in this roleplay:\n\n';
|
||||||
|
|
||||||
groupMembers.forEach((member, index) => {
|
// Filter out disabled (muted) members
|
||||||
|
const disabledMembers = group?.disabled_members || [];
|
||||||
|
let characterIndex = 0;
|
||||||
|
|
||||||
|
groupMembers.forEach((member) => {
|
||||||
if (!member || !member.name) return;
|
if (!member || !member.name) return;
|
||||||
|
|
||||||
characterInfo += `<character${index + 1}="${member.name}">\n`;
|
// Skip muted characters
|
||||||
|
if (member.avatar && disabledMembers.includes(member.avatar)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
characterIndex++;
|
||||||
|
characterInfo += `<character${characterIndex}="${member.name}">\n`;
|
||||||
|
|
||||||
if (member.description) {
|
if (member.description) {
|
||||||
characterInfo += `${member.description}\n`;
|
characterInfo += `${member.description}\n`;
|
||||||
@@ -42,7 +54,7 @@ function getCharacterCardsInfo() {
|
|||||||
characterInfo += `${member.personality}\n`;
|
characterInfo += `${member.personality}\n`;
|
||||||
}
|
}
|
||||||
|
|
||||||
characterInfo += `</character${index + 1}>\n\n`;
|
characterInfo += `</character${characterIndex}>\n\n`;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (this_chid !== undefined && characters && characters[this_chid]) {
|
} else if (this_chid !== undefined && characters && characters[this_chid]) {
|
||||||
@@ -520,7 +532,7 @@ export function generateRPGPromptText() {
|
|||||||
*
|
*
|
||||||
* @returns {Array<{role: string, content: string}>} Array of message objects for API
|
* @returns {Array<{role: string, content: string}>} Array of message objects for API
|
||||||
*/
|
*/
|
||||||
export function generateSeparateUpdatePrompt() {
|
export async function generateSeparateUpdatePrompt() {
|
||||||
const depth = extensionSettings.updateDepth;
|
const depth = extensionSettings.updateDepth;
|
||||||
const userName = getContext().name1;
|
const userName = getContext().name1;
|
||||||
|
|
||||||
@@ -531,7 +543,7 @@ export function generateSeparateUpdatePrompt() {
|
|||||||
systemMessage += `You should maintain an objective tone.\n\n`;
|
systemMessage += `You should maintain an objective tone.\n\n`;
|
||||||
|
|
||||||
// Add character card information
|
// Add character card information
|
||||||
const characterInfo = getCharacterCardsInfo();
|
const characterInfo = await getCharacterCardsInfo();
|
||||||
if (characterInfo) {
|
if (characterInfo) {
|
||||||
systemMessage += characterInfo + '\n\n';
|
systemMessage += characterInfo + '\n\n';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1520,6 +1520,28 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
|
|||||||
padding: 0.25em 0.75em 0.5em 0.75em;
|
padding: 0.25em 0.75em 0.5em 0.75em;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
max-height: 100%;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-notebook-lines::-webkit-scrollbar {
|
||||||
|
width: 0.188rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-notebook-lines::-webkit-scrollbar-track {
|
||||||
|
background: var(--rpg-bg);
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-notebook-lines::-webkit-scrollbar-thumb {
|
||||||
|
background: var(--rpg-highlight);
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-notebook-lines::-webkit-scrollbar-thumb:hover {
|
||||||
|
background: var(--rpg-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.rpg-notebook-line {
|
.rpg-notebook-line {
|
||||||
|
|||||||
Reference in New Issue
Block a user