Display API and model used in itemization

725aff3474e98bbcf1b6c0014cefbe58de2a5d30

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

3 files changed, +16 -4Showing whitespace changes
public/script.js+14 -2
@@ -4941,7 +4941,7 @@ async function duplicateCharacter() {
49414941 return '';
49424942}
49434943
49444944export async function itemizedParams(itemizedPrompts, thisPromptSet, incomingMesId) {
49454945 const params = {
49464946 charDescriptionTokens: await getTokenCountAsync(itemizedPrompts[thisPromptSet].charDescription),
49474947 charPersonalityTokens: await getTokenCountAsync(itemizedPrompts[thisPromptSet].charPersonality),
@@ -4960,8 +4960,20 @@ export async function itemizedParams(itemizedPrompts, thisPromptSet) {
49604960 chatInjects: await getTokenCountAsync(itemizedPrompts[thisPromptSet].chatInjects),
49614961 chatVectorsStringTokens: await getTokenCountAsync(itemizedPrompts[thisPromptSet].chatVectorsString),
49624962 dataBankVectorsStringTokens: await getTokenCountAsync(itemizedPrompts[thisPromptSet].dataBankVectorsString),
4963+ modelUsed: chat[incomingMesId]?.extra?.model,
4964+ apiUsed: chat[incomingMesId]?.extra?.api,
49634965 };
49644966
4967+ const getFriendlyName = (value) => $(`#rm_api_block select option[value="${value}"]`).first().text() || value;
4968+
4969+ if (params.apiUsed) {
4970+ params.apiUsed = getFriendlyName(params.apiUsed);
4971+ }
4972+
4973+ if (params.this_main_api) {
4974+ params.mainApiFriendlyName = getFriendlyName(params.this_main_api);
4975+ }
4976+
49654977 if (params.chatInjects) {
49664978 params.ActualChatHistoryTokens = params.ActualChatHistoryTokens - params.chatInjects;
49674979 }
@@ -5076,7 +5088,7 @@ async function promptItemize(itemizedPrompts, requestedMesId) {
50765088 return null;
50775089 }
50785090
50795091 const params = await itemizedParams(itemizedPrompts, thisPromptSet, incomingMesId);
50805092 const flatten = (rawPrompt) => Array.isArray(rawPrompt) ? rawPrompt.map(x => x.content).join('\n') : rawPrompt;
50815093
50825094 const template = params.this_main_api == 'openai'
public/scripts/templates/itemizationChat.html+1 -1
@@ -4,8 +4,8 @@
44 <div id="copyPromptToClipboard" class="fa-solid fa-copy menu_button" title="Copy Prompt" data-i18n="[title]Copy Prompt"></div>
55 <div id="diffPrevPrompt" class="fa-solid fa-code-compare menu_button" title="Show Prompt Differences" data-i18n="[title]Show Prompt Differences"></div>
66</h3>
7+API/Model Used: {{mainApiFriendlyName}} {{#if apiUsed}}({{apiUsed}}){{/if}} {{#if modelUsed}}&ndash; {{modelUsed}}{{/if}}<br>
78Tokenizer: {{selectedTokenizer}}<br>
8-API Used: {{this_main_api}}<br>
99<span class="tokenItemizingSubclass">
1010 Only the white numbers really matter. All numbers are estimates.
1111 Grey color items may not have been included in the context due to certain prompt format settings.
public/scripts/templates/itemizationText.html+1 -1
@@ -4,8 +4,8 @@
44 <div id="copyPromptToClipboard" class="fa-solid fa-copy menu_button" title="Copy Prompt" data-i18n="[title]Copy Prompt"></div>
55 <div id="diffPrevPrompt" class="fa-solid fa-code-compare menu_button" title="Show Prompt Differences" data-i18n="[title]Show Prompt Differences"></div>
66</h3>
7+API/Model Used: {{mainApiFriendlyName}} {{#if apiUsed}}({{apiUsed}}){{/if}} {{#if modelUsed}}&ndash; {{modelUsed}}{{/if}}<br>
78Tokenizer: {{selectedTokenizer}}<br>
8-API Used: {{this_main_api}}<br>
99<span class="tokenItemizingSubclass">
1010 Only the white numbers really matter. All numbers are estimates.
1111 Grey color items may not have been included in the context due to certain prompt format settings.