feat: unify installation model catalog
This commit is contained in:
@@ -16,20 +16,22 @@ chmod 0600 "$auth_config/auth.yaml"
|
||||
secrets_file="$tmp/thothii.secrets"
|
||||
printf '%s\n' 'THT_MODEL_API_KEY=fixture-model-api-key' >"$secrets_file"
|
||||
chmod 0600 "$secrets_file"
|
||||
installation_file="$tmp/thothii-installation.yaml"
|
||||
printf '%s\n' 'schemaVersion: 2' >"$installation_file"
|
||||
chmod 0600 "$installation_file"
|
||||
|
||||
rendered=$(THT_WORKSPACE_GIT_REMOTE=https://git.example.invalid/platform/thoth-workspaces.git \
|
||||
PI_AUTH_FILE="$auth_file" THT_SECRETS_FILE="$secrets_file" \
|
||||
THT_AUTH_CONFIG_ROOT="$auth_config" docker compose config)
|
||||
THT_AUTH_CONFIG_ROOT="$auth_config" THT_INSTALLATION_CONFIG_SOURCE="$installation_file" \
|
||||
docker compose config)
|
||||
printf '%s\n' "$rendered" | grep -q "source: $auth_file"
|
||||
printf '%s\n' "$rendered" | grep -q 'target: /home/thoth/.pi/agent/auth.json'
|
||||
printf '%s\n' "$rendered" | grep -A4 'target: /home/thoth/.pi/agent/auth.json' \
|
||||
| grep -q 'read_only: true'
|
||||
for target in \
|
||||
/home/thoth/.pi/agent/models.json \
|
||||
/home/thoth/.pi/agent/settings.json; do
|
||||
printf '%s\n' "$rendered" | grep -q "target: $target"
|
||||
printf '%s\n' "$rendered" | grep -A4 "target: $target" | grep -q 'read_only: true'
|
||||
done
|
||||
if printf '%s\n' "$rendered" | grep -Eq '/home/thoth/\.pi/agent/(models|settings)\.json'; then
|
||||
echo "base Compose must not mount model projections without the generated override" >&2
|
||||
exit 1
|
||||
fi
|
||||
printf '%s\n' "$rendered" | grep -q "file: $secrets_file"
|
||||
printf '%s\n' "$rendered" | grep -q 'target: thothii.secrets'
|
||||
if grep -Fq 'fixture-model-api-key' <<<"$rendered"; then
|
||||
@@ -39,12 +41,14 @@ fi
|
||||
|
||||
dev_rendered=$(THT_WORKSPACE_GIT_REMOTE=https://git.example.invalid/platform/thoth-workspaces.git \
|
||||
PI_AUTH_FILE="$auth_file" THT_SECRETS_FILE="$secrets_file" \
|
||||
THT_AUTH_CONFIG_ROOT="$auth_config" \
|
||||
THT_AUTH_CONFIG_ROOT="$auth_config" THT_INSTALLATION_CONFIG_SOURCE="$installation_file" \
|
||||
docker compose --env-file deploy/env/local.env.example -f docker-compose.dev.yml config)
|
||||
printf '%s\n' "$dev_rendered" | grep -q "source: $auth_file"
|
||||
printf '%s\n' "$dev_rendered" | grep -q 'target: /home/thoth/.pi/agent/auth.json'
|
||||
printf '%s\n' "$dev_rendered" | grep -q 'target: /home/thoth/.pi/agent/models.json'
|
||||
printf '%s\n' "$dev_rendered" | grep -q 'target: /home/thoth/.pi/agent/settings.json'
|
||||
if printf '%s\n' "$dev_rendered" | grep -Eq '/home/thoth/\.pi/agent/(models|settings)\.json'; then
|
||||
echo "development Compose must not contain legacy model sources" >&2
|
||||
exit 1
|
||||
fi
|
||||
printf '%s\n' "$dev_rendered" | grep -q "file: $secrets_file"
|
||||
printf '%s\n' "$dev_rendered" | grep -q 'target: thothii.secrets'
|
||||
if grep -Fq 'fixture-model-api-key' <<<"$dev_rendered"; then
|
||||
@@ -52,27 +56,8 @@ if grep -Fq 'fixture-model-api-key' <<<"$dev_rendered"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
settings = json.loads(Path("deploy/pi/settings.json").read_text())
|
||||
assert settings["enabledModels"] == [
|
||||
"zai/glm-5.3",
|
||||
"deepseek/deepseek-v4-flash",
|
||||
"deepseek/deepseek-v4-pro",
|
||||
"local-qwen/qwen3.6-35b-a3b",
|
||||
]
|
||||
models = json.loads(Path("deploy/pi/models.json").read_text())
|
||||
qwen = models["providers"]["local-qwen"]
|
||||
assert qwen["api"] == "openai-completions"
|
||||
assert qwen["models"][0]["id"] == "qwen3.6-35b-a3b"
|
||||
assert qwen["models"][0]["compat"]["maxTokensField"] == "max_tokens"
|
||||
assert "aritmolab" not in models["providers"]
|
||||
PY
|
||||
|
||||
if grep -R -n 'registerProvider' harness/.pi/extensions; then
|
||||
echo "Pi model providers must be declared in deploy/pi/models.json, not in code" >&2
|
||||
echo "Pi model providers must be declared in the Installation Model Catalog, not in code" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user