Sanitize completion names. Only send names in msg texts if names in completion is disabled

This commit is contained in:
Cohee
2023-08-03 22:47:04 +03:00
committed by maver
parent 5f43121e15
commit 29552ecfcf
2 changed files with 11 additions and 6 deletions

View File

@ -938,6 +938,10 @@ PromptManagerModule.prototype.isValidName = function(name) {
return regex.test(name);
}
PromptManagerModule.prototype.sanitizeName = function(name) {
return name.replace(/[^a-zA-Z0-9_]/g, '_').substring(0, 64);
}
/**
* Loads a given prompt into the edit form fields.
* @param {Object} prompt - Prompt object with properties 'name', 'role', 'content', and 'system_prompt'