Skip to content

ui: Notebook Page - #19339

Draft
leszekhanusz wants to merge 73 commits into
ggml-org:masterfrom
leszekhanusz:notebook
Draft

leszekhanusz wants to merge 73 commits into
ggml-org:masterfrom
leszekhanusz:notebook

Conversation

@leszekhanusz

@leszekhanusz leszekhanusz commented Feb 4, 2026 •

Copy link
Copy Markdown

Close #23450

This PR adds a Notebook page to the llama.cpp webui which allows raw text generation instead of using the chat API.
It is useful for story generation and for debugging purposes.
Only a single notebook is available, it is not saved for now in localstorage.

Features:

  • allow to continue/abort generation of text in a separate notebook page
  • implementation of /completion api and /tokenize api calls
  • rudimentary undo/redo support which allows to undo only the last generation to quickly try something else
  • Ctrl-z, Ctrl-y, Shift-Enter keyboard shortcuts for quick generation/undo
  • auto-scroll during generation if enabled in settings
  • show generation statistics but also total context tokens if enabled in settings
  • Prevent browser to close the page directly if the notebook is not empty to avoid data loss
  • reusing the existing components to allow to change the selected model in router mode or show the current model settings if not
  • reusing the error dialog to show connection errors

This PR has been tested:

  • on desktop and on mobile
  • on dark and light themes
  • using router mode or not

Disclaimer:

  • the initial scaffolding, the new API calls, the auto-scroll has been generated using Gemini Pro with antigravity, but it has been verified, tested, corrected, heavily edited and directed by hand during the process to force it to reuse existing components instead of reinventing the wheel and I understand the generated code. I've read the Contributing guidelines and as an open-source maintainer I understand wanting to avoid a flood of AI-generated problematic code but I can assure you this is not a low-effort PR.

Remaining issues to discuss/plan:

  • renaming some components could be done now that they are used outside of the Chat context:
    • DialogChatSettings -> DialogSettings
    • DialogChatError -> DialogError
    • ChatMessageStatistics -> GenerationStatistics
      It has not been done here to not complicate further the code.
  • Also those two dialogs are duplicated in the Notebook page and the Chat page and they should be put on a single place to reduce the html size, maybe this should be better in a separate PR (better management of dialogs)
  • Adding Notebook to the Storybook and the webui/README.md and various diagrams
  • Currently using the tokenize method to get the total number of tokens, even if the display of stats is disabled. The display of total tokens could be put activated/deactivated a new parameter in the settings.
    ̶ T̶h̶e̶ ̶C̶o̶m̶p̶l̶e̶t̶i̶o̶n̶S̶e̶r̶v̶i̶c̶e̶ ̶a̶l̶l̶o̶w̶s̶ ̶b̶o̶t̶h̶ ̶s̶t̶r̶e̶a̶m̶ ̶a̶n̶d̶ ̶n̶o̶n̶-̶s̶t̶r̶e̶a̶m̶ ̶c̶a̶l̶l̶s̶,̶ ̶a̶s̶ ̶i̶t̶ ̶i̶s̶ ̶m̶o̶d̶e̶l̶e̶d̶ ̶a̶f̶t̶e̶r̶ ̶t̶h̶e̶ ̶C̶h̶a̶t̶S̶e̶r̶v̶i̶c̶e̶ ̶w̶h̶i̶c̶h̶ ̶d̶o̶e̶s̶ ̶t̶h̶e̶ ̶s̶a̶m̶e̶ ̶t̶h̶i̶n̶g̶.̶ ̶A̶s̶ ̶w̶e̶ ̶a̶r̶e̶ ̶u̶s̶i̶n̶g̶ ̶i̶t̶ ̶o̶n̶l̶y̶ ̶w̶i̶t̶h̶ ̶s̶t̶r̶e̶a̶m̶:̶t̶r̶u̶e̶ ̶w̶e̶ ̶c̶o̶u̶l̶d̶ ̶r̶e̶m̶o̶v̶e̶ ̶t̶h̶e̶ ̶n̶o̶n̶-̶s̶t̶r̶e̶a̶m̶ ̶h̶a̶n̶d̶l̶i̶n̶g̶?̶ REMOVED
  • We should add a truncate option in the settings which will only send the latest tokens to be able to continue past the maximum tokens of the model

I'll work on those remaining issues if there is interest in merging this PR.

Screenshots:

Peek.2026-02-04.18-37.webm

@ddh0

ddh0 commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

Cool idea! I'd love to have something like this.

@leszekhanusz

Copy link
Copy Markdown
Author

Note: I let Claude and Gemini deal with the complicated merge after moving from tools/server/webui to tools/ui and other master changes.

@allozaur

Copy link
Copy Markdown
Contributor

Hey @leszekhanusz can you please create a Feature issue for this feature? :) It's possible that it might hav some parent/sibling issues and one or more PRs related to it and I'm currently triaging and cleaning up some of the PM stuff in the project this week.

I'd appreciate any help with this :)

@leszekhanusz leszekhanusz mentioned this pull request May 20, 2026
4 tasks done
@leszekhanusz

Copy link
Copy Markdown
Author

Hey @leszekhanusz can you please create a Feature issue for this feature? :) It's possible that it might hav some parent/sibling issues and one or more PRs related to it and I'm currently triaging and cleaning up some of the PM stuff in the project this week.

Sure! I made the issue #23450

@allozaur allozaur changed the title Notebook page on webui ui: Notebook Page May 20, 2026
@leszekhanusz
leszekhanusz marked this pull request as draft August 16, 2026 00:59
@leszekhanusz

Copy link
Copy Markdown
Author

Disclaimer: I don't really want to spend too much time on this PR which requests me to always merge all the breaking changes. So all the commits today since the merge (including the merge) were made by AI, probably wrong, and I've not verified them seriously so I've switch this PR to draft mode again.

It now includes the same contextGauge widget as the chat pages.

If there is still interest to merge this PR, please tell me when you're ready to do it quick and I'll take a day to verify and clean everything. If not, please just close it.

@allozaur

Copy link
Copy Markdown
Contributor

hey, @leszekhanusz don't worry about that I can always fix/refactor the code and push directly here. We still have a few high prio features & updates to be implemented in llama-ui, but please rest assured that i have this PR on my roadmap.

leszekhanusz and others added 2 commits October 19, 2026 10:33
Port notebook changes onto master's refactored UI stores:
- chat processing state (predictedMs, public parseTimingData) now in
  stores/chat/processing.svelte.ts
- modelsStore.contextSize moved to stores/models/index.svelte.ts
- contextStatsStore notebookMode ported to stores/chat/context-stats
- notebook uses ModelsSelector instead of the internal dropdown shell

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Apply eslint --fix and prettier for the stricter rules brought in by
master (member/key ordering, import sorting, statement padding).

Seed ChatMessageStatistics activeView from the initialView prop again,
which had become unused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Notebook page on llama-ui

4 participants