mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Refactor token counting after completion. Simplify code.
This commit is contained in:
@ -512,7 +512,7 @@ function populateDialogueExamples(prompts, chatCompletion) {
|
|||||||
* @param {string} options.type - The type of the chat, can be 'impersonate'.
|
* @param {string} options.type - The type of the chat, can be 'impersonate'.
|
||||||
*/
|
*/
|
||||||
function populateChatCompletion (prompts, chatCompletion, {bias, quietPrompt, type, cyclePrompt} = {}) {
|
function populateChatCompletion (prompts, chatCompletion, {bias, quietPrompt, type, cyclePrompt} = {}) {
|
||||||
// Helper function for the recurring task of preparing a prompt for the chat completion
|
// Helper function for preparing a prompt, that already exists within the prompt collection, for completion
|
||||||
const addToChatCompletion = (source, target = null) => {
|
const addToChatCompletion = (source, target = null) => {
|
||||||
// We need the prompts array to determine a position for the source.
|
// We need the prompts array to determine a position for the source.
|
||||||
if (false === prompts.has(source)) return;
|
if (false === prompts.has(source)) return;
|
||||||
@ -569,7 +569,7 @@ function populateChatCompletion (prompts, chatCompletion, {bias, quietPrompt, ty
|
|||||||
if (prompts.has('authorsNote')) {
|
if (prompts.has('authorsNote')) {
|
||||||
const authorsNote = Message.fromPrompt(prompts.get('authorsNote'));
|
const authorsNote = Message.fromPrompt(prompts.get('authorsNote'));
|
||||||
|
|
||||||
// ToDo: This should not be retrieved from the ui during runtime
|
// ToDo: Ideally this should not be retrieved here but already be referenced in some configuration object
|
||||||
const afterScenario = document.querySelector('input[name="extension_floating_position"]').checked;
|
const afterScenario = document.querySelector('input[name="extension_floating_position"]').checked;
|
||||||
|
|
||||||
// Add authors notes
|
// Add authors notes
|
||||||
|
Reference in New Issue
Block a user