feat(android-llmservice): unload-model button (❌) next to the model name#323
Merged
Merged
Conversation
Adds a way to free the model from memory without leaving the chat: a ❌ button to the right of the model name (shown only when a model is loaded). ChatViewModel.unloadModel() cancels any generation, closes the native model (frees RAM, off the main thread), deletes the copied working model file (storage + privacy), and returns to the 'no model loaded' state. The chat history is kept (still saveable/copyable) so nothing is lost; a new model can be picked to continue. Docs synced: requirements.md R3.8 + R10.1, CLAUDE.md android bullet. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HTS5FpMtBLJENTGoRUrp5m
|
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.



Summary
Adds a way to unload the model / free it from memory while staying in the chat — a ❌ button to the right of the model name (row 1 of the app bar), shown only when a model is loaded.
ChatViewModel.unloadModel():current-model.gguf— frees storage, nothing lingers),The chat history is kept (still saveable / copyable), so nothing is lost — you can load another model to continue, or Clear (🗑) to start fresh. A model loaded by absolute path (test / session restore) has no working copy, so the delete is a no-op there.
Docs synced per the
requirements.mdrule: R3.8 (unload) + R10.1 (top-bar row now includes the ❌), CLAUDE.md android bullet.Test plan
unloadModelmirrors the existing off-main-thread native-close pattern; no new importsmodelState == READY; test tagunloadButtonbuild-android-llmservicecompiles (the split from ci(android-llmservice): always produce the APK — split the emulator test into its own optional job #322 makes the APK build independent of the emulator test)Related issues / PRs
Follow-up to the
android-llmserviceapp. Best merged after #322 (the build/test split) so the APK artifact is produced regardless of the emulator test.Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01HTS5FpMtBLJENTGoRUrp5m
Generated by Claude Code