-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstart_foxforge_code.sh
More file actions
executable file
·55 lines (47 loc) · 1.19 KB
/
Copy pathstart_foxforge_code.sh
File metadata and controls
executable file
·55 lines (47 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT_DIR"
check_models() {
if ! command -v ollama >/dev/null 2>&1; then
echo "ollama not found in PATH"
return 1
fi
mapfile -t REQUIRED < <(python3 - <<'PY'
from configparser import ConfigParser
from pathlib import Path
cfg = ConfigParser()
cfg.optionxform = str
cfg.read(Path('config.ini'), encoding='utf-8')
if cfg.has_section('models'):
seen = set()
for _, value in cfg.items('models'):
model = str(value).strip()
if model and model not in seen:
seen.add(model)
print(model)
PY
)
mapfile -t LOCAL < <(ollama list 2>/dev/null | awk 'NR>1 {print $1}')
missing=0
for model in "${REQUIRED[@]}"; do
if printf '%s\n' "${LOCAL[@]}" | grep -Fxq "$model"; then
echo "ok: $model"
else
echo "missing: $model"
missing=$((missing+1))
fi
done
if [[ $missing -gt 0 ]]; then
echo "Model preflight failed: $missing missing model(s)."
return 1
fi
echo "Model preflight passed."
return 0
}
if [[ "${1:-}" == "--check" ]]; then
check_models
exit $?
fi
check_models || true
exec python3 -m SourceCode.tui.app