Use Fuse only as fallback
| @@ -123,6 +123,9 @@ function selectSystemPromptCallback(args, name) { | ||
| 123 | 123 | |
| 124 | 124 | const quiet = isTrueBoolean(args?.quiet); |
| 125 | 125 | const instructNames = system_prompts.map(preset => preset.name); |
| 126 | + let foundName = instructNames.find(x => x.toLowerCase() === name.toLowerCase()); | |
| 127 | + | |
| 128 | + if (!foundName) { | |
| 126 | 129 | const fuse = new Fuse(instructNames); |
| 127 | 130 | const result = fuse.search(name); |
| 128 | 131 | |
| @@ -131,7 +134,9 @@ function selectSystemPromptCallback(args, name) { | ||
| 131 | 134 | return ''; |
| 132 | 135 | } |
| 133 | 136 | |
| 134 | 137 | const foundName = result[0].item; |
| 138 | + } | |
| 139 | + | |
| 135 | 140 | $select.val(foundName).trigger('input'); |
| 136 | 141 | !quiet && toastr.success(`System prompt "${foundName}" selected`); |
| 137 | 142 | return foundName; |