| 3308 | }); | 3314 | }); |
| 3309 | useGroupScoringSelect.val((entry.useGroupScoring === null || entry.useGroupScoring === undefined) ? 'null' : entry.useGroupScoring ? 'true' : 'false').trigger('input'); | 3315 | useGroupScoringSelect.val((entry.useGroupScoring === null || entry.useGroupScoring === undefined) ? 'null' : entry.useGroupScoring ? 'true' : 'false').trigger('input'); |
| 3310 | | 3316 | |
| | 3317 | function handleOptionalSelect(name) { |
| | 3318 | const key = originalWIDataKeyMap[name]; |
| | 3319 | const selectElem = template.find(`select[name="${name}"]`); |
| | 3320 | selectElem.data('uid', entry.uid); |
| | 3321 | selectElem.on('input', async function () { |
| | 3322 | const uid = $(this).data('uid'); |
| | 3323 | const value = $(this).val(); |
| | 3324 | |
| | 3325 | data.entries[uid][name] = value === 'null' ? null : value === 'true'; |
| | 3326 | setWIOriginalDataValue(data, uid, key, data.entries[uid][name]); |
| | 3327 | await saveWorldInfo(name, data); |
| | 3328 | }); |
| | 3329 | selectElem.val((entry[name] === null || entry[name] === undefined) ? 'null' : entry[name] ? 'true' : 'false').trigger('input'); |
| | 3330 | } |
| | 3331 | |
| | 3332 | handleOptionalSelect("matchPersonaDescription"); |
| | 3333 | handleOptionalSelect("matchCharacterDescription"); |
| | 3334 | handleOptionalSelect("matchCharacterPersonality"); |
| | 3335 | handleOptionalSelect("matchCharacterNote"); |
| | 3336 | handleOptionalSelect("matchScenario"); |
| | 3337 | handleOptionalSelect("matchCharacterMetadata"); |
| | 3338 | |
| 3311 | // automation id | 3339 | // automation id |
| 3312 | const automationIdInput = template.find('input[name="automationId"]'); | 3340 | const automationIdInput = template.find('input[name="automationId"]'); |
| 3313 | automationIdInput.data('uid', entry.uid); | 3341 | automationIdInput.data('uid', entry.uid); |