Display API and model used in itemization

This commit is contained in:
Cohee 2024-09-09 00:26:06 +03:00
parent 75e279091c
commit 725aff3474
3 changed files with 16 additions and 4 deletions

View File

@ -4941,7 +4941,7 @@ async function duplicateCharacter() {
return '';
}
export async function itemizedParams(itemizedPrompts, thisPromptSet) {
export async function itemizedParams(itemizedPrompts, thisPromptSet, incomingMesId) {
const params = {
charDescriptionTokens: await getTokenCountAsync(itemizedPrompts[thisPromptSet].charDescription),
charPersonalityTokens: await getTokenCountAsync(itemizedPrompts[thisPromptSet].charPersonality),
@ -4960,8 +4960,20 @@ export async function itemizedParams(itemizedPrompts, thisPromptSet) {
chatInjects: await getTokenCountAsync(itemizedPrompts[thisPromptSet].chatInjects),
chatVectorsStringTokens: await getTokenCountAsync(itemizedPrompts[thisPromptSet].chatVectorsString),
dataBankVectorsStringTokens: await getTokenCountAsync(itemizedPrompts[thisPromptSet].dataBankVectorsString),
modelUsed: chat[incomingMesId]?.extra?.model,
apiUsed: chat[incomingMesId]?.extra?.api,
};
const getFriendlyName = (value) => $(`#rm_api_block select option[value="${value}"]`).first().text() || value;
if (params.apiUsed) {
params.apiUsed = getFriendlyName(params.apiUsed);
}
if (params.this_main_api) {
params.mainApiFriendlyName = getFriendlyName(params.this_main_api);
}
if (params.chatInjects) {
params.ActualChatHistoryTokens = params.ActualChatHistoryTokens - params.chatInjects;
}
@ -5076,7 +5088,7 @@ async function promptItemize(itemizedPrompts, requestedMesId) {
return null;
}
const params = await itemizedParams(itemizedPrompts, thisPromptSet);
const params = await itemizedParams(itemizedPrompts, thisPromptSet, incomingMesId);
const flatten = (rawPrompt) => Array.isArray(rawPrompt) ? rawPrompt.map(x => x.content).join('\n') : rawPrompt;
const template = params.this_main_api == 'openai'

View File

@ -4,8 +4,8 @@
<div id="copyPromptToClipboard" class="fa-solid fa-copy menu_button" title="Copy Prompt" data-i18n="[title]Copy Prompt"></div>
<div id="diffPrevPrompt" class="fa-solid fa-code-compare menu_button" title="Show Prompt Differences" data-i18n="[title]Show Prompt Differences"></div>
</h3>
API/Model Used: {{mainApiFriendlyName}} {{#if apiUsed}}({{apiUsed}}){{/if}} {{#if modelUsed}}&ndash; {{modelUsed}}{{/if}}<br>
Tokenizer: {{selectedTokenizer}}<br>
API Used: {{this_main_api}}<br>
<span class="tokenItemizingSubclass">
Only the white numbers really matter. All numbers are estimates.
Grey color items may not have been included in the context due to certain prompt format settings.

View File

@ -4,8 +4,8 @@
<div id="copyPromptToClipboard" class="fa-solid fa-copy menu_button" title="Copy Prompt" data-i18n="[title]Copy Prompt"></div>
<div id="diffPrevPrompt" class="fa-solid fa-code-compare menu_button" title="Show Prompt Differences" data-i18n="[title]Show Prompt Differences"></div>
</h3>
API/Model Used: {{mainApiFriendlyName}} {{#if apiUsed}}({{apiUsed}}){{/if}} {{#if modelUsed}}&ndash; {{modelUsed}}{{/if}}<br>
Tokenizer: {{selectedTokenizer}}<br>
API Used: {{this_main_api}}<br>
<span class="tokenItemizingSubclass">
Only the white numbers really matter. All numbers are estimates.
Grey color items may not have been included in the context due to certain prompt format settings.