Fix QMD model prewarm activation
Use QMD's real update/embed/query commands instead of the nonexistent qmd pull path, and keep the activation script in nix/scripts instead of inline Nix. Tests: nix build .#checks.aarch64-darwin.config-validity .#checks.aarch64-darwin.qmd-runtime --no-link; nix eval .#checks.x86_64-linux.qmd-runtime.name; scripts/check-flake-lock-owners.sh; git diff --check
This commit is contained in:
parent
7f55c0bd7b
commit
3a0c35bf68
@ -726,7 +726,10 @@ Optional model prewarming is also declarative:
|
||||
programs.openclaw.qmd.prewarmModels.enable = true;
|
||||
```
|
||||
|
||||
That runs `qmd pull` during Home Manager activation and stores the default embedding, expansion, and reranking models in the user's QMD cache. Expect about 2.25GB of cache use.
|
||||
That runs a temporary QMD collection through `qmd update`, `qmd embed`, and
|
||||
`qmd query` during Home Manager activation, which warms the default embedding,
|
||||
expansion, and reranking models in the user's QMD cache. Expect about 2.25GB of
|
||||
cache use.
|
||||
|
||||
### What we manage vs what you manage
|
||||
|
||||
|
||||
@ -212,10 +212,13 @@ let
|
||||
qmdPrewarmCheck =
|
||||
builtins.deepSeq (requireNoAssertionFailures "qmd.prewarmModels" qmdPrewarmEval)
|
||||
(
|
||||
if lib.hasInfix "/bin/qmd pull" qmdPrewarmActivation then
|
||||
if
|
||||
lib.hasInfix "OPENCLAW_QMD_BIN=" qmdPrewarmActivation
|
||||
&& lib.hasInfix "openclaw-qmd-prewarm.sh" qmdPrewarmActivation
|
||||
then
|
||||
"ok"
|
||||
else
|
||||
throw "qmd.prewarmModels did not wire qmd pull activation."
|
||||
throw "qmd.prewarmModels did not wire QMD model-cache prewarm activation."
|
||||
);
|
||||
|
||||
checkKey = builtins.deepSeq [
|
||||
|
||||
@ -332,7 +332,8 @@ in
|
||||
XDG_CACHE_HOME=${lib.escapeShellArg "${homeDir}/.cache"} \
|
||||
XDG_CONFIG_HOME=${lib.escapeShellArg "${homeDir}/.config"} \
|
||||
XDG_DATA_HOME=${lib.escapeShellArg "${homeDir}/.local/share"} \
|
||||
${qmdPackage}/bin/qmd pull
|
||||
OPENCLAW_QMD_BIN=${lib.escapeShellArg "${qmdPackage}/bin/qmd"} \
|
||||
${pkgs.bash}/bin/bash ${../../../scripts/openclaw-qmd-prewarm.sh}
|
||||
''
|
||||
);
|
||||
|
||||
|
||||
22
nix/scripts/openclaw-qmd-prewarm.sh
Normal file
22
nix/scripts/openclaw-qmd-prewarm.sh
Normal file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
qmd="${OPENCLAW_QMD_BIN:?OPENCLAW_QMD_BIN is required}"
|
||||
tmp_dir="$(mktemp -d)"
|
||||
|
||||
cleanup() {
|
||||
rm -rf "$tmp_dir"
|
||||
"$qmd" collection remove openclaw-prewarm >/dev/null 2>&1 || true
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
printf "%s\n\n%s\n" \
|
||||
"# OpenClaw QMD prewarm" \
|
||||
"This temporary document warms QMD model caches." \
|
||||
> "$tmp_dir/prewarm.md"
|
||||
|
||||
"$qmd" collection remove openclaw-prewarm >/dev/null 2>&1 || true
|
||||
"$qmd" collection add "$tmp_dir" --name openclaw-prewarm >/dev/null
|
||||
"$qmd" update >/dev/null
|
||||
"$qmd" embed >/dev/null
|
||||
"$qmd" query "OpenClaw QMD prewarm" -n 1 --json >/dev/null
|
||||
Loading…
Reference in New Issue
Block a user