diff --git a/public/index.html b/public/index.html
index ec9b8f7a1..c4cc65b1f 100644
--- a/public/index.html
+++ b/public/index.html
@@ -5512,8 +5512,14 @@
SillyTavern is aimed at advanced users.
-
- If you're new to this, enable the simplified UI mode below.
+
+
+ If you're new to this, enable the simplified UI mode below.
+
+
+
+ Change it later in the 'User Settings' panel.
+
+
+
+ Looking for AI characters?
+
+
+
+
+ from supported sources or view
+
+
+
+
Your Persona
@@ -5528,6 +5552,7 @@
Before you get started, you must select a persona name.
+
This can be changed at any time via the
icon.
Persona Name:
diff --git a/public/script.js b/public/script.js
index 59d60b325..708b9eeae 100644
--- a/public/script.js
+++ b/public/script.js
@@ -224,7 +224,7 @@ import { appendFileContent, hasPendingFileAttachment, populateFileAttachment, de
import { initPresetManager } from './scripts/preset-manager.js';
import { evaluateMacros } from './scripts/macros.js';
import { currentUser, setUserControls } from './scripts/user.js';
-import { callGenericPopup } from './scripts/popup.js';
+import { POPUP_TYPE, callGenericPopup } from './scripts/popup.js';
import { renderTemplate, renderTemplateAsync } from './scripts/templates.js';
import { ScraperManager } from './scripts/scrapers.js';
@@ -418,6 +418,7 @@ export const event_types = {
SMOOTH_STREAM_TOKEN_RECEIVED: 'smooth_stream_token_received',
FILE_ATTACHMENT_DELETED: 'file_attachment_deleted',
WORLDINFO_FORCE_ACTIVATE: 'worldinfo_force_activate',
+ OPEN_CHARACTER_LIBRARY: 'open_character_library',
};
export const eventSource = new EventEmitter();
@@ -5932,7 +5933,7 @@ async function doOnboarding(avatarId) {
template.find('input[name="enable_simple_mode"]').on('input', function () {
simpleUiMode = $(this).is(':checked');
});
- let userName = await callPopup(template, 'input', currentUser?.name || name1);
+ let userName = await callGenericPopup(template, POPUP_TYPE.INPUT, currentUser?.name || name1, { rows: 2 });
if (userName) {
userName = userName.replace('\n', ' ');
@@ -6110,15 +6111,6 @@ export async function getSettings() {
//Load User's Name and Avatar
initUserAvatar(settings.user_avatar);
-
- firstRun = !!settings.firstRun;
-
- if (firstRun) {
- hideLoader();
- await doOnboarding(user_avatar);
- firstRun = false;
- }
-
setPersonaDescription();
//Load the active character and group
@@ -6138,6 +6130,14 @@ export async function getSettings() {
await loadExtensionSettings(settings, isVersionChanged);
eventSource.emit(event_types.EXTENSION_SETTINGS_LOADED);
}
+
+ firstRun = !!settings.firstRun;
+
+ if (firstRun) {
+ hideLoader();
+ await doOnboarding(user_avatar);
+ firstRun = false;
+ }
}
settingsReady = true;
@@ -10254,7 +10254,7 @@ jQuery(async function () {
userStatsHandler();
});
- $('#external_import_button').on('click', async () => {
+ $(document).on('click', '.external_import_button, #external_import_button', async () => {
const html = `Enter the URL of the content to import
Supported sources:
@@ -10265,7 +10265,7 @@ jQuery(async function () {
- AICharacterCard.com Character (Direct Link or ID)
Example: AICC/aicharcards/the-game-master
- Direct PNG Link (refer to
config.yaml
for allowed hosts)
Example: https://files.catbox.moe/notarealfile.png
`;
- const input = await callPopup(html, 'input', '', { okButton: 'Import', rows: 4 });
+ const input = await callGenericPopup(html, POPUP_TYPE.INPUT, '', { okButton: 'Import', rows: 4 });
if (!input) {
console.debug('Custom content import cancelled');
@@ -10355,6 +10355,11 @@ jQuery(async function () {
showMoreMessages();
});
+ $(document).on('click', '.open_characters_library', async function () {
+ await getCharacters();
+ eventSource.emit(event_types.OPEN_CHARACTER_LIBRARY);
+ });
+
// Added here to prevent execution before script.js is loaded and get rid of quirky timeouts
await firstLoadInit();
diff --git a/public/scripts/extensions/assets/character.html b/public/scripts/extensions/assets/character.html
new file mode 100644
index 000000000..152aeb9c0
--- /dev/null
+++ b/public/scripts/extensions/assets/character.html
@@ -0,0 +1,9 @@
+
+
{{name}}
+

+
{{description}}
+
+
+
+
+
diff --git a/public/scripts/extensions/assets/index.js b/public/scripts/extensions/assets/index.js
index a44b31727..97377a0bd 100644
--- a/public/scripts/extensions/assets/index.js
+++ b/public/scripts/extensions/assets/index.js
@@ -3,8 +3,9 @@ TODO:
*/
//const DEBUG_TONY_SAMA_FORK_MODE = true
-import { getRequestHeaders, callPopup, processDroppedFiles } from '../../../script.js';
+import { getRequestHeaders, callPopup, processDroppedFiles, eventSource, event_types } from '../../../script.js';
import { deleteExtension, extensionNames, getContext, installExtension, renderExtensionTemplateAsync } from '../../extensions.js';
+import { POPUP_TYPE, callGenericPopup } from '../../popup.js';
import { executeSlashCommands } from '../../slash-commands.js';
import { getStringHash, isValidUrl } from '../../utils.js';
export { MODULE_NAME };
@@ -328,6 +329,41 @@ async function deleteAsset(assetType, filename) {
}
}
+async function openCharacterBrowser(forceDefault) {
+ const url = forceDefault ? ASSETS_JSON_URL : String($('#assets-json-url-field').val());
+ const fetchResult = await fetch(url, { cache: 'no-cache' });
+ const json = await fetchResult.json();
+ const characters = json.filter(x => x.type === 'character');
+
+ if (!characters.length) {
+ toastr.error('No characters found in the assets list', 'Character browser');
+ return;
+ }
+
+ const listElement = $(document.createElement('div'));
+ listElement.addClass('characterAssetList');
+
+ for (const character of characters) {
+ const characterElement = $(await renderExtensionTemplateAsync(MODULE_NAME, 'character', character));
+ const downloadButton = characterElement.find('.characterAssetDownloadButton');
+ const checkMark = characterElement.find('.characterAssetCheckMark');
+ const isInstalled = isAssetInstalled('character', character.id);
+
+ downloadButton.toggle(!isInstalled).on('click', async () => {
+ downloadButton.toggleClass('fa-download fa-spinner fa-spin');
+ await installAsset(character.url, 'character', character.id);
+ downloadButton.hide();
+ checkMark.show();
+ });
+
+ checkMark.toggle(isInstalled);
+
+ listElement.append(characterElement);
+ }
+
+ callGenericPopup(listElement, POPUP_TYPE.TEXT, '', { okButton: 'Close', wide: true, large: true, allowVerticalScrolling: true, allowHorizontalScrolling: false });
+}
+
//#############################//
// API Calls //
//#############################//
@@ -397,4 +433,8 @@ jQuery(async () => {
windowHtml.find('#assets_filters').hide();
$('#extensions_settings').append(windowHtml);
+
+ eventSource.on(event_types.OPEN_CHARACTER_LIBRARY, async (forceDefault) => {
+ openCharacterBrowser(forceDefault);
+ });
});
diff --git a/public/scripts/extensions/assets/style.css b/public/scripts/extensions/assets/style.css
index 7ccaa17a7..d849c7e68 100644
--- a/public/scripts/extensions/assets/style.css
+++ b/public/scripts/extensions/assets/style.css
@@ -105,3 +105,55 @@
transform: rotate(1turn);
}
}
+
+.characterAssetList {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: space-evenly;
+}
+
+.characterAsset {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 10px;
+ gap: 10px;
+ border: 1px solid var(--SmartThemeBorderColor);
+ background-color: var(--black30a);
+ border-radius: 10px;
+ width: 17%;
+ min-width: 150px;
+ margin: 5px;
+ overflow: hidden;
+}
+
+.characterAssetName {
+ font-size: 1.2em;
+ font-weight: bold;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.characterAssetImage {
+ aspect-ratio: 3/4;
+ max-height: 140px;
+ object-fit: cover;
+ border-radius: 5px;
+}
+
+.characterAssetDescription {
+ font-size: 0.75em;
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 4;
+ flex: 1;
+}
+
+.characterAssetButtons {
+ display: flex;
+ flex-direction: row;
+ gap: 5px;
+ align-items: center;
+}
diff --git a/public/style.css b/public/style.css
index 7ac30cfdf..81d8c2c08 100644
--- a/public/style.css
+++ b/public/style.css
@@ -1629,6 +1629,10 @@ select option:not(:checked) {
max-width: 4em;
}
+#persona-management-block .paginationjs-nav {
+ width: max-content;
+}
+
input[type=search]::-webkit-search-cancel-button {
-webkit-appearance: none;
height: 1em;
@@ -4001,6 +4005,10 @@ body:not(.movingUI) .drawer-content.maximized {
text-align: left;
}
+.onboarding span.menu_button {
+ display: inline-flex;
+}
+
.onboarding>h3 {
align-self: center;
}