[PR #1200] [MERGED] Harden SillyTavern bulk import #4975

Closed
opened 2026-10-22 04:12:09 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1200
Author: @TheLonelyDevil9
Created: 5/25/2026
Status: ✅ Merged
Merged: 5/25/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/st-bulk-import-hardening


📝 Commits (1)

  • a54fd42 Harden SillyTavern bulk import

📊 Changes

4 files changed (+440 additions, -72 deletions)

View changed files

📝 src-tauri/src/commands/storage/imports/bulk_imports.rs (+230 -64)
📝 src-tauri/src/commands/storage/imports/payloads.rs (+19 -0)
📝 src-tauri/src/commands/storage/imports/service.rs (+74 -8)
📝 src-tauri/src/commands/storage/media_uploads.rs (+117 -0)

📄 Description

What?

Harden SillyTavern bulk imports so stale selected items are reported as per-item warnings instead of aborting the whole run. The importer now also stores imported character/persona avatar images as managed local asset files instead of embedding large image data URLs into storage records.

Why?

Bulk imports from realistic SillyTavern folders can contain many characters, backgrounds, personas, and large PNG character cards. A single missing selected file should not fail the whole import, and large inline avatar payloads can bloat storage enough to make otherwise ordinary imports fragile.

How?

  • Added a selected-item resolver that converts stale or invalid selected IDs into errors entries and continues with the remaining import queue.
  • Reused the same per-item warning path across characters, lorebooks, presets, personas, backgrounds, chats, and group chats.
  • Added managed image persistence helpers for copying image files or decoded image bytes into app-owned avatar folders and returning Tauri asset URLs plus file metadata.
  • Added a path-aware character parse path for bulk PNG imports so character card avatars can be copied to managed storage rather than re-encoded into character records.
  • Updated persona avatar imports to store managed asset references and avoid duplicating image bytes into the avatar field.

Testing?

  • cargo test --manifest-path "src-tauri/Cargo.toml" run_st_bulk_import_continues_after_stale_selected_items
  • cargo test --manifest-path "src-tauri/Cargo.toml" file_path_asset_url_matches_tauri_encoding_on_windows
  • cargo check --manifest-path "src-tauri/Cargo.toml"

Screenshots (optional)

Not applicable; this is Rust storage/import behavior with no UI changes.

Anything Else?

A live UI import against a full external SillyTavern folder was not run in this PR. The regression fixture covers the reported shape: many selected characters/backgrounds/personas plus stale selected items and managed avatar storage.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/1200 **Author:** [@TheLonelyDevil9](https://github.com/TheLonelyDevil9) **Created:** 5/25/2026 **Status:** ✅ Merged **Merged:** 5/25/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/st-bulk-import-hardening` --- ### 📝 Commits (1) - [`a54fd42`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a54fd42d6c32401733101685863d0deaec2d51a1) Harden SillyTavern bulk import ### 📊 Changes **4 files changed** (+440 additions, -72 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/imports/bulk_imports.rs` (+230 -64) 📝 `src-tauri/src/commands/storage/imports/payloads.rs` (+19 -0) 📝 `src-tauri/src/commands/storage/imports/service.rs` (+74 -8) 📝 `src-tauri/src/commands/storage/media_uploads.rs` (+117 -0) </details> ### 📄 Description ## What? Harden SillyTavern bulk imports so stale selected items are reported as per-item warnings instead of aborting the whole run. The importer now also stores imported character/persona avatar images as managed local asset files instead of embedding large image data URLs into storage records. ## Why? Bulk imports from realistic SillyTavern folders can contain many characters, backgrounds, personas, and large PNG character cards. A single missing selected file should not fail the whole import, and large inline avatar payloads can bloat storage enough to make otherwise ordinary imports fragile. ## How? - Added a selected-item resolver that converts stale or invalid selected IDs into `errors` entries and continues with the remaining import queue. - Reused the same per-item warning path across characters, lorebooks, presets, personas, backgrounds, chats, and group chats. - Added managed image persistence helpers for copying image files or decoded image bytes into app-owned avatar folders and returning Tauri asset URLs plus file metadata. - Added a path-aware character parse path for bulk PNG imports so character card avatars can be copied to managed storage rather than re-encoded into character records. - Updated persona avatar imports to store managed asset references and avoid duplicating image bytes into the `avatar` field. ## Testing? - `cargo test --manifest-path "src-tauri/Cargo.toml" run_st_bulk_import_continues_after_stale_selected_items` - `cargo test --manifest-path "src-tauri/Cargo.toml" file_path_asset_url_matches_tauri_encoding_on_windows` - `cargo check --manifest-path "src-tauri/Cargo.toml"` ## Screenshots (optional) Not applicable; this is Rust storage/import behavior with no UI changes. ## Anything Else? A live UI import against a full external SillyTavern folder was not run in this PR. The regression fixture covers the reported shape: many selected characters/backgrounds/personas plus stale selected items and managed avatar storage. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:12:09 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4975
No description provided.