feat(studio): appendToLastMessage + decode replacement escapes - #385
Merged
danvitv merged 3 commits intoSep 3, 2026
Merged
Conversation
Adds the classic PresetBlock.appendToLastMessage behaviour to StudioPresetBlock so dynamic context (memory, lorebooks, ledger) can be merged into the last user-role history message instead of emitted as a separate turn, keeping the volatile tail off the KV-cached prefix.
This was referenced Sep 4, 2026
hydall
added a commit
that referenced
this pull request
Sep 4, 2026
#387) `prompt_build_architecture_test.dart` forbids the literal string `prompt_builder.dart` in the six Studio request-assembly files, so the ordinary prompt path cannot creep back into them. Two comments in `StudioMessageBuilder` named the file — no import, no `PromptPayload` / `PromptResult` use, only the wording — and had been failing that test on `nightly` since #385, reddening CI for every PR opened against it. - reword the `appendToLastMessage` comments in `lib/core/llm/studio_message_builder.dart` to point at "the ordinary prompt builder" instead of naming the file The test's contract is untouched and no behaviour changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Studio: append-to-last-user-message
The classic (non-Studio)
PresetBlock.appendToLastMessagelets a block's macro-expanded content be merged into the last user turn instead of being emitted as its own message. This ports that to Studio presets:appendToLastMessagetoStudioPresetBlock._blockinStudioPresetCodec).StudioMessageBuilder, collect instruction blocks flaggedappendToLastMessage, skip them as standalone messages, and merge their expanded content into the last user-role history message inemitHistory(mirrors the classicapplyAppendToLastMessage).switchfield ("Append to last user message") in the inline Studio block editor, shown for instruction blocks.Regex: decode
\u/\nescapes in Replace WithThe
Replace Withreplacement string was applied literally:\uXXXXand\ntyped as text were not decoded (unlike SillyTavern). Add_decodeReplacementEscapesinRegexService._applySingleScriptto decode\uXXXX,\u{XXXX},\n,\t,\r,\\, while leaving\0-\9intact so_resolveReplacementstill treats them as capture-group backreferences.Verification
dart run build_runner buildafter the freezed/json model change.dart analyzeclean.flutter testgreen forstudio_preset_codec_test.dart,append_to_last_message_test.dart,studio_typed_message_builder_test.dart(33 tests).test/webview_jsrender suite (no Node/Playwright in this session) - left to CI.