(level)
| 8874 | deleted = true; |
| 8875 | CarrotDebug.ui(`[Move Collection] Deleted from chat library: ${chatId}`); |
| 8876 | break; |
| 8877 | } |
| 8878 | } |
| 8879 | break; |
| 8880 | case 'global': |
| 8881 | if (ragState.libraries.global && ragState.libraries.global[collectionId]) { |
| 8882 | delete ragState.libraries.global[collectionId]; |
| 8883 | deleted = true; |
| 8884 | CarrotDebug.ui('[Move Collection] Deleted from global library'); |
| 8885 | } |
| 8886 | break; |
| 8887 | } |
| 8888 | |
| 8889 | if (!deleted) { |
| 8890 | CarrotDebug.error('[Move Collection] Failed to delete from source - collection not found in actual source library'); |
| 8891 | } |
| 8892 | |
| 8893 | CarrotDebug.ui('[Move Collection] Deleted from source library'); |
| 8894 | |
| 8895 | saveSettingsDebounced(); |
| 8896 | |
| 8897 | const characterName = getCharacterNameFromCollectionId(collectionId); |
| 8898 | toastr.success(`Moved ${characterName} from ${currentViewerContext.toUpperCase()} to ${selectedContextLevel.toUpperCase()} storage`); |
| 8899 | |
| 8900 | CarrotDebug.ui('[Move Collection] Move complete, refreshing viewer'); |
| 8901 | $('#carrot-rag-refresh-viewer').click(); |
| 8902 | } catch (error) { |
| 8903 | CarrotDebug.error('[Move Collection] Error during move operation:', error); |
| 8904 | toastr.error(`Failed to move collection: ${error.message}`); |
| 8905 | } |
| 8906 | }); |
| 8907 | |
| 8908 | $(document).on('click', '.carrot-delete-collection-btn', async function() { |
| 8909 | const collectionId = $(this).data('collection'); |
no test coverage detected