Fix search of extension prompts by role

This commit is contained in:
Cohee 2024-03-24 03:12:30 +02:00
parent 5028ae49bd
commit be95162e64
2 changed files with 4 additions and 4 deletions

View File

@ -2491,8 +2491,8 @@ function getExtensionPrompt(position = extension_prompt_types.IN_PROMPT, depth =
.sort() .sort()
.map((x) => extension_prompts[x]) .map((x) => extension_prompts[x])
.filter(x => x.position == position && x.value) .filter(x => x.position == position && x.value)
.filter(x => x.depth === undefined || x.depth === depth) .filter(x => depth === undefined || x.depth === undefined || x.depth === depth)
.filter(x => x.role === undefined || x.role === role) .filter(x => role === undefined || x.role === undefined || x.role === role)
.map(x => x.value.trim()) .map(x => x.value.trim())
.join(separator); .join(separator);
if (extension_prompt.length && !extension_prompt.startsWith(separator)) { if (extension_prompt.length && !extension_prompt.startsWith(separator)) {

View File

@ -115,13 +115,13 @@ async function onExtensionFloatingDepthInput() {
} }
async function onExtensionFloatingPositionInput(e) { async function onExtensionFloatingPositionInput(e) {
chat_metadata[metadata_keys.position] = e.target.value; chat_metadata[metadata_keys.position] = Number(e.target.value);
updateSettings(); updateSettings();
saveMetadataDebounced(); saveMetadataDebounced();
} }
async function onDefaultPositionInput(e) { async function onDefaultPositionInput(e) {
extension_settings.note.defaultPosition = e.target.value; extension_settings.note.defaultPosition = Number(e.target.value);
saveSettingsDebounced(); saveSettingsDebounced();
} }