Center globe icon

This commit is contained in:
maver
2023-07-28 15:23:15 +02:00
parent f0830e7bb4
commit 222fd3429d
3 changed files with 15 additions and 13 deletions

View File

@ -29,6 +29,11 @@
color: var(--white50a); color: var(--white50a);
} }
#completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt .completion_prompt_manager_prompt_name .fa-solid.fa-globe {
/* For a special kind of people */
padding-left: 0.4em;
}
#completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt_invisible { #completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt_invisible {
display: none; display: none;
} }

View File

@ -3,9 +3,7 @@ import {TokenHandler} from "./openai.js";
import {power_user} from "./power-user.js"; import {power_user} from "./power-user.js";
/** /**
* Register migrations for the prompt manager when settings are loaded or an open ai preset is loaded. * Register migrations for the prompt manager when settings are loaded or an Open AI preset is loaded.
*
* @function registerPromptManagerMigration
*/ */
const registerPromptManagerMigration = () => { const registerPromptManagerMigration = () => {
const migrate = (settings) => { const migrate = (settings) => {
@ -893,7 +891,8 @@ PromptManagerModule.prototype.getPromptIndexById = function (identifier) {
} }
/** /**
* Prepares a prompt by creating a new object with its role and content. * Enriches a generic object, creating a new prompt object in the process
*
* @param {Object} prompt - Prompt object * @param {Object} prompt - Prompt object
* @param original * @param original
* @returns {Object} An object with "role" and "content" properties * @returns {Object} An object with "role" and "content" properties
@ -967,6 +966,7 @@ PromptManagerModule.prototype.loadMessagesIntoInspectForm = function (messages)
let drawerHTML = ` let drawerHTML = `
<div class="inline-drawer ${this.configuration.prefix}prompt_manager_prompt"> <div class="inline-drawer ${this.configuration.prefix}prompt_manager_prompt">
<div class="inline-drawer-toggle inline-drawer-header"> <div class="inline-drawer-toggle inline-drawer-header">
<span>${title}</span>
<span>${title}</span> <span>${title}</span>
<div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div> <div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div>
</div> </div>
@ -1122,9 +1122,6 @@ PromptManagerModule.prototype.renderPromptManager = function () {
promptManagerDiv.insertAdjacentHTML('beforeend', ` promptManagerDiv.insertAdjacentHTML('beforeend', `
<div class="range-block-title" data-i18n="Prompts"> <div class="range-block-title" data-i18n="Prompts">
Prompts Prompts
<a href="/notes#openaipromptmanager" target="_blank" class="notes-link">
<span class="note-link-span">?</span>
</a>
</div> </div>
<div class="range-block"> <div class="range-block">
${this.error ? errorDiv : ''} ${this.error ? errorDiv : ''}

View File

@ -629,8 +629,8 @@ function populateChatCompletion (prompts, chatCompletion, {bias, quietPrompt, ty
* @returns {Object} prompts - The prepared and merged system and user-defined prompts. * @returns {Object} prompts - The prepared and merged system and user-defined prompts.
*/ */
function preparePromptsForChatCompletion(Scenario, charPersonality, name2, worldInfoBefore, worldInfoAfter, charDescription, quietPrompt, bias, extensionPrompts) { function preparePromptsForChatCompletion(Scenario, charPersonality, name2, worldInfoBefore, worldInfoAfter, charDescription, quietPrompt, bias, extensionPrompts) {
const scenarioText = Scenario ? `Circumstances and context of the dialogue: ${Scenario}` : ''; const scenarioText = Scenario ? `[Circumstances and context of the dialogue: ${Scenario}]` : '';
const charPersonalityText = charPersonality ? `${name2}'s personality: ${charPersonality}` : ''; const charPersonalityText = charPersonality ? `[${name2}'s personality: ${charPersonality}]` : '';
// Create entries for system prompts // Create entries for system prompts
const systemPrompts = [ const systemPrompts = [
@ -757,7 +757,7 @@ function prepareOpenAIMessages({
chatCompletion.setTokenBudget(userSettings.openai_max_context, userSettings.openai_max_tokens); chatCompletion.setTokenBudget(userSettings.openai_max_context, userSettings.openai_max_tokens);
try { try {
// Populate markers, merge markers and ordered user prompts with system prompts // Merge markers and ordered user prompts with system prompts
const prompts = preparePromptsForChatCompletion(Scenario, charPersonality, name2, worldInfoBefore, worldInfoAfter, charDescription, quietPrompt, bias, extensionPrompts); const prompts = preparePromptsForChatCompletion(Scenario, charPersonality, name2, worldInfoBefore, worldInfoAfter, charDescription, quietPrompt, bias, extensionPrompts);
// Fill the chat completion with as much context as the budget allows // Fill the chat completion with as much context as the budget allows
@ -770,9 +770,9 @@ function prepareOpenAIMessages({
} else if (error instanceof InvalidCharacterNameError) { } else if (error instanceof InvalidCharacterNameError) {
toastr.warning('An error occurred while counting tokens: Invalid character name') toastr.warning('An error occurred while counting tokens: Invalid character name')
chatCompletion.log('Invalid character name'); chatCompletion.log('Invalid character name');
promptManager.error = 'The name of at least one character contained whitespaces or special characters. Please check your user and character name'; promptManager.error = 'The name of at least one character contained whitespaces or special characters. Please check your user and character name.';
} else { } else {
toastr.error('An unknown error occurred while counting tokens. Further information available in console.') toastr.error('An unknown error occurred while counting tokens. Further information may be available in console.')
chatCompletion.log('Unexpected error:'); chatCompletion.log('Unexpected error:');
chatCompletion.log(error); chatCompletion.log(error);
} }
@ -780,7 +780,7 @@ function prepareOpenAIMessages({
// Pass chat completion to prompt manager for inspection // Pass chat completion to prompt manager for inspection
promptManager.setChatCompletion(chatCompletion); promptManager.setChatCompletion(chatCompletion);
// All information are up-to-date, render. // All information is up-to-date, render.
if (false === dryRun) promptManager.render(false); if (false === dryRun) promptManager.render(false);
} }