Merge branch 'staging' into fix/raw-quotes

c673ebcc229f8dc9e8a741778d1f0d5554c8bbdd

Cohee <18619528+Cohee1207@users.noreply.github.com>

6 files changed, +15 -64Showing whitespace changes
.github/workflows/issues-updates-on-merge.yml+3 -3
@@ -36,10 +36,10 @@ jobs:
3636 for ISSUE in $(echo $issues | jq -r '.[]'); do
3737 if [ "${{ github.ref }}" == "refs/heads/staging" ]; then
3838 LABEL="βœ… Done (staging)"
3939 gh issue edit $ISSUE -R ${{ github.repository }} --add-label "$LABEL" --remove-label "πŸ§‘β€πŸ’» In Progress"
4040 elif [ "${{ github.ref }}" == "refs/heads/release" ]; then
4141 LABEL="βœ… Done"
4242 gh issue edit $ISSUE -R ${{ github.repository }} --add-label "$LABEL" --remove-label "πŸ§‘β€πŸ’» In Progress"
4343 fi
4444 echo "Added label '$LABEL' to(and removed 'πŸ§‘β€πŸ’» In Progress' if present) in issue #$ISSUE"
4545 done
.github/workflows/pr-auto-manager.yml+2 -2
@@ -262,6 +262,6 @@ jobs:
262262 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
263263 run: |
264264 for ISSUE in $(echo $final_issues | jq -r '.[]'); do
265265 gh issue edit $ISSUE -R ${{ github.repository }} --add-label "βœ… Done (staging)" --remove-label "πŸ§‘β€πŸ’» In Progress"
266266 echo "Added label 'βœ… Done (staging)' to(and removed 'πŸ§‘β€πŸ’» In Progress' if present) in issue #$ISSUE"
267267 done
public/scripts/PromptManager.js+2 -30
@@ -1,6 +1,6 @@
11'use strict';
22
33import { DOMPurify, Popper } from '../lib.js';
44
55import { event_types, eventSource, is_send_press, main_api, substituteParams } from '../script.js';
66import { is_group_generating } from './group-chats.js';
@@ -1440,36 +1440,8 @@ class PromptManager {
14401440 footerDiv.querySelector('select').selectedIndex = selectedPromptIndex;
14411441
14421442 // Add prompt export dialogue and options
1443-
1444- const exportForCharacter = await renderTemplateAsync('promptManagerExportForCharacter');
1445- const exportPopup = await renderTemplateAsync('promptManagerExportPopup', { isGlobalStrategy: 'global' === this.configuration.promptOrder.strategy, exportForCharacter });
1446- rangeBlockDiv.insertAdjacentHTML('beforeend', exportPopup);
1447-
1448- // Destroy previous popper instance if it exists
1449- if (this.exportPopper) {
1450- this.exportPopper.destroy();
1451- }
1452-
1453- this.exportPopper = Popper.createPopper(
1454- document.getElementById('prompt-manager-export'),
1455- document.getElementById('prompt-manager-export-format-popup'),
1456- { placement: 'bottom' },
1457- );
1458-
1459- const showExportSelection = () => {
1460- const popup = document.getElementById('prompt-manager-export-format-popup');
1461- const show = popup.hasAttribute('data-show');
1462-
1463- if (show) popup.removeAttribute('data-show');
1464- else popup.setAttribute('data-show', '');
1465-
1466- this.exportPopper.update();
1467- };
1468-
14691443 footerDiv.querySelector('#prompt-manager-import').addEventListener('click', this.handleImport);
14701444 footerDiv.querySelector('#prompt-manager-export').addEventListener('click', showExportSelectionthis.handleFullExport);
1471- rangeBlockDiv.querySelector('.export-promptmanager-prompts-full').addEventListener('click', this.handleFullExport);
1472- rangeBlockDiv.querySelector('.export-promptmanager-prompts-character')?.addEventListener('click', this.handleCharacterExport);
14731445 }
14741446 }
14751447
public/scripts/personas.js+8 -13
@@ -111,6 +111,7 @@ export function setUserAvatar(imgfile, { toastPersonaNameChange = true, navigate
111111 reloadUserAvatar();
112112 updatePersonaUIStates({ navigateToCurrent: navigateToCurrent });
113113 selectCurrentPersona({ toastPersonaNameChange: toastPersonaNameChange });
114+ retriggerFirstMessageOnEmptyChat();
114115 saveSettingsDebounced();
115116 $('.zoomed_avatar[forchar]').remove();
116117}
@@ -465,7 +466,7 @@ export function initPersona(avatarId, personaName, personaDescription) {
465466 * @returns {Promise<boolean>} A promise that resolves to true if the character was converted, false otherwise.
466467 */
467468export async function convertCharacterToPersona(characterId = null) {
468469 if (null === characterId) characterId = Number(this_chid);
469470
470471 const avatarUrl = characters[characterId]?.avatar;
471472 if (!avatarUrl) {
@@ -1243,7 +1244,7 @@ function getPersonaStates(avatarId) {
12431244 /** @type {PersonaConnection[]} */
12441245 const connections = power_user.persona_descriptions[avatarId]?.connections;
12451246 const hasCharLock = !!connections?.some(c =>
12461247 (!selected_group && c.type === 'character' && c.id === characters[Number(this_chid)]?.avatar)
12471248 || (selected_group && c.type === 'group' && c.id === selected_group));
12481249
12491250 return {
@@ -1481,7 +1482,7 @@ async function loadPersonaForCurrentChat({ doRender = false } = {}) {
14811482 * @returns {string[]} - An array of persona keys that are connected to the given character key
14821483 */
14831484export function getConnectedPersonas(characterKey = undefined) {
14841485 characterKey ??= selected_group || characters[Number(this_chid)]?.avatar;
14851486 const connectedPersonas = Object.entries(power_user.persona_descriptions)
14861487 .filter(([_, desc]) => desc.connections?.some(conn => conn.type === 'character' && conn.id === characterKey))
14871488 .map(([key, _]) => key);
@@ -1513,7 +1514,7 @@ export async function showCharConnections() {
15131514 console.log(`Unlocking persona ${personaId} from current character ${name2}`);
15141515 power_user.persona_descriptions[personaId].connections = connections.filter(c => {
15151516 if (menu_type == 'group_edit' && c.type == 'group' && c.id == selected_group) return false;
15161517 else if (c.type == 'character' && c.id == characters[Number(this_chid)]?.avatar) return false;
15171518 return true;
15181519 });
15191520 saveSettingsDebounced();
@@ -1545,8 +1546,8 @@ export async function showCharConnections() {
15451546export function getCurrentConnectionObj() {
15461547 if (selected_group)
15471548 return { type: 'group', id: selected_group };
15481549 if (characters[Number(this_chid)]?.avatar)
15491550 return { type: 'character', id: characters[Number(this_chid)]?.avatar };
15501551 return null;
15511552}
15521553
@@ -1664,7 +1665,7 @@ async function syncUserNameToPersona() {
16641665 * Only works if only the first message is present, and not in group mode.
16651666 */
16661667export function retriggerFirstMessageOnEmptyChat() {
16671668 if (Number(this_chid) >= 0 && !selected_group && chat.length === 1) {
16681669 $('#firstmessage_textarea').trigger('input');
16691670 }
16701671}
@@ -1782,7 +1783,6 @@ function setNameCallback({ mode = 'all' }, name) {
17821783 if (!persona) persona = Object.entries(power_user.personas).find(([_, personaName]) => personaName.toLowerCase() === name.toLowerCase())?.[1];
17831784 if (persona) {
17841785 autoSelectPersona(persona);
1785- retriggerFirstMessageOnEmptyChat();
17861786 return '';
17871787 } else if (mode === 'lookup') {
17881788 toastr.warning(`Persona ${name} not found`);
@@ -1793,7 +1793,6 @@ function setNameCallback({ mode = 'all' }, name) {
17931793 if (['temp', 'all'].includes(mode)) {
17941794 // Otherwise, set just the name
17951795 setUserName(name); //this prevented quickReply usage
1796- retriggerFirstMessageOnEmptyChat();
17971796 }
17981797
17991798 return '';
@@ -1944,9 +1943,6 @@ export async function initPersonas() {
19441943 $(document).on('click', '#user_avatar_block .avatar-container', function () {
19451944 const imgfile = $(this).attr('data-avatar-id');
19461945 setUserAvatar(imgfile);
1947-
1948- // force firstMes {{user}} update on persona switch
1949- retriggerFirstMessageOnEmptyChat();
19501946 });
19511947
19521948 $('#persona_rename_button').on('click', () => renamePersona(user_avatar));
@@ -1979,4 +1975,3 @@ export async function initPersonas() {
19791975 eventSource.on(event_types.CHAT_CHANGED, loadPersonaForCurrentChat);
19801976 switchPersonaGridView();
19811977}
1982-
public/scripts/templates/promptManagerExportForCharacter.html+0 -4
@@ -1,4 +0,0 @@
1-<div class="row">
2- <a class="export-promptmanager-prompts-character list-group-item" data-i18n="Export for character">Export for character</a>
3- <span class="tooltip fa-solid fa-info-circle" data-i18n="[title]Export prompts for this character, including their order." title="Export prompts for this character, including their order."></span>
4-</div>
public/scripts/templates/promptManagerExportPopup.html+0 -12
@@ -1,12 +0,0 @@
1-<div id="prompt-manager-export-format-popup" class="list-group">
2- <div class="prompt-manager-export-format-popup-flex">
3- <div class="row">
4- <a class="export-promptmanager-prompts-full list-group-item" data-i18n="Export all">Export all</a>
5- <span class="tooltip fa-solid fa-info-circle" data-i18n="[title]Export all your prompts to a file" title="Export all your prompts to a file"></span>
6- </div>
7- {{#if isGlobalStrategy}}
8- {{else}}
9- {{{exportForCharacter}}}
10- {{/if}}
11- </div>
12-</div>