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() {
4941 return '';4941 return '';
4942}4942}
49434943
4944export async function itemizedParams(itemizedPrompts, thisPromptSet) {4944export async function itemizedParams(itemizedPrompts, thisPromptSet, incomingMesId) {
4945 const params = {4945 const params = {
4946 charDescriptionTokens: await getTokenCountAsync(itemizedPrompts[thisPromptSet].charDescription),4946 charDescriptionTokens: await getTokenCountAsync(itemizedPrompts[thisPromptSet].charDescription),
4947 charPersonalityTokens: await getTokenCountAsync(itemizedPrompts[thisPromptSet].charPersonality),4947 charPersonalityTokens: await getTokenCountAsync(itemizedPrompts[thisPromptSet].charPersonality),
@@ -4960,8 +4960,20 @@ export async function itemizedParams(itemizedPrompts, thisPromptSet) {
4960 chatInjects: await getTokenCountAsync(itemizedPrompts[thisPromptSet].chatInjects),4960 chatInjects: await getTokenCountAsync(itemizedPrompts[thisPromptSet].chatInjects),
4961 chatVectorsStringTokens: await getTokenCountAsync(itemizedPrompts[thisPromptSet].chatVectorsString),4961 chatVectorsStringTokens: await getTokenCountAsync(itemizedPrompts[thisPromptSet].chatVectorsString),
4962 dataBankVectorsStringTokens: await getTokenCountAsync(itemizedPrompts[thisPromptSet].dataBankVectorsString),4962 dataBankVectorsStringTokens: await getTokenCountAsync(itemizedPrompts[thisPromptSet].dataBankVectorsString),
4963 modelUsed: chat[incomingMesId]?.extra?.model,
4964 apiUsed: chat[incomingMesId]?.extra?.api,
4963 };4965 };
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
4965 if (params.chatInjects) {4977 if (params.chatInjects) {
4966 params.ActualChatHistoryTokens = params.ActualChatHistoryTokens - params.chatInjects;4978 params.ActualChatHistoryTokens = params.ActualChatHistoryTokens - params.chatInjects;
4967 }4979 }
@@ -5076,7 +5088,7 @@ async function promptItemize(itemizedPrompts, requestedMesId) {
5076 return null;5088 return null;
5077 }5089 }
50785090
5079 const params = await itemizedParams(itemizedPrompts, thisPromptSet);5091 const params = await itemizedParams(itemizedPrompts, thisPromptSet, incomingMesId);
5080 const flatten = (rawPrompt) => Array.isArray(rawPrompt) ? rawPrompt.map(x => x.content).join('\n') : rawPrompt;5092 const flatten = (rawPrompt) => Array.isArray(rawPrompt) ? rawPrompt.map(x => x.content).join('\n') : rawPrompt;
50815093
5082 const template = params.this_main_api == 'openai'5094 const template = params.this_main_api == 'openai'
public/scripts/templates/itemizationChat.html+1 -1
@@ -4,8 +4,8 @@
4 <div id="copyPromptToClipboard" class="fa-solid fa-copy menu_button" title="Copy Prompt" data-i18n="[title]Copy Prompt"></div>4 <div id="copyPromptToClipboard" class="fa-solid fa-copy menu_button" title="Copy Prompt" data-i18n="[title]Copy Prompt"></div>
5 <div id="diffPrevPrompt" class="fa-solid fa-code-compare menu_button" title="Show Prompt Differences" data-i18n="[title]Show Prompt Differences"></div>5 <div id="diffPrevPrompt" class="fa-solid fa-code-compare menu_button" title="Show Prompt Differences" data-i18n="[title]Show Prompt Differences"></div>
6</h3>6</h3>
7API/Model Used: {{mainApiFriendlyName}} {{#if apiUsed}}({{apiUsed}}){{/if}} {{#if modelUsed}}&ndash; {{modelUsed}}{{/if}}<br>
7Tokenizer: {{selectedTokenizer}}<br>8Tokenizer: {{selectedTokenizer}}<br>
8API Used: {{this_main_api}}<br>
9<span class="tokenItemizingSubclass">9<span class="tokenItemizingSubclass">
10 Only the white numbers really matter. All numbers are estimates.10 Only the white numbers really matter. All numbers are estimates.
11 Grey color items may not have been included in the context due to certain prompt format settings.11 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 @@
4 <div id="copyPromptToClipboard" class="fa-solid fa-copy menu_button" title="Copy Prompt" data-i18n="[title]Copy Prompt"></div>4 <div id="copyPromptToClipboard" class="fa-solid fa-copy menu_button" title="Copy Prompt" data-i18n="[title]Copy Prompt"></div>
5 <div id="diffPrevPrompt" class="fa-solid fa-code-compare menu_button" title="Show Prompt Differences" data-i18n="[title]Show Prompt Differences"></div>5 <div id="diffPrevPrompt" class="fa-solid fa-code-compare menu_button" title="Show Prompt Differences" data-i18n="[title]Show Prompt Differences"></div>
6</h3>6</h3>
7API/Model Used: {{mainApiFriendlyName}} {{#if apiUsed}}({{apiUsed}}){{/if}} {{#if modelUsed}}&ndash; {{modelUsed}}{{/if}}<br>
7Tokenizer: {{selectedTokenizer}}<br>8Tokenizer: {{selectedTokenizer}}<br>
8API Used: {{this_main_api}}<br>
9<span class="tokenItemizingSubclass">9<span class="tokenItemizingSubclass">
10 Only the white numbers really matter. All numbers are estimates.10 Only the white numbers really matter. All numbers are estimates.
11 Grey color items may not have been included in the context due to certain prompt format settings.11 Grey color items may not have been included in the context due to certain prompt format settings.