mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
console logging the prompt option
This commit is contained in:
@ -1704,6 +1704,10 @@
|
|||||||
<input id="auto_scroll_chat_to_bottom" type="checkbox" />
|
<input id="auto_scroll_chat_to_bottom" type="checkbox" />
|
||||||
Auto-scroll Chat
|
Auto-scroll Chat
|
||||||
</label>
|
</label>
|
||||||
|
<label for="console_log_prompts">
|
||||||
|
<input id="console_log_prompts" type="checkbox" />
|
||||||
|
Log prompts to console
|
||||||
|
</label>
|
||||||
<label for="render_formulas">
|
<label for="render_formulas">
|
||||||
<input id="render_formulas" type="checkbox" />
|
<input id="render_formulas" type="checkbox" />
|
||||||
Render Formulas
|
Render Formulas
|
||||||
|
@ -2177,21 +2177,16 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
|||||||
generate_data = getKoboldGenerationData(finalPromt, this_settings, this_amount_gen, maxContext, isImpersonate);
|
generate_data = getKoboldGenerationData(finalPromt, this_settings, this_amount_gen, maxContext, isImpersonate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (main_api == 'textgenerationwebui') {
|
||||||
if (main_api == 'textgenerationwebui') {
|
|
||||||
generate_data = getTextGenGenerationData(finalPromt, this_amount_gen, isImpersonate);
|
generate_data = getTextGenGenerationData(finalPromt, this_amount_gen, isImpersonate);
|
||||||
}
|
}
|
||||||
|
else if (main_api == 'novel') {
|
||||||
if (main_api == 'novel') {
|
|
||||||
const this_settings = novelai_settings[novelai_setting_names[nai_settings.preset_settings_novel]];
|
const this_settings = novelai_settings[novelai_setting_names[nai_settings.preset_settings_novel]];
|
||||||
generate_data = getNovelGenerationData(finalPromt, this_settings);
|
generate_data = getNovelGenerationData(finalPromt, this_settings);
|
||||||
}
|
}
|
||||||
|
else if (main_api == 'openai') {
|
||||||
let generate_url = getGenerateUrl();
|
|
||||||
console.log('rungenerate calling API');
|
|
||||||
|
|
||||||
if (main_api == 'openai') {
|
|
||||||
let [prompt, counts] = await prepareOpenAIMessages(name2, storyString, worldInfoBefore, worldInfoAfter, afterScenarioAnchor, promptBias, type);
|
let [prompt, counts] = await prepareOpenAIMessages(name2, storyString, worldInfoBefore, worldInfoAfter, afterScenarioAnchor, promptBias, type);
|
||||||
|
generate_data = { prompt : prompt };
|
||||||
|
|
||||||
// counts will return false if the user has not enabled the token breakdown feature
|
// counts will return false if the user has not enabled the token breakdown feature
|
||||||
if (counts) {
|
if (counts) {
|
||||||
@ -2232,12 +2227,23 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
|||||||
}
|
}
|
||||||
|
|
||||||
setInContextMessages(openai_messages_count, type);
|
setInContextMessages(openai_messages_count, type);
|
||||||
|
} else if (main_api == 'poe') {
|
||||||
|
generate_data = { prompt : finalPromt };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (power_user.console_log_prompts) {
|
||||||
|
console.log(generate_data.prompt);
|
||||||
|
}
|
||||||
|
|
||||||
|
let generate_url = getGenerateUrl();
|
||||||
|
console.log('rungenerate calling API');
|
||||||
|
|
||||||
|
if (main_api == 'openai') {
|
||||||
if (isStreamingEnabled() && type !== 'quiet') {
|
if (isStreamingEnabled() && type !== 'quiet') {
|
||||||
streamingProcessor.generator = await sendOpenAIRequest(type, prompt, streamingProcessor.abortController.signal);
|
streamingProcessor.generator = await sendOpenAIRequest(type, generate_data.prompt, streamingProcessor.abortController.signal);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sendOpenAIRequest(type, prompt).then(onSuccess).catch(onError);
|
sendOpenAIRequest(type, generate_data.prompt).then(onSuccess).catch(onError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (main_api == 'kobold' && horde_settings.use_horde) {
|
else if (main_api == 'kobold' && horde_settings.use_horde) {
|
||||||
|
@ -110,6 +110,7 @@ let power_user = {
|
|||||||
auto_scroll_chat_to_bottom: true,
|
auto_scroll_chat_to_bottom: true,
|
||||||
auto_fix_generated_markdown: true,
|
auto_fix_generated_markdown: true,
|
||||||
send_on_enter: send_on_enter_options.AUTO,
|
send_on_enter: send_on_enter_options.AUTO,
|
||||||
|
console_log_prompts: false,
|
||||||
render_formulas: false,
|
render_formulas: false,
|
||||||
allow_name1_display: false,
|
allow_name1_display: false,
|
||||||
allow_name2_display: false,
|
allow_name2_display: false,
|
||||||
@ -477,6 +478,7 @@ function loadPowerUserSettings(settings, data) {
|
|||||||
power_user.font_scale = Number(localStorage.getItem(storage_keys.font_scale) ?? 1);
|
power_user.font_scale = Number(localStorage.getItem(storage_keys.font_scale) ?? 1);
|
||||||
power_user.blur_strength = Number(localStorage.getItem(storage_keys.blur_strength) ?? 10);
|
power_user.blur_strength = Number(localStorage.getItem(storage_keys.blur_strength) ?? 10);
|
||||||
|
|
||||||
|
$("#console_log_prompts").prop("checked", power_user.console_log_prompts);
|
||||||
$('#auto_fix_generated_markdown').prop("checked", power_user.auto_fix_generated_markdown);
|
$('#auto_fix_generated_markdown').prop("checked", power_user.auto_fix_generated_markdown);
|
||||||
$('#auto_scroll_chat_to_bottom').prop("checked", power_user.auto_scroll_chat_to_bottom);
|
$('#auto_scroll_chat_to_bottom').prop("checked", power_user.auto_scroll_chat_to_bottom);
|
||||||
$(`#tokenizer option[value="${power_user.tokenizer}"]`).attr('selected', true);
|
$(`#tokenizer option[value="${power_user.tokenizer}"]`).attr('selected', true);
|
||||||
@ -1021,6 +1023,11 @@ $(document).ready(() => {
|
|||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#console_log_prompts").on('input', function () {
|
||||||
|
power_user.console_log_prompts = !!$(this).prop('checked');
|
||||||
|
saveSettingsDebounced();
|
||||||
|
});
|
||||||
|
|
||||||
$('#auto_scroll_chat_to_bottom').on("input", function () {
|
$('#auto_scroll_chat_to_bottom').on("input", function () {
|
||||||
power_user.auto_scroll_chat_to_bottom = !!$(this).prop('checked');
|
power_user.auto_scroll_chat_to_bottom = !!$(this).prop('checked');
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
|
Reference in New Issue
Block a user