diff --git a/default/content/presets/textgen/Asterism.json b/default/content/presets/textgen/Asterism.json index 71b43e84a..afbaad2c4 100644 --- a/default/content/presets/textgen/Asterism.json +++ b/default/content/presets/textgen/Asterism.json @@ -1,23 +1,85 @@ { "temp": 1.68, + "temperature_last": true, "top_p": 0.17, "top_k": 77, - "typical_p": 1, "top_a": 0.42, "tfs": 0.97, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.02, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Beam Search.json b/default/content/presets/textgen/Beam Search.json index 2f341d6d2..b584ae0ae 100644 --- a/default/content/presets/textgen/Beam Search.json +++ b/default/content/presets/textgen/Beam Search.json @@ -1,23 +1,85 @@ { "temp": 0.7, + "temperature_last": true, "top_p": 0.92, "top_k": 150, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, - "rep_pen": 4.5, + "typical_p": 1, + "min_p": 0, + "rep_pen": 3, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 2, "penalty_alpha": 0, "num_beams": 10, "length_penalty": 1.4, "min_length": 200, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": true, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Big O.json b/default/content/presets/textgen/Big O.json index e565de6d3..4b5ca81a3 100644 --- a/default/content/presets/textgen/Big O.json +++ b/default/content/presets/textgen/Big O.json @@ -1,23 +1,85 @@ { "temp": 0.87, + "temperature_last": true, "top_p": 0.99, "top_k": 85, - "typical_p": 0.68, "top_a": 0, "tfs": 0.68, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 0.68, + "min_p": 0, "rep_pen": 1.01, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Contrastive Search.json b/default/content/presets/textgen/Contrastive Search.json index 3537f1116..1dae94965 100644 --- a/default/content/presets/textgen/Contrastive Search.json +++ b/default/content/presets/textgen/Contrastive Search.json @@ -1,23 +1,85 @@ { "temp": 1, + "temperature_last": true, "top_p": 1, "top_k": 4, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0.6, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": false, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Default.json b/default/content/presets/textgen/Default.json index eb787104f..6f450cfeb 100644 --- a/default/content/presets/textgen/Default.json +++ b/default/content/presets/textgen/Default.json @@ -1,23 +1,85 @@ { "temp": 0.7, + "temperature_last": true, "top_p": 0.5, "top_k": 40, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.2, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Deterministic.json b/default/content/presets/textgen/Deterministic.json index f05c3ea3c..06ae54675 100644 --- a/default/content/presets/textgen/Deterministic.json +++ b/default/content/presets/textgen/Deterministic.json @@ -1,23 +1,85 @@ { "temp": 0, + "temperature_last": true, "top_p": 0, "top_k": 1, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.18, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": false, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Divine Intellect.json b/default/content/presets/textgen/Divine Intellect.json index cae86324a..d9a4757d1 100644 --- a/default/content/presets/textgen/Divine Intellect.json +++ b/default/content/presets/textgen/Divine Intellect.json @@ -1,23 +1,85 @@ { "temp": 1.31, + "temperature_last": true, "top_p": 0.14, "top_k": 49, - "typical_p": 1, "top_a": 0.52, "tfs": 1, "epsilon_cutoff": 1.49, "eta_cutoff": 10.42, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.17, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Kobold (Godlike).json b/default/content/presets/textgen/Kobold (Godlike).json index 5df9438b7..367e126ee 100644 --- a/default/content/presets/textgen/Kobold (Godlike).json +++ b/default/content/presets/textgen/Kobold (Godlike).json @@ -1,23 +1,85 @@ { "temp": 0.7, + "temperature_last": true, "top_p": 0.5, "top_k": 0, - "typical_p": 0.19, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 0.19, + "min_p": 0, "rep_pen": 1.1, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Kobold (Liminal Drift).json b/default/content/presets/textgen/Kobold (Liminal Drift).json index c6c289ee9..9035bead0 100644 --- a/default/content/presets/textgen/Kobold (Liminal Drift).json +++ b/default/content/presets/textgen/Kobold (Liminal Drift).json @@ -1,23 +1,85 @@ { "temp": 0.66, + "temperature_last": true, "top_p": 1, "top_k": 0, - "typical_p": 0.6, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 0.6, + "min_p": 0, "rep_pen": 1.1, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/LLaMa-Precise.json b/default/content/presets/textgen/LLaMa-Precise.json index 3dbb3b74e..84927b8d9 100644 --- a/default/content/presets/textgen/LLaMa-Precise.json +++ b/default/content/presets/textgen/LLaMa-Precise.json @@ -1,23 +1,85 @@ { "temp": 0.7, + "temperature_last": true, "top_p": 0.1, "top_k": 40, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.18, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 200, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Midnight Enigma.json b/default/content/presets/textgen/Midnight Enigma.json index d55269ab9..d60d989fa 100644 --- a/default/content/presets/textgen/Midnight Enigma.json +++ b/default/content/presets/textgen/Midnight Enigma.json @@ -1,23 +1,85 @@ { "temp": 0.98, + "temperature_last": true, "top_p": 0.37, "top_k": 100, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.18, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Miro Bronze.json b/default/content/presets/textgen/Miro Bronze.json index 96ce62afd..346e5c29f 100644 --- a/default/content/presets/textgen/Miro Bronze.json +++ b/default/content/presets/textgen/Miro Bronze.json @@ -1,24 +1,85 @@ { "temp": 1.06, + "temperature_last": true, "top_p": 1, "top_k": 0, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 2, "mirostat_tau": 9.61, "mirostat_eta": 1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Miro Gold.json b/default/content/presets/textgen/Miro Gold.json index 4a423d39e..2b2edf49a 100644 --- a/default/content/presets/textgen/Miro Gold.json +++ b/default/content/presets/textgen/Miro Gold.json @@ -1,24 +1,85 @@ { "temp": 1.17, + "temperature_last": true, "top_p": 1, "top_k": 0, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 2, "mirostat_tau": 9.91, "mirostat_eta": 1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Miro Silver.json b/default/content/presets/textgen/Miro Silver.json index d04526dc4..249168589 100644 --- a/default/content/presets/textgen/Miro Silver.json +++ b/default/content/presets/textgen/Miro Silver.json @@ -1,24 +1,85 @@ { "temp": 1.17, + "temperature_last": true, "top_p": 1, "top_k": 0, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 2, "mirostat_tau": 9.62, "mirostat_eta": 1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Mirostat.json b/default/content/presets/textgen/Mirostat.json index 198be9feb..481e7ea52 100644 --- a/default/content/presets/textgen/Mirostat.json +++ b/default/content/presets/textgen/Mirostat.json @@ -1,23 +1,85 @@ { "temp": 1, + "temperature_last": true, "top_p": 1, "top_k": 0, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 2, "mirostat_tau": 8, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Naive.json b/default/content/presets/textgen/Naive.json index 2cdeb9492..ac1349e5c 100644 --- a/default/content/presets/textgen/Naive.json +++ b/default/content/presets/textgen/Naive.json @@ -1,23 +1,85 @@ { "temp": 0.7, + "temperature_last": true, "top_p": 0.85, "top_k": 50, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/NovelAI (Best Guess).json b/default/content/presets/textgen/NovelAI (Best Guess).json index b116cf0e1..af8339889 100644 --- a/default/content/presets/textgen/NovelAI (Best Guess).json +++ b/default/content/presets/textgen/NovelAI (Best Guess).json @@ -1,23 +1,85 @@ { "temp": 0.8, + "temperature_last": true, "top_p": 0.9, "top_k": 100, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.15, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/NovelAI (Decadence).json b/default/content/presets/textgen/NovelAI (Decadence).json index 7b692c671..e970dd1bc 100644 --- a/default/content/presets/textgen/NovelAI (Decadence).json +++ b/default/content/presets/textgen/NovelAI (Decadence).json @@ -1,23 +1,85 @@ { "temp": 1.99, + "temperature_last": true, "top_p": 1, "top_k": 100, - "typical_p": 0.97, - "rep_pen": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 0.97, + "min_p": 0, + "rep_pen": 1, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/NovelAI (Genesis).json b/default/content/presets/textgen/NovelAI (Genesis).json index 8b2c85df7..26e96ae25 100644 --- a/default/content/presets/textgen/NovelAI (Genesis).json +++ b/default/content/presets/textgen/NovelAI (Genesis).json @@ -1,23 +1,85 @@ { "temp": 0.63, + "temperature_last": true, "top_p": 0.98, "top_k": 0, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.05, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/NovelAI (Lycaenidae).json b/default/content/presets/textgen/NovelAI (Lycaenidae).json index d99611189..a9eacb542 100644 --- a/default/content/presets/textgen/NovelAI (Lycaenidae).json +++ b/default/content/presets/textgen/NovelAI (Lycaenidae).json @@ -1,23 +1,85 @@ { "temp": 1.99, + "temperature_last": true, "top_p": 0.85, "top_k": 12, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.15, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/NovelAI (Ouroboros).json b/default/content/presets/textgen/NovelAI (Ouroboros).json index 708bedf23..b68a5b568 100644 --- a/default/content/presets/textgen/NovelAI (Ouroboros).json +++ b/default/content/presets/textgen/NovelAI (Ouroboros).json @@ -1,23 +1,85 @@ { "temp": 1.07, + "temperature_last": true, "top_p": 1, "top_k": 100, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.05, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/NovelAI (Pleasing Results).json b/default/content/presets/textgen/NovelAI (Pleasing Results).json index ed4968b6f..ea5c45919 100644 --- a/default/content/presets/textgen/NovelAI (Pleasing Results).json +++ b/default/content/presets/textgen/NovelAI (Pleasing Results).json @@ -1,23 +1,85 @@ { "temp": 0.44, + "temperature_last": true, "top_p": 1, "top_k": 0, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.15, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/NovelAI (Sphinx Moth).json b/default/content/presets/textgen/NovelAI (Sphinx Moth).json index 1390a76b1..11085fd68 100644 --- a/default/content/presets/textgen/NovelAI (Sphinx Moth).json +++ b/default/content/presets/textgen/NovelAI (Sphinx Moth).json @@ -1,23 +1,85 @@ { "temp": 1.99, + "temperature_last": true, "top_p": 0.18, "top_k": 30, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.15, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/NovelAI (Storywriter).json b/default/content/presets/textgen/NovelAI (Storywriter).json index dfb5c1ff1..4bb308db2 100644 --- a/default/content/presets/textgen/NovelAI (Storywriter).json +++ b/default/content/presets/textgen/NovelAI (Storywriter).json @@ -1,23 +1,85 @@ { "temp": 0.72, + "temperature_last": true, "top_p": 0.73, "top_k": 0, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.1, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Shortwave.json b/default/content/presets/textgen/Shortwave.json index f9f039ba2..44608d172 100644 --- a/default/content/presets/textgen/Shortwave.json +++ b/default/content/presets/textgen/Shortwave.json @@ -1,23 +1,85 @@ { "temp": 1.53, + "temperature_last": true, "top_p": 0.64, "top_k": 33, - "typical_p": 1, "top_a": 0.04, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.07, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Simple-1.json b/default/content/presets/textgen/Simple-1.json index 0a1acea99..6662eaa6c 100644 --- a/default/content/presets/textgen/Simple-1.json +++ b/default/content/presets/textgen/Simple-1.json @@ -1,23 +1,85 @@ { "temp": 0.7, + "temperature_last": true, "top_p": 0.9, "top_k": 20, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.15, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Space Alien.json b/default/content/presets/textgen/Space Alien.json index 95d98f368..e1d59426b 100644 --- a/default/content/presets/textgen/Space Alien.json +++ b/default/content/presets/textgen/Space Alien.json @@ -1,23 +1,85 @@ { "temp": 1.31, + "temperature_last": true, "top_p": 0.29, "top_k": 72, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.09, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/StarChat.json b/default/content/presets/textgen/StarChat.json index 3b497a633..aa572e206 100644 --- a/default/content/presets/textgen/StarChat.json +++ b/default/content/presets/textgen/StarChat.json @@ -1,23 +1,85 @@ { "temp": 0.02, + "temperature_last": true, "top_p": 0.95, "top_k": 50, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/TFS-with-Top-A.json b/default/content/presets/textgen/TFS-with-Top-A.json index da0b4cd5b..ba6b4c606 100644 --- a/default/content/presets/textgen/TFS-with-Top-A.json +++ b/default/content/presets/textgen/TFS-with-Top-A.json @@ -1,23 +1,85 @@ { "temp": 0.7, + "temperature_last": true, "top_p": 1, "top_k": 0, - "typical_p": 1, "top_a": 0.2, "tfs": 0.95, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.15, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Titanic.json b/default/content/presets/textgen/Titanic.json index 55bf196a5..d46f0cf71 100644 --- a/default/content/presets/textgen/Titanic.json +++ b/default/content/presets/textgen/Titanic.json @@ -1,23 +1,85 @@ { "temp": 1.01, + "temperature_last": true, "top_p": 0.21, "top_k": 91, - "typical_p": 1, "top_a": 0.75, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 10.78, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.21, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1.07, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Universal-Creative.json b/default/content/presets/textgen/Universal-Creative.json index 7784fe226..527550b9a 100644 --- a/default/content/presets/textgen/Universal-Creative.json +++ b/default/content/presets/textgen/Universal-Creative.json @@ -11,6 +11,8 @@ "min_p": 0.1, "rep_pen": 1, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, @@ -19,24 +21,56 @@ "encoder_rep_pen": 1, "freq_pen": 0, "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, "add_bos_token": true, - "truncation_length": 2048, "ban_eos_token": false, "skip_special_tokens": true, - "streaming": true, "mirostat_mode": 0, "mirostat_tau": 5, "mirostat_eta": 0.1, "guidance_scale": 1, "negative_prompt": "", "grammar_string": "", + "json_schema": {}, "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], "ignore_eos_token": false, "spaces_between_special_tokens": true, - "type": "ooba", - "legacy_api": false, + "speculative_ngram": false, "sampler_order": [ 5, 6, @@ -46,5 +80,6 @@ 3, 4 ], + "logit_bias": [], "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Universal-Light.json b/default/content/presets/textgen/Universal-Light.json index d855094d1..8bc79a847 100644 --- a/default/content/presets/textgen/Universal-Light.json +++ b/default/content/presets/textgen/Universal-Light.json @@ -11,6 +11,8 @@ "min_p": 0.1, "rep_pen": 1, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, @@ -19,24 +21,56 @@ "encoder_rep_pen": 1, "freq_pen": 0, "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, "add_bos_token": true, - "truncation_length": 2048, "ban_eos_token": false, "skip_special_tokens": true, - "streaming": true, "mirostat_mode": 0, "mirostat_tau": 5, "mirostat_eta": 0.1, "guidance_scale": 1, "negative_prompt": "", "grammar_string": "", + "json_schema": {}, "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], "ignore_eos_token": false, "spaces_between_special_tokens": true, - "type": "ooba", - "legacy_api": false, + "speculative_ngram": false, "sampler_order": [ 5, 6, @@ -46,5 +80,6 @@ 3, 4 ], + "logit_bias": [], "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Universal-Super-Creative.json b/default/content/presets/textgen/Universal-Super-Creative.json index 60df29700..dfd28d863 100644 --- a/default/content/presets/textgen/Universal-Super-Creative.json +++ b/default/content/presets/textgen/Universal-Super-Creative.json @@ -11,6 +11,8 @@ "min_p": 0.1, "rep_pen": 1, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, @@ -19,24 +21,56 @@ "encoder_rep_pen": 1, "freq_pen": 0, "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, "add_bos_token": true, - "truncation_length": 2048, "ban_eos_token": false, "skip_special_tokens": true, - "streaming": true, "mirostat_mode": 0, "mirostat_tau": 5, "mirostat_eta": 0.1, "guidance_scale": 1, "negative_prompt": "", "grammar_string": "", + "json_schema": {}, "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], "ignore_eos_token": false, "spaces_between_special_tokens": true, - "type": "ooba", - "legacy_api": false, + "speculative_ngram": false, "sampler_order": [ 5, 6, @@ -46,5 +80,6 @@ 3, 4 ], + "logit_bias": [], "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/Yara.json b/default/content/presets/textgen/Yara.json index 6b5a28711..37601398c 100644 --- a/default/content/presets/textgen/Yara.json +++ b/default/content/presets/textgen/Yara.json @@ -1,23 +1,85 @@ { "temp": 0.82, + "temperature_last": true, "top_p": 0.21, "top_k": 72, - "typical_p": 1, "top_a": 0, "tfs": 1, "epsilon_cutoff": 0, "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, "rep_pen": 1.19, "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, "no_repeat_ngram_size": 0, "penalty_alpha": 0, "num_beams": 1, "length_penalty": 1, "min_length": 0, "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, "do_sample": true, "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, "mirostat_mode": 0, "mirostat_tau": 5, - "mirostat_eta": 0.1 + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 5, + 6, + 0, + 1, + 2, + 3, + 4 + ], + "logit_bias": [], + "rep_pen_size": 0 } diff --git a/default/content/presets/textgen/simple-proxy-for-tavern.json b/default/content/presets/textgen/simple-proxy-for-tavern.json index b4b1c781f..17e077842 100644 --- a/default/content/presets/textgen/simple-proxy-for-tavern.json +++ b/default/content/presets/textgen/simple-proxy-for-tavern.json @@ -1,23 +1,85 @@ -{ - "temp": 0.65, - "top_p": 0.47, - "top_k": 42, - "typical_p": 1, - "top_a": 0, - "tfs": 1, - "epsilon_cutoff": 0, - "eta_cutoff": 0, - "rep_pen": 1.18, - "rep_pen_range": 0, - "no_repeat_ngram_size": 0, - "penalty_alpha": 0, - "num_beams": 1, - "length_penalty": 1, - "min_length": 0, - "encoder_rep_pen": 1, - "do_sample": true, - "early_stopping": false, - "mirostat_mode": 0, - "mirostat_tau": 5, - "mirostat_eta": 0.1 -} +{ + "temp": 0.65, + "temperature_last": true, + "top_p": 0.47, + "top_k": 42, + "top_a": 0, + "tfs": 1, + "epsilon_cutoff": 0, + "eta_cutoff": 0, + "typical_p": 1, + "min_p": 0, + "rep_pen": 1.18, + "rep_pen_range": 0, + "rep_pen_decay": 0, + "rep_pen_slope": 1, + "no_repeat_ngram_size": 0, + "penalty_alpha": 0, + "num_beams": 1, + "length_penalty": 1, + "min_length": 0, + "encoder_rep_pen": 1, + "freq_pen": 0, + "presence_pen": 0, + "skew": 0, + "do_sample": true, + "early_stopping": false, + "dynatemp": false, + "min_temp": 0, + "max_temp": 2, + "dynatemp_exponent": 1, + "smoothing_factor": 0, + "smoothing_curve": 1, + "dry_allowed_length": 2, + "dry_multiplier": 0, + "dry_base": 1.75, + "dry_sequence_breakers": "[\"\\n\", \":\", \"\\\"\", \"*\"]", + "dry_penalty_last_n": 0, + "add_bos_token": true, + "ban_eos_token": false, + "skip_special_tokens": true, + "mirostat_mode": 0, + "mirostat_tau": 5, + "mirostat_eta": 0.1, + "guidance_scale": 1, + "negative_prompt": "", + "grammar_string": "", + "json_schema": {}, + "banned_tokens": "", + "sampler_priority": [ + "temperature", + "dynamic_temperature", + "quadratic_sampling", + "top_k", + "top_p", + "typical_p", + "epsilon_cutoff", + "eta_cutoff", + "tfs", + "top_a", + "min_p", + "mirostat" + ], + "samplers": [ + "top_k", + "tfs_z", + "typical_p", + "top_p", + "min_p", + "temperature" + ], + "ignore_eos_token": false, + "spaces_between_special_tokens": true, + "speculative_ngram": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "logit_bias": [], + "rep_pen_size": 0 +} diff --git a/default/content/settings.json b/default/content/settings.json index f558c769f..97f2e5277 100644 --- a/default/content/settings.json +++ b/default/content/settings.json @@ -44,7 +44,6 @@ "preset": "Default", "add_bos_token": true, "stopping_strings": [], - "truncation_length": 2048, "ban_eos_token": false, "skip_special_tokens": true, "streaming": false, diff --git a/public/index.html b/public/index.html index 125d1b6a6..450f33f0e 100644 --- a/public/index.html +++ b/public/index.html @@ -1292,7 +1292,7 @@ -
+

@@ -1315,7 +1315,7 @@

-
+
Penalty Range @@ -5123,23 +5123,6 @@
-
-
-
-

Chat Scenario Override

- -
-
- Unique to this chat. - All group members will use the following scenario text instead of what is specified in their character cards. - The following scenario text will be used instead of the value set in the character card. - Checkpoints inherit the scenario override from their parent, and can be changed individually after that. -
-
- -
-
-
diff --git a/public/script.js b/public/script.js index aa6e5f16b..5a08e7cfb 100644 --- a/public/script.js +++ b/public/script.js @@ -101,6 +101,7 @@ import { proxies, loadProxyPresets, selected_proxy, + initOpenai, } from './scripts/openai.js'; import { @@ -155,7 +156,6 @@ import { ensureImageFormatSupported, flashHighlight, isTrueBoolean, - debouncedThrottle, } from './scripts/utils.js'; import { debounce_timeout } from './scripts/constants.js'; @@ -915,6 +915,7 @@ async function firstLoadInit() { initKeyboard(); initDynamicStyles(); initTags(); + initOpenai(); await getUserAvatars(true, user_avatar); await getCharacters(); await getBackgrounds(); @@ -7183,20 +7184,23 @@ function updateFavButtonState(state) { $('#favorite_button').toggleClass('fav_off', !fav_ch_checked); } -export function setScenarioOverride() { +export async function setScenarioOverride() { if (!selected_group && !this_chid) { console.warn('setScenarioOverride() -- no selected group or character'); return; } - const template = $('#scenario_override_template .scenario_override').clone(); const metadataValue = chat_metadata['scenario'] || ''; const isGroup = !!selected_group; - template.find('[data-group="true"]').toggle(isGroup); - template.find('[data-character="true"]').toggle(!isGroup); - template.find('.chat_scenario').val(metadataValue).on('input', onScenarioOverrideInput); - template.find('.remove_scenario_override').on('click', onScenarioOverrideRemoveClick); - callPopup(template, 'text'); + + const $template = $(await renderTemplateAsync('scenarioOverride')); + $template.find('[data-group="true"]').toggle(isGroup); + $template.find('[data-character="true"]').toggle(!isGroup); + // TODO: Why does this save on every character input? Save on popup close + $template.find('.chat_scenario').val(metadataValue).on('input', onScenarioOverrideInput); + $template.find('.remove_scenario_override').on('click', onScenarioOverrideRemoveClick); + + await callGenericPopup($template, POPUP_TYPE.TEXT, ''); } function onScenarioOverrideInput() { @@ -9125,10 +9129,6 @@ jQuery(async function () { $('#groupCurrentMemberListToggle .inline-drawer-icon').trigger('click'); }, 200); - $('#chat').on('wheel touchstart', () => { - scrollLock = true; - }); - $(document).on('click', '.api_loading', cancelStatusCheck); //////////INPUT BAR FOCUS-KEEPING LOGIC///////////// @@ -9233,23 +9233,32 @@ jQuery(async function () { */ function autoFitEditTextArea(e) { scroll_holder = chatElement[0].scrollTop; - e.style.height = '0'; - e.style.height = `${e.scrollHeight + 4}px`; + e.style.height = '0px'; + const newHeight = e.scrollHeight + 4; + e.style.height = `${newHeight}px`; is_use_scroll_holder = true; } - const autoFitEditTextAreaDebounced = debouncedThrottle(autoFitEditTextArea, debounce_timeout.standard); + const autoFitEditTextAreaDebounced = debounce(autoFitEditTextArea, debounce_timeout.short); document.addEventListener('input', e => { if (e.target instanceof HTMLTextAreaElement && e.target.classList.contains('edit_textarea')) { - const immediately = e.target.scrollHeight > e.target.offsetHeight || e.target.value === ''; + const scrollbarShown = e.target.clientWidth < e.target.offsetWidth && e.target.offsetHeight >= window.innerHeight * 0.75; + const immediately = (e.target.scrollHeight > e.target.offsetHeight && !scrollbarShown) || e.target.value === ''; immediately ? autoFitEditTextArea(e.target) : autoFitEditTextAreaDebounced(e.target); } }); - document.getElementById('chat').addEventListener('scroll', function () { + const chatElementScroll = document.getElementById('chat'); + chatElementScroll.addEventListener('wheel', function () { + scrollLock = true; + }, { passive: true }); + chatElementScroll.addEventListener('touchstart', function () { + scrollLock = true; + }, { passive: true }); + chatElementScroll.addEventListener('scroll', function () { if (is_use_scroll_holder) { this.scrollTop = scroll_holder; is_use_scroll_holder = false; } - }); + }, { passive: true }); $(document).on('click', '.mes', function () { //when a 'delete message' parent div is clicked @@ -9800,7 +9809,7 @@ jQuery(async function () { }); //confirms message deletion with the "ok" button - $('#dialogue_del_mes_ok').click(async function () { + $('#dialogue_del_mes_ok').on('click', async function () { $('#dialogue_del_mes').css('display', 'none'); $('#send_form').css('display', css_send_form_display); $('.del_checkbox').each(function () { @@ -9816,7 +9825,7 @@ jQuery(async function () { chat.length = this_del_mes; await saveChatConditional(); chatElement.scrollTop(chatElement[0].scrollHeight); - eventSource.emit(event_types.MESSAGE_DELETED, chat.length); + await eventSource.emit(event_types.MESSAGE_DELETED, chat.length); $('#chat .mes').removeClass('last_mes'); $('#chat .mes').last().addClass('last_mes'); } else { @@ -10647,7 +10656,7 @@ jQuery(async function () { openCharacterWorldPopup(); break; case 'set_chat_scenario': - setScenarioOverride(); + await setScenarioOverride(); break; case 'renameCharButton': renameCharacter(); @@ -10668,7 +10677,7 @@ jQuery(async function () { const source = getCharacterSource(this_chid); if (source && isValidUrl(source)) { const url = new URL(source); - const confirm = await callPopup(`Open ${url.hostname} in a new tab?`, 'confirm'); + const confirm = await Popup.show.confirm('Open Source', `Do you want to open the link to ${url.hostname} in a new tab?${url}`); if (confirm) { window.open(source, '_blank'); } @@ -10677,7 +10686,7 @@ jQuery(async function () { } } break; case 'replace_update': { - const confirm = await callPopup('

Choose a new character card to replace this character with.

All chats, assets and group memberships will be preserved, but local changes to the character data will be lost.

Proceed?

', 'confirm', ''); + const confirm = await Popup.show.confirm('Replace Character', '

Choose a new character card to replace this character with.

All chats, assets and group memberships will be preserved, but local changes to the character data will be lost.
Proceed?'); if (confirm) { async function uploadReplacementCard(e) { const file = e.target.files[0]; diff --git a/public/scripts/RossAscends-mods.js b/public/scripts/RossAscends-mods.js index dceba9063..7723c8512 100644 --- a/public/scripts/RossAscends-mods.js +++ b/public/scripts/RossAscends-mods.js @@ -696,18 +696,18 @@ const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1; function autoFitSendTextArea() { const originalScrollBottom = chatBlock.scrollHeight - (chatBlock.scrollTop + chatBlock.offsetHeight); if (Math.ceil(sendTextArea.scrollHeight + 3) >= Math.floor(sendTextArea.offsetHeight)) { - // Needs to be pulled dynamically because it is affected by font size changes - const sendTextAreaMinHeight = window.getComputedStyle(sendTextArea).getPropertyValue('min-height'); + const sendTextAreaMinHeight = '0px'; sendTextArea.style.height = sendTextAreaMinHeight; } - sendTextArea.style.height = sendTextArea.scrollHeight + 3 + 'px'; + const newHeight = sendTextArea.scrollHeight + 3; + sendTextArea.style.height = `${newHeight}px`; if (!isFirefox) { const newScrollTop = Math.round(chatBlock.scrollHeight - (chatBlock.offsetHeight + originalScrollBottom)); chatBlock.scrollTop = newScrollTop; } } -export const autoFitSendTextAreaDebounced = debounce(autoFitSendTextArea); +export const autoFitSendTextAreaDebounced = debounce(autoFitSendTextArea, debounce_timeout.short); // --------------------------------------------------- @@ -881,12 +881,14 @@ export function initRossMods() { saveSettingsDebounced(); }); - $(sendTextArea).on('input', () => { - if (sendTextArea.scrollHeight > sendTextArea.offsetHeight || sendTextArea.value === '') { - autoFitSendTextArea(); - } else { - autoFitSendTextAreaDebounced(); - } + sendTextArea.addEventListener('input', () => { + const hasContent = sendTextArea.value !== ''; + const fitsCurrentSize = sendTextArea.scrollHeight <= sendTextArea.offsetHeight; + const isScrollbarShown = sendTextArea.clientWidth < sendTextArea.offsetWidth; + const isHalfScreenHeight = sendTextArea.offsetHeight >= window.innerHeight / 2; + const needsDebounce = hasContent && (fitsCurrentSize || (isScrollbarShown && isHalfScreenHeight)); + if (needsDebounce) autoFitSendTextAreaDebounced(); + else autoFitSendTextArea(); saveUserInputDebounced(); }); diff --git a/public/scripts/extensions/caption/index.js b/public/scripts/extensions/caption/index.js index b47f73a2f..dbfbc0d1d 100644 --- a/public/scripts/extensions/caption/index.js +++ b/public/scripts/extensions/caption/index.js @@ -333,8 +333,9 @@ async function getCaptionForFile(file, prompt, quiet) { return caption; } catch (error) { - toastr.error('Failed to caption image.'); - console.log(error); + const errorMessage = error.message || 'Unknown error'; + toastr.error(errorMessage, "Failed to caption image."); + console.error(error); return ''; } finally { diff --git a/public/scripts/extensions/memory/index.js b/public/scripts/extensions/memory/index.js index 2bb5c1269..0bc2ff577 100644 --- a/public/scripts/extensions/memory/index.js +++ b/public/scripts/extensions/memory/index.js @@ -914,7 +914,7 @@ jQuery(async function () { await addExtensionControls(); loadSettings(); - eventSource.on(event_types.MESSAGE_RECEIVED, onChatEvent); + eventSource.makeLast(event_types.CHARACTER_MESSAGE_RENDERED, onChatEvent); eventSource.on(event_types.MESSAGE_DELETED, onChatEvent); eventSource.on(event_types.MESSAGE_EDITED, onChatEvent); eventSource.on(event_types.MESSAGE_SWIPED, onChatEvent); diff --git a/public/scripts/extensions/quick-reply/index.js b/public/scripts/extensions/quick-reply/index.js index b0f496126..ab6044bf0 100644 --- a/public/scripts/extensions/quick-reply/index.js +++ b/public/scripts/extensions/quick-reply/index.js @@ -239,7 +239,7 @@ eventSource.on(event_types.CHAT_CHANGED, (...args)=>executeIfReadyElseQueue(onCh const onUserMessage = async () => { await autoExec.handleUser(); }; -eventSource.on(event_types.USER_MESSAGE_RENDERED, (...args)=>executeIfReadyElseQueue(onUserMessage, args)); +eventSource.makeFirst(event_types.USER_MESSAGE_RENDERED, (...args)=>executeIfReadyElseQueue(onUserMessage, args)); const onAiMessage = async (messageId) => { if (['...'].includes(chat[messageId]?.mes)) { @@ -249,7 +249,7 @@ const onAiMessage = async (messageId) => { await autoExec.handleAi(); }; -eventSource.on(event_types.CHARACTER_MESSAGE_RENDERED, (...args)=>executeIfReadyElseQueue(onAiMessage, args)); +eventSource.makeFirst(event_types.CHARACTER_MESSAGE_RENDERED, (...args)=>executeIfReadyElseQueue(onAiMessage, args)); const onGroupMemberDraft = async () => { await autoExec.handleGroupMemberDraft(); diff --git a/public/scripts/extensions/stable-diffusion/index.js b/public/scripts/extensions/stable-diffusion/index.js index bc7c3f2d3..85967f7bd 100644 --- a/public/scripts/extensions/stable-diffusion/index.js +++ b/public/scripts/extensions/stable-diffusion/index.js @@ -2178,6 +2178,11 @@ function getQuietPrompt(mode, trigger) { return stringFormat(extension_settings.sd.prompts[mode], trigger); } +/** + * Sanitizes generated prompt for image generation. + * @param {string} str String to process + * @returns {string} Processed reply + */ function processReply(str) { if (!str) { return ''; @@ -2187,7 +2192,8 @@ function processReply(str) { str = str.replaceAll('“', ''); str = str.replaceAll('.', ','); str = str.replaceAll('\n', ', '); - str = str.replace(/[^a-zA-Z0-9,:_(){}[\]\-']+/g, ' '); + str = str.normalize('NFD'); + str = str.replace(/[^a-zA-Z0-9,:_(){}<>[\]\-']+/g, ' '); str = str.replace(/\s+/g, ' '); // Collapse multiple whitespaces into one str = str.trim(); diff --git a/public/scripts/instruct-mode.js b/public/scripts/instruct-mode.js index 862237cf6..497774315 100644 --- a/public/scripts/instruct-mode.js +++ b/public/scripts/instruct-mode.js @@ -333,6 +333,9 @@ export function formatInstructModeChat(name, mes, isUser, isNarrator, forceAvata if (power_user.instruct.macro) { prefix = substituteParams(prefix, name1, name2); prefix = prefix.replace(/{{name}}/gi, name || 'System'); + + suffix = substituteParams(suffix, name1, name2); + suffix = suffix.replace(/{{name}}/gi, name || 'System'); } if (!suffix && power_user.instruct.wrap) { @@ -398,6 +401,8 @@ export function formatInstructModeExamples(mesExamplesArray, name1, name2) { inputPrefix = inputPrefix.replace(/{{name}}/gi, name1); outputPrefix = outputPrefix.replace(/{{name}}/gi, name2); + inputSuffix = inputSuffix.replace(/{{name}}/gi, name1); + outputSuffix = outputSuffix.replace(/{{name}}/gi, name2); if (!inputSuffix && power_user.instruct.wrap) { inputSuffix = '\n'; diff --git a/public/scripts/openai.js b/public/scripts/openai.js index 00d319121..e2402c095 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -53,6 +53,7 @@ import { getFileText, getImageSizeFromDataURL, getSortableDelay, + getStringHash, isDataURL, parseJsonFile, resetScrollHeight, @@ -72,6 +73,7 @@ import { SlashCommand } from './slash-commands/SlashCommand.js'; import { ARGUMENT_TYPE, SlashCommandArgument } from './slash-commands/SlashCommandArgument.js'; import { renderTemplateAsync } from './templates.js'; import { SlashCommandEnumValue } from './slash-commands/SlashCommandEnumValue.js'; +import { Popup, POPUP_RESULT } from './popup.js'; export { openai_messages_count, @@ -202,6 +204,15 @@ const custom_prompt_post_processing_types = { CLAUDE: 'claude', }; +const sensitiveFields = [ + 'reverse_proxy', + 'proxy_password', + 'custom_url', + 'custom_include_body', + 'custom_exclude_body', + 'custom_include_headers', +]; + function getPrefixMap() { return selected_group ? { assistant: '', @@ -388,7 +399,7 @@ let openai_settings; let promptManager = null; -function validateReverseProxy() { +async function validateReverseProxy() { if (!oai_settings.reverse_proxy) { return; } @@ -402,6 +413,19 @@ function validateReverseProxy() { resultCheckStatus(); throw err; } + const rememberKey = `Proxy_SkipConfirm_${getStringHash(oai_settings.reverse_proxy)}`; + const skipConfirm = localStorage.getItem(rememberKey) === 'true'; + + const confirmation = skipConfirm || await Popup.show.confirm('Connecting To Proxy', `Are you sure you want to connect to the following proxy URL?${DOMPurify.sanitize(oai_settings.reverse_proxy)}`); + + if (!confirmation) { + toastr.error('Update or remove your reverse proxy settings.'); + setOnlineStatus('no_connection'); + resultCheckStatus(); + throw new Error('Proxy connection denied.'); + } + + localStorage.setItem(rememberKey, String(true)); } /** @@ -1787,7 +1811,7 @@ async function sendOpenAIRequest(type, messages, signal) { // Proxy is only supported for Claude, OpenAI, Mistral, and Google MakerSuite if (oai_settings.reverse_proxy && [chat_completion_sources.CLAUDE, chat_completion_sources.OPENAI, chat_completion_sources.MISTRALAI, chat_completion_sources.MAKERSUITE].includes(oai_settings.chat_completion_source)) { - validateReverseProxy(); + await validateReverseProxy(); generate_data['reverse_proxy'] = oai_settings.reverse_proxy; generate_data['proxy_password'] = oai_settings.proxy_password; } @@ -3200,7 +3224,7 @@ async function getStatusOpen() { }; if (oai_settings.reverse_proxy && (oai_settings.chat_completion_source === chat_completion_sources.OPENAI || oai_settings.chat_completion_source === chat_completion_sources.CLAUDE)) { - validateReverseProxy(); + await validateReverseProxy(); } if (oai_settings.chat_completion_source === chat_completion_sources.CUSTOM) { @@ -3495,6 +3519,26 @@ async function onPresetImportFileChange(e) { return; } + const fields = sensitiveFields.filter(field => presetBody[field]).map(field => `${field}`); + const shouldConfirm = fields.length > 0; + + if (shouldConfirm) { + const textHeader = 'The imported preset contains proxy and/or custom endpoint settings.'; + const textMessage = fields.join('
'); + const cancelButton = { text: 'Cancel import', result: POPUP_RESULT.CANCELLED, appendAtEnd: true }; + const popupOptions = { customButtons: [cancelButton], okButton: 'Remove them', cancelButton: 'Import as-is' }; + const popupResult = await Popup.show.confirm(textHeader, textMessage, popupOptions); + + if (popupResult === POPUP_RESULT.CANCELLED) { + console.log('Import cancelled by user'); + return; + } + + if (popupResult === POPUP_RESULT.AFFIRMATIVE) { + sensitiveFields.forEach(field => delete presetBody[field]); + } + } + if (name in openai_setting_names) { const confirm = await callPopup('Preset name already exists. Overwrite?', 'confirm'); @@ -3541,8 +3585,22 @@ async function onExportPresetClick() { const preset = structuredClone(openai_settings[openai_setting_names[oai_settings.preset_settings_openai]]); - delete preset.reverse_proxy; - delete preset.proxy_password; + const fieldValues = sensitiveFields.filter(field => preset[field]).map(field => `${field}: ${preset[field]}`); + const shouldConfirm = fieldValues.length > 0; + const textHeader = 'Your preset contains proxy and/or custom endpoint settings.'; + const textMessage = `
Do you want to remove these fields before exporting?

${DOMPurify.sanitize(fieldValues.join('
'))}`; + const cancelButton = { text: 'Cancel', result: POPUP_RESULT.CANCELLED, appendAtEnd: true }; + const popupOptions = { customButtons: [cancelButton] }; + const popupResult = await Popup.show.confirm(textHeader, textMessage, popupOptions); + + if (popupResult === POPUP_RESULT.CANCELLED) { + console.log('Export cancelled by user'); + return; + } + + if (!shouldConfirm || popupResult === POPUP_RESULT.AFFIRMATIVE) { + sensitiveFields.forEach(field => delete preset[field]); + } const presetJsonString = JSON.stringify(preset, null, 4); const presetFileName = `${oai_settings.preset_settings_openai}.json`; @@ -4679,22 +4737,23 @@ function runProxyCallback(_, value) { return foundName; } -SlashCommandParser.addCommandObject(SlashCommand.fromProps({ - name: 'proxy', - callback: runProxyCallback, - returns: 'current proxy', - namedArgumentList: [], - unnamedArgumentList: [ - SlashCommandArgument.fromProps({ - description: 'name', - typeList: [ARGUMENT_TYPE.STRING], - isRequired: true, - enumProvider: () => proxies.map(preset => new SlashCommandEnumValue(preset.name, preset.url)), - }), - ], - helpString: 'Sets a proxy preset by name.', -})); - +export function initOpenai() { + SlashCommandParser.addCommandObject(SlashCommand.fromProps({ + name: 'proxy', + callback: runProxyCallback, + returns: 'current proxy', + namedArgumentList: [], + unnamedArgumentList: [ + SlashCommandArgument.fromProps({ + description: 'name', + typeList: [ARGUMENT_TYPE.STRING], + isRequired: true, + enumProvider: () => proxies.map(preset => new SlashCommandEnumValue(preset.name, preset.url)), + }), + ], + helpString: 'Sets a proxy preset by name.', + })); +} $(document).ready(async function () { $('#test_api_button').on('click', testApiConnection); diff --git a/public/scripts/personas.js b/public/scripts/personas.js index 3ed28b95e..45f515c5f 100644 --- a/public/scripts/personas.js +++ b/public/scripts/personas.js @@ -395,19 +395,16 @@ export async function convertCharacterToPersona(characterId = null) { const overwriteName = `${name} (Persona).png`; if (overwriteName in power_user.personas) { - const confirmation = await callPopup('This character exists as a persona already. Are you sure want to overwrite it?', 'confirm', '', { okButton: 'Yes' }); - - if (confirmation === false) { + const confirm = await Popup.show.confirm('Overwrite Existing Persona', 'This character exists as a persona already. Do you want to overwrite it?'); + if (!confirm) { console.log('User cancelled the overwrite of the persona'); return; } } if (description.includes('{{char}}') || description.includes('{{user}}')) { - await delay(500); - const confirmation = await callPopup('This character has a description that uses {{char}} or {{user}} macros. Do you want to swap them in the persona description?', 'confirm', '', { okButton: 'Yes' }); - - if (confirmation) { + const confirm = await Popup.show.confirm('Persona Description Macros', 'This character has a description that uses {{char}} or {{user}} macros. Do you want to swap them in the persona description?'); + if (confirm) { description = description.replace(/{{char}}/gi, '{{personaChar}}').replace(/{{user}}/gi, '{{personaUser}}'); description = description.replace(/{{personaUser}}/gi, '{{char}}').replace(/{{personaChar}}/gi, '{{user}}'); } diff --git a/public/scripts/popup.js b/public/scripts/popup.js index 944af3ae7..4ece1b468 100644 --- a/public/scripts/popup.js +++ b/public/scripts/popup.js @@ -194,7 +194,7 @@ export class Popup { const buttonElement = document.createElement('div'); buttonElement.classList.add('menu_button', 'popup-button-custom', 'result-control'); buttonElement.classList.add(...(button.classes ?? [])); - buttonElement.dataset.result = String(button.result ?? undefined); + buttonElement.dataset.result = String(button.result); // This is expected to also write 'null' or 'staging', to indicate cancel and no action respectively buttonElement.textContent = button.text; buttonElement.dataset.i18n = buttonElement.textContent; buttonElement.tabIndex = 0; @@ -317,9 +317,14 @@ export class Popup { // Bind event listeners for all result controls to their defined event type this.dlg.querySelectorAll('[data-result]').forEach(resultControl => { if (!(resultControl instanceof HTMLElement)) return; - const result = Number(resultControl.dataset.result); - if (String(undefined) === String(resultControl.dataset.result)) return; - if (isNaN(result)) throw new Error('Invalid result control. Result must be a number. ' + resultControl.dataset.result); + // If no value was set, we exit out and don't bind an action + if (String(resultControl.dataset.result) === String(undefined)) return; + + // Make sure that both `POPUP_RESULT` numbers and also `null` as 'cancelled' are supported + const result = String(resultControl.dataset.result) === String(null) ? null + : Number(resultControl.dataset.result); + + if (result !== null && isNaN(result)) throw new Error('Invalid result control. Result must be a number. ' + resultControl.dataset.result); const type = resultControl.dataset.resultEvent || 'click'; resultControl.addEventListener(type, async () => await this.complete(result)); }); diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index f57de63ff..08fbfb504 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -2734,45 +2734,26 @@ async function doDelMode(_, text) { return ''; } - //first enter delmode - $('#option_delete_mes').trigger('click', { fromSlashCommand: true }); - - //parse valid args - if (text) { - await delay(300); //same as above, need event signal for 'entered del mode' - console.debug('parsing msgs to del'); - let numMesToDel = Number(text); - let lastMesID = Number($('#chat .mes').last().attr('mesid')); - let oldestMesIDToDel = lastMesID - numMesToDel + 1; - - if (oldestMesIDToDel < 0) { - toastr.warning(`Cannot delete more than ${chat.length} messages.`); - return ''; - } - - let oldestMesToDel = $('#chat').find(`.mes[mesid=${oldestMesIDToDel}]`); - - if (!oldestMesIDToDel && lastMesID > 0) { - oldestMesToDel = await loadUntilMesId(oldestMesIDToDel); - - if (!oldestMesToDel || !oldestMesToDel.length) { - return ''; - } - } - - let oldestDelMesCheckbox = $(oldestMesToDel).find('.del_checkbox'); - let newLastMesID = oldestMesIDToDel - 1; - console.debug(`DelMesReport -- numMesToDel: ${numMesToDel}, lastMesID: ${lastMesID}, oldestMesIDToDel:${oldestMesIDToDel}, newLastMesID: ${newLastMesID}`); - oldestDelMesCheckbox.trigger('click'); - let trueNumberOfDeletedMessage = lastMesID - oldestMesIDToDel + 1; - - //await delay(1) - $('#dialogue_del_mes_ok').trigger('click'); - toastr.success(`Deleted ${trueNumberOfDeletedMessage} messages.`); + // Just enter the delete mode. + if (!text) { + $('#option_delete_mes').trigger('click', { fromSlashCommand: true }); return ''; } - return ''; + const count = Number(text); + + // Nothing to delete. + if (count < 1) { + return ''; + } + + if (count > chat.length) { + toastr.warning(`Cannot delete more than ${chat.length} messages.`); + return ''; + } + + const range = `${chat.length - count}-${chat.length - 1}`; + return doMesCut(_, range); } function doResetPanels() { diff --git a/public/scripts/preset-manager.js b/public/scripts/preset-manager.js index 90fe232ba..547aa58e0 100644 --- a/public/scripts/preset-manager.js +++ b/public/scripts/preset-manager.js @@ -1,6 +1,5 @@ import { amount_gen, - callPopup, characters, eventSource, event_types, @@ -19,6 +18,7 @@ import { import { groups, selected_group } from './group-chats.js'; import { instruct_presets } from './instruct-mode.js'; import { kai_settings } from './kai-settings.js'; +import { Popup } from './popup.js'; import { context_presets, getContextSettings, power_user } from './power-user.js'; import { SlashCommand } from './slash-commands/SlashCommand.js'; import { ARGUMENT_TYPE, SlashCommandArgument } from './slash-commands/SlashCommandArgument.js'; @@ -165,11 +165,8 @@ class PresetManager { async savePresetAs() { const inputValue = this.getSelectedPresetName(); - const popupText = ` -

Preset name:

- ${!this.isNonGenericApi() ? '

Hint: Use a character/group name to bind preset to a specific chat.

' : ''}`; - const name = await callPopup(popupText, 'input', inputValue); - + const popupText = !this.isNonGenericApi() ? '

Hint: Use a character/group name to bind preset to a specific chat.

' : ''; + const name = await Popup.show.input('Preset name:', popupText, inputValue); if (!name) { console.log('Preset name not provided'); return; @@ -304,6 +301,9 @@ class PresetManager { const filteredKeys = [ 'preset', + 'streaming', + 'truncation_length', + 'n', 'streaming_url', 'stopping_strings', 'can_use_tokenization', @@ -372,7 +372,7 @@ class PresetManager { if (Object.keys(preset_names).length) { const nextPresetName = Object.keys(preset_names)[0]; const newValue = preset_names[nextPresetName]; - $(this.select).find(`option[value="${newValue}"]`).attr('selected', true); + $(this.select).find(`option[value="${newValue}"]`).attr('selected', 'true'); $(this.select).trigger('change'); } @@ -597,8 +597,7 @@ export async function initPresetManager() { return; } - const confirm = await callPopup('Delete the preset? This action is irreversible and your current settings will be overwritten.', 'confirm'); - + const confirm = await Popup.show.confirm('Delete the preset?', 'This action is irreversible and your current settings will be overwritten.'); if (!confirm) { return; } @@ -641,8 +640,7 @@ export async function initPresetManager() { return; } - const confirm = await callPopup('

Are you sure?

Resetting a default preset will restore the default settings.', 'confirm'); - + const confirm = await Popup.show.confirm('Are you sure?', 'Resetting a default preset will restore the default settings.'); if (!confirm) { return; } @@ -653,8 +651,7 @@ export async function initPresetManager() { presetManager.selectPreset(option); toastr.success('Default preset restored'); } else { - const confirm = await callPopup('

Are you sure?

Resetting a custom preset will restore to the last saved state.', 'confirm'); - + const confirm = await Popup.show.confirm('Are you sure?', 'Resetting a custom preset will restore to the last saved state.'); if (!confirm) { return; } diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index 533ca5e36..71d8c894a 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -952,14 +952,36 @@ export function initDefaultSlashCommands() { SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'fuzzy', callback: fuzzyCallback, - returns: 'first matching item', + returns: 'matching item', namedArgumentList: [ - new SlashCommandNamedArgument( - 'list', 'list of items to match against', [ARGUMENT_TYPE.LIST], true, - ), - new SlashCommandNamedArgument( - 'threshold', 'fuzzy match threshold (0.0 to 1.0)', [ARGUMENT_TYPE.NUMBER], false, false, '0.4', - ), + SlashCommandNamedArgument.fromProps({ + name: 'list', + description: 'list of items to match against', + acceptsMultiple: false, + isRequired: true, + typeList: [ARGUMENT_TYPE.LIST, ARGUMENT_TYPE.VARIABLE_NAME], + enumProvider: commonEnumProviders.variables('all'), + }), + SlashCommandNamedArgument.fromProps({ + name: 'threshold', + description: 'fuzzy match threshold (0.0 to 1.0)', + typeList: [ARGUMENT_TYPE.NUMBER], + isRequired: false, + defaultValue: '0.4', + acceptsMultiple: false, + }), + SlashCommandNamedArgument.fromProps({ + name: 'mode', + description: 'fuzzy match mode', + typeList: [ARGUMENT_TYPE.STRING], + isRequired: false, + defaultValue: 'first', + acceptsMultiple: false, + enumList: [ + new SlashCommandEnumValue('first', 'first match below the threshold', enumTypes.enum, enumIcons.default), + new SlashCommandEnumValue('best', 'best match below the threshold', enumTypes.enum, enumIcons.default), + ], + }), ], unnamedArgumentList: [ new SlashCommandArgument( @@ -976,6 +998,13 @@ export function initDefaultSlashCommands() { A low value (min 0.0) means the match is very strict. At 1.0 (max) the match is very loose and will match anything.
+
+ The optional mode argument allows to control the behavior when multiple items match the text. +
    +
  • first (default) returns the first match below the threshold.
  • +
  • best returns the best match below the threshold.
  • +
+
The returned value passes to the next command through the pipe.
@@ -1865,7 +1894,7 @@ async function inputCallback(args, prompt) { * @param {FuzzyCommandArgs} args - arguments containing "list" (JSON array) and optionaly "threshold" (float between 0.0 and 1.0) * @param {string} searchInValue - the string where items of list are searched * @returns {string} - the matched item from the list - * @typedef {{list: string, threshold: string}} FuzzyCommandArgs - arguments for /fuzzy command + * @typedef {{list: string, threshold: string, mode:string}} FuzzyCommandArgs - arguments for /fuzzy command * @example /fuzzy list=["down","left","up","right"] "he looks up" | /echo // should return "up" * @link https://www.fusejs.io/ */ @@ -1895,7 +1924,7 @@ function fuzzyCallback(args, searchInValue) { }; // threshold determines how strict is the match, low threshold value is very strict, at 1 (nearly?) everything matches if ('threshold' in args) { - params.threshold = parseFloat(resolveVariable(args.threshold)); + params.threshold = parseFloat(args.threshold); if (isNaN(params.threshold)) { console.warn('WARN: \'threshold\' argument must be a float between 0.0 and 1.0 for /fuzzy command'); return ''; @@ -1908,16 +1937,42 @@ function fuzzyCallback(args, searchInValue) { } } - const fuse = new Fuse([searchInValue], params); - // each item in the "list" is searched within "search_item", if any matches it returns the matched "item" - for (const searchItem of list) { - const result = fuse.search(searchItem); - if (result.length > 0) { - console.info('fuzzyCallback Matched: ' + searchItem); - return searchItem; + function getFirstMatch() { + const fuse = new Fuse([searchInValue], params); + // each item in the "list" is searched within "search_item", if any matches it returns the matched "item" + for (const searchItem of list) { + const result = fuse.search(searchItem); + console.debug('/fuzzy: result', result); + if (result.length > 0) { + console.info('/fuzzy: first matched', searchItem); + return searchItem; + } } + + console.info('/fuzzy: no match'); + return ''; + } + + function getBestMatch() { + const fuse = new Fuse(list, params); + const result = fuse.search(searchInValue); + console.debug('/fuzzy: result', result); + if (result.length > 0) { + console.info('/fuzzy: best matched', result[0].item); + return result[0].item; + } + + console.info('/fuzzy: no match'); + return ''; + } + + switch (String(args.mode).trim().toLowerCase()) { + case 'best': + return getBestMatch(); + case 'first': + default: + return getFirstMatch(); } - return ''; } catch { console.warn('WARN: Invalid list argument provided for /fuzzy command'); return ''; diff --git a/public/scripts/slash-commands/SlashCommandCommonEnumsProvider.js b/public/scripts/slash-commands/SlashCommandCommonEnumsProvider.js index 683f28ffa..0d9aae5c6 100644 --- a/public/scripts/slash-commands/SlashCommandCommonEnumsProvider.js +++ b/public/scripts/slash-commands/SlashCommandCommonEnumsProvider.js @@ -1,11 +1,11 @@ -import { chat_metadata, characters, substituteParams, chat, extension_prompt_roles, extension_prompt_types } from "../../script.js"; -import { extension_settings } from "../extensions.js"; -import { getGroupMembers, groups, selected_group } from "../group-chats.js"; -import { power_user } from "../power-user.js"; -import { searchCharByName, getTagsList, tags } from "../tags.js"; -import { SlashCommandClosure } from "./SlashCommandClosure.js"; -import { SlashCommandEnumValue, enumTypes } from "./SlashCommandEnumValue.js"; -import { SlashCommandExecutor } from "./SlashCommandExecutor.js"; +import { chat_metadata, characters, substituteParams, chat, extension_prompt_roles, extension_prompt_types } from '../../script.js'; +import { extension_settings } from '../extensions.js'; +import { getGroupMembers, groups } from '../group-chats.js'; +import { power_user } from '../power-user.js'; +import { searchCharByName, getTagsList, tags } from '../tags.js'; +import { world_names } from '../world-info.js'; +import { SlashCommandClosure } from './SlashCommandClosure.js'; +import { SlashCommandEnumValue, enumTypes } from './SlashCommandEnumValue.js'; /** * A collection of regularly used enum icons @@ -103,8 +103,8 @@ export const enumIcons = { // Remove possible nullable types definition to match type icon type = type.replace(/\?$/, ''); return enumIcons[type] ?? enumIcons.default; - } -} + }, +}; /** * A collection of common enum providers @@ -143,7 +143,7 @@ export const commonEnumProviders = { ...isAll || types.includes('global') ? Object.keys(extension_settings.variables.global ?? []).map(name => new SlashCommandEnumValue(name, null, enumTypes.macro, enumIcons.globalVariable)) : [], ...isAll || types.includes('local') ? Object.keys(chat_metadata.variables ?? []).map(name => new SlashCommandEnumValue(name, null, enumTypes.name, enumIcons.localVariable)) : [], ...isAll || types.includes('scope') ? [].map(name => new SlashCommandEnumValue(name, null, enumTypes.variable, enumIcons.scopeVariable)) : [], // TODO: Add scoped variables here, Lenny - ] + ]; }, /** @@ -180,7 +180,7 @@ export const commonEnumProviders = { * @param {('all' | 'existing' | 'not-existing')?} [mode='all'] - Which types of tags to show * @returns {() => SlashCommandEnumValue[]} */ - tagsForChar: (mode = 'all') => (/** @type {SlashCommandExecutor} */ executor) => { + tagsForChar: (mode = 'all') => (/** @type {import('./SlashCommandExecutor.js').SlashCommandExecutor} */ executor) => { // Try to see if we can find the char during execution to filter down the tags list some more. Otherwise take all tags. const charName = executor.namedArgumentList.find(it => it.name == 'name')?.value; if (charName instanceof SlashCommandClosure) throw new Error('Argument \'name\' does not support closures'); @@ -213,7 +213,7 @@ export const commonEnumProviders = { * * @returns {SlashCommandEnumValue[]} */ - worlds: () => $('#world_info').children().toArray().map(x => new SlashCommandEnumValue(x.textContent, null, enumTypes.name, enumIcons.world)), + worlds: () => world_names.map(worldName => new SlashCommandEnumValue(worldName, null, enumTypes.name, enumIcons.world)), /** * All existing injects for the current chat diff --git a/public/scripts/templates/scenarioOverride.html b/public/scripts/templates/scenarioOverride.html new file mode 100644 index 000000000..997ac5bf7 --- /dev/null +++ b/public/scripts/templates/scenarioOverride.html @@ -0,0 +1,17 @@ +
+
+

Chat Scenario Override

+ +
+
+ Unique to this chat. + All group members will use the following scenario text instead of what is specified in their character cards. + The following scenario text will be used instead of the value set in the character card. + Checkpoints inherit the scenario override from their parent, and can be changed individually after that. +
+
+ +
+
diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index 5387cdcf9..a72d693f7 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -14,7 +14,6 @@ import { SlashCommand } from './slash-commands/SlashCommand.js'; import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from './slash-commands/SlashCommandArgument.js'; import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js'; import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js'; -import { SlashCommandExecutor } from './slash-commands/SlashCommandExecutor.js'; import { SlashCommandClosure } from './slash-commands/SlashCommandClosure.js'; import { callGenericPopup, Popup, POPUP_TYPE } from './popup.js'; @@ -171,7 +170,7 @@ class WorldInfoBuffer { #skew = 0; /** - * @type {number} The starting depth of the global scan depth. Incremented by "min activations" feature to not repeat scans. When > 0 it means a complete scan was done up to #startDepth already, and `advanceScanPosition` was called. + * @type {number} The starting depth of the global scan depth. */ #startDepth = 0; @@ -224,12 +223,12 @@ class WorldInfoBuffer { } if (depth < 0) { - console.error(`Invalid WI scan depth ${depth}. Must be >= 0`); + console.error(`[WI] Invalid WI scan depth ${depth}. Must be >= 0`); return ''; } if (depth > MAX_SCAN_DEPTH) { - console.warn(`Invalid WI scan depth ${depth}. Truncating to ${MAX_SCAN_DEPTH}`); + console.warn(`[WI] Invalid WI scan depth ${depth}. Truncating to ${MAX_SCAN_DEPTH}`); depth = MAX_SCAN_DEPTH; } @@ -303,10 +302,17 @@ class WorldInfoBuffer { } /** - * Increments skew and sets startDepth to previous depth. + * Checks if the recursion buffer is not empty. + * @returns {boolean} Returns true if the recursion buffer is not empty, otherwise false */ - advanceScanPosition() { - this.#startDepth = this.getDepth(); + hasRecurse() { + return this.#recurseBuffer.length > 0; + } + + /** + * Increments skew to advance the scan range. + */ + advanceScan() { this.#skew++; } @@ -438,7 +444,7 @@ class WorldInfoTimedEffects { const key = this.#getEntryKey(entry); const effect = this.#getEntryTimedEffect('cooldown', entry, true); chat_metadata.timedWorldInfo.cooldown[key] = effect; - console.log(`Adding cooldown entry ${key} on ended sticky: start=${effect.start}, end=${effect.end}, protected=${effect.protected}`); + console.log(`[WI] Adding cooldown entry ${key} on ended sticky: start=${effect.start}, end=${effect.end}, protected=${effect.protected}`); // Set the cooldown immediately for this evaluation this.#buffer.cooldown.push(entry); }, @@ -449,10 +455,10 @@ class WorldInfoTimedEffects { * @param {WIScanEntry} entry Entry that ended cooldown */ 'cooldown': (entry) => { - console.debug('Cooldown ended for entry', entry.uid); + console.debug('[WI] Cooldown ended for entry', entry.uid); }, - 'delay': () => {}, + 'delay': () => { }, }; /** @@ -539,11 +545,11 @@ class WorldInfoTimedEffects { /** @type {[string, WITimedEffect][]} */ const effects = Object.entries(chat_metadata.timedWorldInfo[type]); for (const [key, value] of effects) { - console.log(`Processing ${type} entry ${key}`, value); + console.log(`[WI] Processing ${type} entry ${key}`, value); const entry = this.#entries.find(x => String(this.#getEntryHash(x)) === String(value.hash)); if (this.#chat.length <= Number(value.start) && !value.protected) { - console.log(`Removing ${type} entry ${key} from timedWorldInfo: chat not advanced`, value); + console.log(`[WI] Removing ${type} entry ${key} from timedWorldInfo: chat not advanced`, value); delete chat_metadata.timedWorldInfo[type][key]; continue; } @@ -551,7 +557,7 @@ class WorldInfoTimedEffects { // Missing entries (they could be from another character's lorebook) if (!entry) { if (this.#chat.length >= Number(value.end)) { - console.log(`Removing ${type} entry from timedWorldInfo: entry not found and interval passed`, entry); + console.log(`[WI] Removing ${type} entry from timedWorldInfo: entry not found and interval passed`, entry); delete chat_metadata.timedWorldInfo[type][key]; } continue; @@ -559,13 +565,13 @@ class WorldInfoTimedEffects { // Ignore invalid entries (not configured for timed effects) if (!entry[type]) { - console.log(`Removing ${type} entry from timedWorldInfo: entry not ${type}`, entry); + console.log(`[WI] Removing ${type} entry from timedWorldInfo: entry not ${type}`, entry); delete chat_metadata.timedWorldInfo[type][key]; continue; } if (this.#chat.length >= Number(value.end)) { - console.log(`Removing ${type} entry from timedWorldInfo: ${type} interval passed`, entry); + console.log(`[WI] Removing ${type} entry from timedWorldInfo: ${type} interval passed`, entry); delete chat_metadata.timedWorldInfo[type][key]; if (typeof onEnded === 'function') { onEnded(entry); @@ -574,7 +580,7 @@ class WorldInfoTimedEffects { } buffer.push(entry); - console.log(`Timed effect "${type}" applied to entry`, entry); + console.log(`[WI] Timed effect "${type}" applied to entry`, entry); } } @@ -590,7 +596,7 @@ class WorldInfoTimedEffects { if (this.#chat.length < entry.delay) { buffer.push(entry); - console.log('Timed effect "delay" applied to entry', entry); + console.log('[WI] Timed effect "delay" applied to entry', entry); } } @@ -637,7 +643,7 @@ class WorldInfoTimedEffects { const effect = this.#getEntryTimedEffect(type, entry, false); chat_metadata.timedWorldInfo[type][key] = effect; - console.log(`Adding ${type} entry ${key}: start=${effect.start}, end=${effect.end}, protected=${effect.protected}`); + console.log(`[WI] Adding ${type} entry ${key}: start=${effect.start}, end=${effect.end}, protected=${effect.protected}`); } } @@ -669,7 +675,7 @@ class WorldInfoTimedEffects { if (newState) { const effect = this.#getEntryTimedEffect(type, entry, false); chat_metadata.timedWorldInfo[type][key] = effect; - console.log(`Adding ${type} entry ${key}: start=${effect.start}, end=${effect.end}, protected=${effect.protected}`); + console.log(`[WI] Adding ${type} entry ${key}: start=${effect.start}, end=${effect.end}, protected=${effect.protected}`); } } @@ -1216,7 +1222,7 @@ function registerWorldInfoSlashCommands() { enumTypes.enum, enumIcons.getDataTypeIcon(value.type))), /** All existing UIDs based on the file argument as world name */ - wiUids: (/** @type {SlashCommandExecutor} */ executor) => { + wiUids: (/** @type {import('./slash-commands/SlashCommandExecutor.js').SlashCommandExecutor} */ executor) => { const file = executor.namedArgumentList.find(it => it.name == 'file')?.value; if (file instanceof SlashCommandClosure) throw new Error('Argument \'file\' does not support closures'); // Try find world from cache @@ -3162,7 +3168,8 @@ function duplicateWorldInfoEntry(data, uid) { } // Exclude uid and gather the rest of the properties - const { uid: _, ...originalData } = data.entries[uid]; + const originalData = Object.assign({}, data.entries[uid]); + delete originalData.uid; // Create new entry and copy over data const entry = createWorldInfoEntry(data.name, data); @@ -3420,13 +3427,12 @@ async function createNewWorldInfo(worldName, { interactive = false } = {}) { async function getCharacterLore() { const character = characters[this_chid]; const name = character?.name; + /** @type {Set} */ let worldsToSearch = new Set(); const baseWorldName = character?.data?.extensions?.world; if (baseWorldName) { worldsToSearch.add(baseWorldName); - } else { - console.debug(`Character ${name}'s base world could not be found or is empty! Skipping...`); } // TODO: Maybe make the utility function not use the window context? @@ -3436,40 +3442,48 @@ async function getCharacterLore() { worldsToSearch = new Set([...worldsToSearch, ...extraCharLore.extraBooks]); } + if (!worldsToSearch.size) { + return []; + } + let entries = []; for (const worldName of worldsToSearch) { if (selected_world_info.includes(worldName)) { - console.debug(`Character ${name}'s world ${worldName} is already activated in global world info! Skipping...`); + console.debug(`[WI] Character ${name}'s world ${worldName} is already activated in global world info! Skipping...`); continue; } if (chat_metadata[METADATA_KEY] === worldName) { - console.debug(`Character ${name}'s world ${worldName} is already activated in chat lore! Skipping...`); + console.debug(`[WI] Character ${name}'s world ${worldName} is already activated in chat lore! Skipping...`); continue; } const data = await loadWorldInfoData(worldName); - const newEntries = data ? Object.keys(data.entries).map((x) => data.entries[x]).map(x => ({ ...x, world: worldName })) : []; + const newEntries = data ? Object.keys(data.entries).map((x) => data.entries[x]).map(({ uid, ...rest }) => ({ uid, world: worldName, ...rest })) : []; entries = entries.concat(newEntries); + + if (!newEntries.length) { + console.debug(`[WI] Character ${name}'s world ${worldName} could not be found or is empty`); + } } - console.debug(`Character ${name} lore (${Array.from(worldsToSearch)}) has ${entries.length} world info entries`); + console.debug(`[WI] Character ${name}'s lore has ${entries.length} world info entries`, [...worldsToSearch]); return entries; } async function getGlobalLore() { - if (!selected_world_info) { + if (!selected_world_info?.length) { return []; } let entries = []; for (const worldName of selected_world_info) { const data = await loadWorldInfoData(worldName); - const newEntries = data ? Object.keys(data.entries).map((x) => data.entries[x]).map(x => ({ ...x, world: worldName })) : []; + const newEntries = data ? Object.keys(data.entries).map((x) => data.entries[x]).map(({ uid, ...rest }) => ({ uid, world: worldName, ...rest })) : []; entries = entries.concat(newEntries); } - console.debug(`Global world info has ${entries.length} entries`); + console.debug(`[WI] Global world info has ${entries.length} entries`, selected_world_info); return entries; } @@ -3482,14 +3496,14 @@ async function getChatLore() { } if (selected_world_info.includes(chatWorld)) { - console.debug(`Chat world ${chatWorld} is already activated in global world info! Skipping...`); + console.debug(`[WI] Chat world ${chatWorld} is already activated in global world info! Skipping...`); return []; } const data = await loadWorldInfoData(chatWorld); - const entries = data ? Object.keys(data.entries).map((x) => data.entries[x]).map(x => ({ ...x, world: chatWorld })) : []; + const entries = data ? Object.keys(data.entries).map((x) => data.entries[x]).map(({ uid, ...rest }) => ({ uid, world: chatWorld, ...rest })) : []; - console.debug(`Chat lore has ${entries.length} entries`); + console.debug(`[WI] Chat lore has ${entries.length} entries`, [chatWorld]); return entries; } @@ -3513,7 +3527,7 @@ export async function getSortedEntries() { entries = [...globalLore.sort(sortFn), ...characterLore.sort(sortFn)]; break; default: - console.error('Unknown WI insertion strategy: ', world_info_character_strategy, 'defaulting to evenly'); + console.error('[WI] Unknown WI insertion strategy:', world_info_character_strategy, 'defaulting to evenly'); entries = [...globalLore, ...characterLore].sort(sortFn); break; } @@ -3521,7 +3535,13 @@ export async function getSortedEntries() { // Chat lore always goes first entries = [...chatLore.sort(sortFn), ...entries]; - console.debug(`Sorted ${entries.length} world lore entries using strategy ${world_info_character_strategy}`); + // Parse decorators + entries = entries.map((entry) => { + const [decorators, content] = parseDecorators(entry.content); + return { ...entry, decorators, content }; + }); + + console.debug(`[WI] Found ${entries.length} world lore entries. Sorted by strategy`, Object.entries(world_info_insertion_strategy).find((x) => x[1] === world_info_character_strategy)); // Need to deep clone the entries to avoid modifying the cached data return structuredClone(entries); @@ -3600,6 +3620,8 @@ async function checkWorldInfo(chat, maxContext, isDryRun) { const context = getContext(); const buffer = new WorldInfoBuffer(chat); + console.debug(`[WI] --- START WI SCAN (on ${chat.length} messages) ---`); + // Combine the chat // Add the depth or AN if enabled @@ -3623,11 +3645,11 @@ async function checkWorldInfo(chat, maxContext, isDryRun) { let budget = Math.round(world_info_budget * maxContext / 100) || 1; if (world_info_budget_cap > 0 && budget > world_info_budget_cap) { - console.debug(`Budget ${budget} exceeds cap ${world_info_budget_cap}, using cap`); + console.debug(`[WI] Budget ${budget} exceeds cap ${world_info_budget_cap}, using cap`); budget = world_info_budget_cap; } - console.debug(`Context size: ${maxContext}; WI budget: ${budget} (max% = ${world_info_budget}%, cap = ${world_info_budget_cap})`); + console.debug(`[WI] Context size: ${maxContext}; WI budget: ${budget} (max% = ${world_info_budget}%, cap = ${world_info_budget_cap})`); const sortedEntries = await getSortedEntries(); const timedEffects = new WorldInfoTimedEffects(chat, sortedEntries); @@ -3637,19 +3659,40 @@ async function checkWorldInfo(chat, maxContext, isDryRun) { return { worldInfoBefore: '', worldInfoAfter: '', WIDepthEntries: [], EMEntries: [], allActivatedEntries: new Set() }; } + console.debug(`[WI] --- SEARCHING ENTRIES (on ${sortedEntries.length} entries) ---`); + while (scanState) { // Track how many times the loop has run. May be useful for debugging. - // eslint-disable-next-line no-unused-vars count++; + console.debug(`[WI] Loop #${count}. Search state`, Object.entries(scan_state).find(x => x[1] === scanState)); + + // Until decided otherwise, we set the loop to stop scanning after this + let nextScanState = scan_state.NONE; + + // Loop and find all entries that can activate here let activatedNow = new Set(); for (let entry of sortedEntries) { + // Logging preparation + let headerLogged = false; + function log(...args) { + if (!headerLogged) { + console.debug(`[WI] Entry ${entry.uid}`, `from '${entry.world}' processing`, entry); + headerLogged = true; + } + console.debug(`[WI] Entry ${entry.uid}`, ...args); + } - //oarse decorators - const [decorators, content] = parseDecorators(entry.content); - entry.decorators = decorators; - entry.content = content; + // Already processed, considered and then skipped entries should still be skipped + if (failedProbabilityChecks.has(entry) || allActivatedEntries.has(entry)) { + continue; + } + + if (entry.disable == true) { + log('disabled'); + continue; + } // Check if this entry applies to the character or if it's excluded if (entry.characterFilter && entry.characterFilter?.names?.length > 0) { @@ -3657,7 +3700,7 @@ async function checkWorldInfo(chat, maxContext, isDryRun) { const filtered = entry.characterFilter.isExclude ? nameIncluded : !nameIncluded; if (filtered) { - console.debug(`WI entry ${entry.uid} filtered out by character`); + log('filtered out by character'); continue; } } @@ -3674,7 +3717,7 @@ async function checkWorldInfo(chat, maxContext, isDryRun) { const filtered = entry.characterFilter.isExclude ? includesTag : !includesTag; if (filtered) { - console.debug(`WI entry ${entry.uid} filtered out by tag`); + log('filtered out by tag'); continue; } } @@ -3686,198 +3729,253 @@ async function checkWorldInfo(chat, maxContext, isDryRun) { const isDelay = timedEffects.isEffectActive('delay', entry); if (isDelay) { - console.debug(`WI entry ${entry.uid} suppressed by delay`, entry); + log('suppressed by delay'); continue; } if (isCooldown && !isSticky) { - console.debug(`WI entry ${entry.uid} suppressed by cooldown`, entry); - continue; - } - - if (failedProbabilityChecks.has(entry)) { - continue; - } - - if (allActivatedEntries.has(entry) || entry.disable == true) { + log('suppressed by cooldown'); continue; } // Only use checks for recursion flags if the scan step was activated by recursion if (scanState !== scan_state.RECURSION && entry.delayUntilRecursion) { - console.debug(`WI entry ${entry.uid} suppressed by delay until recursion`, entry); + log('suppressed by delay until recursion'); continue; } if (scanState === scan_state.RECURSION && world_info_recursive && entry.excludeRecursion) { - console.debug(`WI entry ${entry.uid} suppressed by exclude recursion`, entry); + log('suppressed by exclude recursion'); continue; } - if (decorators.includes('@@activate')) { - //activate in any case + if (entry.decorators.includes('@@activate')) { + log('activated by @@activate decorator'); activatedNow.add(entry); continue; } - if (decorators.includes('@@dont_activate')) { - //deactivate in any case if @@activate is not present + if (entry.decorators.includes('@@dont_activate')) { + log('suppressed by @@dont_activate decorator'); continue; } - if (entry.constant || buffer.isExternallyActivated(entry) || isSticky) { + // Now do checks for immediate activations + if (entry.constant) { + log('activated because of constant'); + activatedNow.add(entry); + continue; + } + + if (buffer.isExternallyActivated(entry)) { + log('externally activated'); + activatedNow.add(entry); + continue; + } + + if (isSticky) { + log('activated because active sticky'); + activatedNow.add(entry); + continue; + } + + if (!Array.isArray(entry.key) || !entry.key.length) { + log('has no keys defined, skipped'); + continue; + } + + // Cache the text to scan before the loop, it won't change its content + const textToScan = buffer.get(entry, scanState); + + // PRIMARY KEYWORDS + let primaryKeyMatch = entry.key.find(key => { + const substituted = substituteParams(key); + return substituted && buffer.matchKeys(textToScan, substituted.trim(), entry); + }); + + if (!primaryKeyMatch) { + // Don't write logs for simple no-matches + continue; + } + + const hasSecondaryKeywords = ( + entry.selective && //all entries are selective now + Array.isArray(entry.keysecondary) && //always true + entry.keysecondary.length //ignore empties + ); + + if (!hasSecondaryKeywords) { + // Handle cases where secondary is empty + log('activated by primary key match', primaryKeyMatch); activatedNow.add(entry); continue; } - if (Array.isArray(entry.key) && entry.key.length) { //check for keywords existing - // If selectiveLogic isn't found, assume it's AND, only do this once per entry - const selectiveLogic = entry.selectiveLogic ?? 0; + // SECONDARY KEYWORDS + const selectiveLogic = entry.selectiveLogic ?? 0; // If selectiveLogic isn't found, assume it's AND, only do this once per entry + log('Entry with primary key match', primaryKeyMatch, 'has secondary keywords. Checking with logic logic', Object.entries(world_info_logic).find(x => x[1] === entry.selectiveLogic)); - primary: for (let key of entry.key) { - const substituted = substituteParams(key); - const textToScan = buffer.get(entry, scanState); + /** @type {() => boolean} */ + function matchSecondaryKeys() { + let hasAnyMatch = false; + let hasAllMatch = true; + for (let keysecondary of entry.keysecondary) { + const secondarySubstituted = substituteParams(keysecondary); + const hasSecondaryMatch = secondarySubstituted && buffer.matchKeys(textToScan, secondarySubstituted.trim(), entry); - if (substituted && buffer.matchKeys(textToScan, substituted.trim(), entry)) { - console.debug(`WI UID ${entry.uid} found by primary match: ${substituted}.`); + if (hasSecondaryMatch) hasAnyMatch = true; + if (!hasSecondaryMatch) hasAllMatch = false; - //selective logic begins - if ( - entry.selective && //all entries are selective now - Array.isArray(entry.keysecondary) && //always true - entry.keysecondary.length //ignore empties - ) { - console.debug(`WI UID:${entry.uid} found. Checking logic: ${entry.selectiveLogic}`); - let hasAnyMatch = false; - let hasAllMatch = true; - secondary: for (let keysecondary of entry.keysecondary) { - const secondarySubstituted = substituteParams(keysecondary); - const hasSecondaryMatch = secondarySubstituted && buffer.matchKeys(textToScan, secondarySubstituted.trim(), entry); - console.debug(`WI UID:${entry.uid}: Filtering for secondary keyword - "${secondarySubstituted}".`); - - if (hasSecondaryMatch) { - hasAnyMatch = true; - } - - if (!hasSecondaryMatch) { - hasAllMatch = false; - } - - // Simplified AND ANY / NOT ALL if statement. (Proper fix for PR#1356 by Bronya) - // If AND ANY logic and the main checks pass OR if NOT ALL logic and the main checks do not pass - if ((selectiveLogic === world_info_logic.AND_ANY && hasSecondaryMatch) || (selectiveLogic === world_info_logic.NOT_ALL && !hasSecondaryMatch)) { - // Differ both logic statements in the debugger - if (selectiveLogic === world_info_logic.AND_ANY) { - console.debug(`(AND ANY Check) Activating WI Entry ${entry.uid}. Found match for word: ${substituted} ${secondarySubstituted}`); - } else { - console.debug(`(NOT ALL Check) Activating WI Entry ${entry.uid}. Found match for word "${substituted}" without secondary keyword: ${secondarySubstituted}`); - } - activatedNow.add(entry); - break secondary; - } - } - - // Handle NOT ANY logic - if (selectiveLogic === world_info_logic.NOT_ANY && !hasAnyMatch) { - console.debug(`(NOT ANY Check) Activating WI Entry ${entry.uid}, no secondary keywords found.`); - activatedNow.add(entry); - } - - // Handle AND ALL logic - if (selectiveLogic === world_info_logic.AND_ALL && hasAllMatch) { - console.debug(`(AND ALL Check) Activating WI Entry ${entry.uid}, all secondary keywords found.`); - activatedNow.add(entry); - } - } else { - // Handle cases where secondary is empty - console.debug(`WI UID ${entry.uid}: Activated without filter logic.`); - activatedNow.add(entry); - break primary; - } + // Simplified AND ANY / NOT ALL if statement. (Proper fix for PR#1356 by Bronya) + // If AND ANY logic and the main checks pass OR if NOT ALL logic and the main checks do not pass + if (selectiveLogic === world_info_logic.AND_ANY && hasSecondaryMatch) { + log('activated. (AND ANY) Found match secondary keyword', secondarySubstituted); + return true; + } + if (selectiveLogic === world_info_logic.NOT_ALL && !hasSecondaryMatch) { + log('activated. (NOT ALL) Found not matching secondary keyword', secondarySubstituted); + return true; } } + + // Handle NOT ANY logic + if (selectiveLogic === world_info_logic.NOT_ANY && !hasAnyMatch) { + log('activated. (NOT ANY) No secondary keywords found', entry.keysecondary); + return true; + } + + // Handle AND ALL logic + if (selectiveLogic === world_info_logic.AND_ALL && hasAllMatch) { + log('activated. (AND ALL) All secondary keywords found', entry.keysecondary); + return true; + } + + return false; } + + const matched = matchSecondaryKeys(); + if (!matched) { + log('skipped. Secondary keywords not satisfied', entry.keysecondary); + continue; + } + + // Success logging was already done inside the function, so just add the entry + activatedNow.add(entry); + continue; } - scanState = world_info_recursive && activatedNow.size > 0 ? scan_state.RECURSION : scan_state.NONE; + console.debug(`[WI] Search done. Found ${activatedNow.size} possible entries.`); const newEntries = [...activatedNow] .sort((a, b) => sortedEntries.indexOf(a) - sortedEntries.indexOf(b)); let newContent = ''; const textToScanTokens = await getTokenCountAsync(allActivatedText); - const probabilityChecksBefore = failedProbabilityChecks.size; filterByInclusionGroups(newEntries, allActivatedEntries, buffer, scanState); - console.debug('-- PROBABILITY CHECKS BEGIN --'); + console.debug('[WI] --- PROBABILITY CHECKS ---'); for (const entry of newEntries) { - const rollValue = Math.random() * 100; - - if (entry.useProbability && rollValue > entry.probability) { - const isSticky = timedEffects.isEffectActive('sticky', entry); - if (!isSticky) { - console.debug(`WI entry ${entry.uid} ${entry.key} failed probability check, skipping`); - failedProbabilityChecks.add(entry); - continue; + function verifyProbability() { + // If we don't need to roll, it's always true + if (!entry.useProbability || entry.probability === 100) { + console.debug(`WI entry ${entry.uid} does not use probability`); + return true; } - } else { console.debug(`uid:${entry.uid} passed probability check, inserting to prompt`); } + + const isSticky = timedEffects.isEffectActive('sticky', entry); + if (isSticky) { + console.debug(`WI entry ${entry.uid} is sticky, does not need to re-roll probability`); + return true; + } + + const rollValue = Math.random() * 100; + if (rollValue <= entry.probability) { + console.debug(`WI entry ${entry.uid} passed probability check of ${entry.probability}%`); + return true; + } + + failedProbabilityChecks.add(entry); + return false; + } + + const success = verifyProbability(); + if (!success) { + console.debug(`WI entry ${entry.uid} failed probability check, removing from activated entries`, entry); + continue; + } // Substitute macros inline, for both this checking and also future processing entry.content = substituteParams(entry.content); newContent += `${entry.content}\n`; if ((textToScanTokens + (await getTokenCountAsync(newContent))) >= budget) { - console.debug('WI budget reached, stopping'); if (world_info_overflow_alert) { - console.log('Alerting'); + console.warn(`[WI] budget of ${budget} reached, stopping after ${allActivatedEntries.size} entries`); toastr.warning(`World info budget reached after ${allActivatedEntries.size} entries.`, 'World Info'); + } else { + console.debug(`[WI] budget of ${budget} reached, stopping after ${allActivatedEntries.size} entries`); } - scanState = scan_state.NONE; token_budget_overflowed = true; break; } allActivatedEntries.add(entry); - console.debug('WI entry activated:', entry); + console.debug(`[WI] Entry ${entry.uid} activation successful, adding to prompt`, entry); } - const probabilityChecksAfter = failedProbabilityChecks.size; + const successfulNewEntries = newEntries.filter(x => !failedProbabilityChecks.has(x)); + const successfulNewEntriesForRecursion = successfulNewEntries.filter(x => !x.preventRecursion); - if ((probabilityChecksAfter - probabilityChecksBefore) === activatedNow.size) { - console.debug('WI probability checks failed for all activated entries, stopping'); - scanState = scan_state.NONE; + if (!newEntries.length) { + console.debug('[WI] No new entries activated, stopping'); + } else if (!successfulNewEntries.length) { + console.debug('[WI] Probability checks failed for all activated entries, stopping'); + } else { + console.debug(`[WI] Successfully activated ${successfulNewEntries.length} new entries to prompt. ${allActivatedEntries.size} total entries activated.`, successfulNewEntries); } - if (newEntries.length === 0) { - console.debug('No new entries activated, stopping'); - scanState = scan_state.NONE; + // After processing and rolling entries is done, see if we should continue with normal recursion + if (world_info_recursive && !token_budget_overflowed && successfulNewEntriesForRecursion.length) { + nextScanState = scan_state.RECURSION; } + // If we are inside min activations scan, and we have recursive buffer, we should do a recursive scan before increasing the buffer again + // There might be recurse-trigger-able entries that match the buffer, so we need to check that + if (world_info_recursive && !token_budget_overflowed && scanState === scan_state.MIN_ACTIVATIONS && buffer.hasRecurse()) { + nextScanState = scan_state.RECURSION; + } + + // If scanning is planned to stop, but min activations is set and not satisfied, check if we should continue + const minActivationsNotSatisfied = world_info_min_activations > 0 && (allActivatedEntries.size < world_info_min_activations); + if (!nextScanState && !token_budget_overflowed && minActivationsNotSatisfied) { + console.debug('[WI] --- MIN ACTIVATIONS CHECK ---'); + + let over_max = ( + world_info_min_activations_depth_max > 0 && + buffer.getDepth() > world_info_min_activations_depth_max + ) || (buffer.getDepth() > chat.length); + + if (!over_max) { + console.debug(`[WI] Min activations not reached (${allActivatedEntries.size}/${world_info_min_activations}), advancing depth to ${buffer.getDepth() + 1} and checking again`); + nextScanState = scan_state.MIN_ACTIVATIONS; // loop + buffer.advanceScan(); + } else { + console.debug(`[WI] Min activations not reached (${allActivatedEntries.size}/${world_info_min_activations}), but reached on of depth. Stopping`); + } + } + + // Final check if we should really continue scan, and extend the current WI recurse buffer + scanState = nextScanState; if (scanState) { - const text = newEntries - .filter(x => !failedProbabilityChecks.has(x)) - .filter(x => !x.preventRecursion) + const text = successfulNewEntriesForRecursion .map(x => x.content).join('\n'); buffer.addRecurse(text); allActivatedText = (text + '\n' + allActivatedText); } - - // world_info_min_activations - if (!scanState && !token_budget_overflowed) { - if (world_info_min_activations > 0 && (allActivatedEntries.size < world_info_min_activations)) { - let over_max = ( - world_info_min_activations_depth_max > 0 && - buffer.getDepth() > world_info_min_activations_depth_max - ) || (buffer.getDepth() > chat.length); - - if (!over_max) { - scanState = scan_state.MIN_ACTIVATIONS; // loop - buffer.advanceScanPosition(); - } - } - } } + console.debug('[WI] --- BUILDING PROMPT ---'); + // Forward-sorted list of entries for joining const WIBeforeEntries = []; const WIAfterEntries = []; @@ -3893,7 +3991,7 @@ async function checkWorldInfo(chat, maxContext, isDryRun) { const content = getRegexedString(entry.content, regex_placement.WORLD_INFO, { depth: regexDepth, isMarkdown: false, isPrompt: true }); if (!content) { - console.debug('Skipping adding WI entry to prompt due to empty content:', entry); + console.debug(`[WI] Entry ${entry.uid}`, 'skipped adding to prompt due to empty content', entry); return; } @@ -3951,6 +4049,9 @@ async function checkWorldInfo(chat, maxContext, isDryRun) { buffer.resetExternalEffects(); timedEffects.cleanUp(); + console.log(`[WI] Adding ${allActivatedEntries.size} entries to prompt`, Array.from(allActivatedEntries)); + console.debug('[WI] --- DONE ---'); + return { worldInfoBefore, worldInfoAfter, EMEntries, WIDepthEntries, allActivatedEntries }; } @@ -3965,13 +4066,13 @@ function filterGroupsByScoring(groups, buffer, removeEntry, scanState) { for (const [key, group] of Object.entries(groups)) { // Group scoring is disabled both globally and for the group entries if (!world_info_use_group_scoring && !group.some(x => x.useGroupScoring)) { - console.debug(`Skipping group scoring for group '${key}'`); + console.debug(`[WI] Skipping group scoring for group '${key}'`); continue; } const scores = group.map(entry => buffer.getScore(entry, scanState)); const maxScore = Math.max(...scores); - console.debug(`Group '${key}' max score: ${maxScore}`); + console.debug(`[WI] Group '${key}' max score:`, maxScore); //console.table(group.map((entry, i) => ({ uid: entry.uid, key: JSON.stringify(entry.key), score: scores[i] }))); for (let i = 0; i < group.length; i++) { @@ -3982,7 +4083,7 @@ function filterGroupsByScoring(groups, buffer, removeEntry, scanState) { } if (scores[i] < maxScore) { - console.debug(`Removing score loser from inclusion group '${key}' entry '${group[i].uid}'`, group[i]); + console.debug(`[WI] Entry ${group[i].uid}`, `removed as score loser from inclusion group '${key}'`, group[i]); removeEntry(group[i]); group.splice(i, 1); scores.splice(i, 1); @@ -4000,7 +4101,8 @@ function filterGroupsByScoring(groups, buffer, removeEntry, scanState) { * @param {number} scanState The current scan state */ function filterByInclusionGroups(newEntries, allActivatedEntries, buffer, scanState) { - console.debug('-- INCLUSION GROUP CHECKS BEGIN --'); + console.debug('[WI] --- INCLUSION GROUP CHECKS ---'); + const grouped = newEntries.filter(x => x.group).reduce((acc, item) => { item.group.split(/,\s*/).filter(x => x).forEach(group => { if (!acc[group]) { @@ -4012,7 +4114,7 @@ function filterByInclusionGroups(newEntries, allActivatedEntries, buffer, scanSt }, {}); if (Object.keys(grouped).length === 0) { - console.debug('No inclusion groups found'); + console.debug('[WI] No inclusion groups found'); return; } @@ -4023,7 +4125,7 @@ function filterByInclusionGroups(newEntries, allActivatedEntries, buffer, scanSt continue; } - if (logging) console.debug(`Removing loser from inclusion group '${entry.group}' entry '${entry.uid}'`, entry); + if (logging) console.debug(`[WI] Entry ${entry.uid}`, `removed as loser from inclusion group '${entry.group}'`, entry); removeEntry(entry); } } @@ -4031,24 +4133,24 @@ function filterByInclusionGroups(newEntries, allActivatedEntries, buffer, scanSt filterGroupsByScoring(grouped, buffer, removeEntry, scanState); for (const [key, group] of Object.entries(grouped)) { - console.debug(`Checking inclusion group '${key}' with ${group.length} entries`, group); + console.debug(`[WI] Checking inclusion group '${key}' with ${group.length} entries`, group); if (Array.from(allActivatedEntries).some(x => x.group === key)) { - console.debug(`Skipping inclusion group check, group already activated '${key}'`); + console.debug(`[WI] Skipping inclusion group check, group '${key}' was already activated`); // We need to forcefully deactivate all other entries in the group removeAllBut(group, null, false); continue; } if (!Array.isArray(group) || group.length <= 1) { - console.debug('Skipping inclusion group check, only one entry'); + console.debug('[WI] Skipping inclusion group check, only one entry'); continue; } // Check for group prio const prios = group.filter(x => x.groupOverride).sort(sortFn); if (prios.length) { - console.debug(`Activated inclusion group '${key}' with by prio winner entry '${prios[0].uid}'`, prios[0]); + console.debug(`[WI] Entry ${prios[0].uid}`, `activated as prio winner from inclusion group '${key}'`, prios[0]); removeAllBut(group, prios[0]); continue; } @@ -4063,14 +4165,14 @@ function filterByInclusionGroups(newEntries, allActivatedEntries, buffer, scanSt currentWeight += (entry.groupWeight ?? DEFAULT_WEIGHT); if (rollValue <= currentWeight) { - console.debug(`Activated inclusion group '${key}' with roll winner entry '${entry.uid}'`, entry); + console.debug(`[WI] Entry ${entry.uid}`, `activated as roll winner from inclusion group '${key}'`, entry); winner = entry; break; } } if (!winner) { - console.debug(`Failed to activate inclusion group '${key}', no winner found`); + console.debug(`[WI] Failed to activate inclusion group '${key}', no winner found`); continue; } @@ -4401,8 +4503,9 @@ function onWorldInfoChange(args, text) { $('#world_info').val(null).trigger('change'); } } else { //if it's a pointer selection - let tempWorldInfo = []; - let selectedWorlds = $('#world_info').val().map((e) => Number(e)).filter((e) => !isNaN(e)); + const tempWorldInfo = []; + const val = $('#world_info').val(); + const selectedWorlds = (Array.isArray(val) ? val : [val]).map((e) => Number(e)).filter((e) => !isNaN(e)); if (selectedWorlds.length > 0) { selectedWorlds.forEach((worldIndex) => { const existingWorldName = world_names[worldIndex]; diff --git a/public/style.css b/public/style.css index 6c71ee09e..95a61cdae 100644 --- a/public/style.css +++ b/public/style.css @@ -3910,6 +3910,8 @@ input[type="range"]::-webkit-slider-thumb { outline: none; background-color: var(--black50a); line-height: calc(var(--mainFontSize) + .25rem); + max-height: 75vh; + max-height: 75dvh; } #anchor_order {