Skip to content

feat(hub): enable Run/New Chat for downloaded GGUF models, fix README - #6152

Merged
shimmyshimmer merged 4 commits into
unslothai:mainfrom
Sneakr:feat/gguf-run-readme-scroll
Jun 10, 2026
Merged

shimmyshimmer merged 4 commits into
unslothai:mainfrom
Sneakr:feat/gguf-run-readme-scroll

Conversation

@Sneakr

@Sneakr Sneakr commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator
  • enable the Run / New Chat action for GGUF models that are already downloaded, across the download card, on-device card, and hub page
  • remove the extra bottom spacing under the model inspector README

… bottom spacing

- enable the Run / New Chat action for GGUF models that are already downloaded, across the download card, on-device card, and hub page
- remove the extra bottom spacing under the model inspector README

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request integrates the chat model runtime into the Hub models page, replacing previous stubs with actual implementations for selecting, loading, and ejecting models. It also introduces a new feature flag HUB_GGUF_RUN_ACTIONS_VISIBLE to selectively enable run actions for GGUF models. The review feedback highlights two issues: a potential runtime error in non-secure contexts due to the use of crypto.randomUUID, and a layout inconsistency where a divider's visibility is still gated by the old feature flag instead of the new runActionsVisible variable.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines 591 to 593
const handleUseInChat = useCallback(() => {
void navigate({ to: "/chat" });
void navigate({ to: "/chat", search: { new: crypto.randomUUID() } });
}, [navigate]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In non-secure contexts (such as accessing a self-hosted instance over HTTP), crypto.randomUUID is undefined, which will cause a runtime TypeError when clicking "Use in Chat". Adding a fallback ensures the application remains functional in all environments.

  const handleUseInChat = useCallback(() => {
    const uuid = typeof crypto !== "undefined" && crypto.randomUUID
      ? crypto.randomUUID()
      : Math.random().toString(36).substring(2, 15);
    void navigate({ to: "/chat", search: { new: uuid } });
  }, [navigate]);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crypto.randomUUID is polyfilled app-wide at startup in main.tsx for non-secure contexts, so this bare call is safe and matches the existing new-chat navigation in chat-page.tsx. No per-call fallback needed.

Comment on lines 450 to 453
className={cn(
"group/pair flex h-9 shrink-0 items-stretch gap-1.5",
!HUB_POST_DOWNLOAD_ACTIONS_VISIBLE && "hidden",
!runActionsVisible && "hidden",
)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The divider above this container (at line 443) is still gated by HUB_POST_DOWNLOAD_ACTIONS_VISIBLE. Since runActionsVisible can be true (for GGUF models) while HUB_POST_DOWNLOAD_ACTIONS_VISIBLE is false, the divider will be hidden even when the Run/Train buttons are visible, leading to a layout inconsistency. Consider updating the divider's visibility condition to use runActionsVisible as well.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

false flag

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a0a5464ec7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +200 to +204
if (
!isExternalModelId(store.params.checkpoint) &&
!modelIdsMatch(store.params.checkpoint, status.active_model)
) {
store.setCheckpoint(status.active_model, status.gguf_variant ?? null);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Refresh active GGUF variant when model IDs match

When Hub opens while the backend is already running the same GGUF repo but a different quantization (for example after another tab switched variants), this guard skips setCheckpoint, so activeGgufVariant stays stale even though status.gguf_variant is authoritative. The Hub cards then mark the wrong variant as Loaded/Chat and can navigate the user into chat believing a different quantization is active; include a GGUF variant mismatch in this condition before skipping the status update.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed d9da69e

@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

const isLoadingThisModel = useMemo(() => {
if (!loadingModel || !selectedModel) return false;
return modelIdsMatch(loadingModel.id, selectedModel.resource.runId);

P2 Badge Disable other Run buttons during a model load

When a GGUF load is already in progress for one model, selecting a different downloaded GGUF makes isLoadingThisModel false, so the newly exposed Run button remains enabled and calls selectModel again. useChatModelRuntime.selectModel only ignores duplicate loads for the same id, so this can start overlapping unload/load requests against the backend and leave the active checkpoint/progress state racing; the Hub should also pass a global loading/disabled state while loadingModel is non-null.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@Imagineer99

Copy link
Copy Markdown
Member

Tested loading models from the hub from on device and hub. Works as expected.
image
image

@shimmyshimmer
shimmyshimmer merged commit cae12b7 into unslothai:main Jun 10, 2026
26 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants