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