1
1
1

Реворк lookaround https://rentry.co/XML-dva-shiza от автора https://rentry.co/HumAssistOff

p.s Спустя час крытия гитхаба матом. Представляю уже готовый форк оригинальной таверны с моими изменениями. (Также встроеным функционалом из https://rentry.co/HumAssistOff (По умолчанию humassistoff выключен. System включен))

Если у кого-то тут есть желание базарить с Кофе или его соавтором можете попросить залить кнопку в официальный функционал. Лично такого желания не имею.

Установка на anytavern до Promptmanager update

Ахтунг говнокод, сделай бэкап всех четырех файлов.

1. В файле public/scripts/slash-commands.js:

Вставь этот код к другим парсерам около строки 130:

parser.addCommand('lookaround', lookChatCallback, ['look'], ' – Look around, and behold beauty of this world', true, true);

1

Вставь этот код после функции continueChatCallback (примерно на строке 200):

1
2
3
4
5
function lookChatCallback() {
    // Prevent infinite recursion
    $('#send_textarea').val('');
    $('#option_lookaround').trigger('click', { fromSlashCommand: true });
}

1

2. В файле public/script.js:

Вставь этот код после строки 7666 (ориентир: else if (id == 'option_continue') {...}):

1
2
3
4
5
6
else if (id == 'option_lookaround') {
    if (is_send_press == false || fromSlashCommand) {
        is_send_press = true;
        Generate("lookaround");
    }
}

1

3. В файле public/index.js:

Вставь этот код после элемента с идентификатором option_continue (примерно на строке 3729):

1
2
3
4
<a id="option_lookaround" title="Look around" data-i18n="[title]Look around">
    <i class="fa fa-eye" aria-hidden="true"></i>
    <span data-i18n="Look around">Look around</span>
</a>

1

4. В файле public/scripts/openai.js:

Вставь этот код после блока if (type == 'continue') {...}:

1
2
3
4
5
6
7
if (type == 'lookaround') {
    const lookaroundNudge = { "role": "system", "content": stringFormat('[Complete these steps: 1. Paste a line break. 2. Write "```XML" and add a line break. 3. Describe in 50 words the scene Human is currently in. Describe the location, objects, and chatacers (if applicable) that Human can interact with, much like a Dungeon & Dragons GM would starting with "👁 You look around and see...". Make it 60 words total. 4. Add a line break and write "```".', cyclePrompt || '') };
    openai_msgs.push(lookaroundNudge);

    total_count += handler_instance.count([lookaroundNudge], true, 'lookaround');
    await delay(1);
}

1

5. В Файле public/scripts/group-chats.js

505 строка

1
2
3
4
5
6
7
else if (type === "swipe" || type === 'continue' || type === 'lookaround') {
           activatedMembers = activateSwipe(group.members);

           if (activatedMembers.length === 0) {
               toastr.warning('Deleted group member swiped. To get a reply, add them back to the group.');
               throw new Error('Deleted group member swiped');
           }

538 строка

1
2
3
4
5
6
for (const chId of activatedMembers) {
            deactivateSendButtons();
            isGenerationDone = false;
            const generateType = type == "swipe" || type == "impersonate" || type == "quiet" || type == "lookaround" || type == "continue" ? type : "group_chat";
            setCharacterId(chId);
            setCharacterName(characters[chId].name)

Эти изменения добавят новую команду lookaround и соответствующую функцию обратного вызова lookChatCallback, а также обновят интерфейс и логику для обработки этой команды.

От Bing-чан и Nv-куна

Edit
Pub: 23 Jul 2023 23:34 UTC
Edit: 05 Oct 2023 16:50 UTC
Views: 592