Configure Pi models path for clawd
This commit is contained in:
+12
@@ -156,6 +156,7 @@ EOF
|
||||
configure_clawd_agent_type() {
|
||||
local config_dir="/etc/clawd"
|
||||
local env_file="$config_dir/env"
|
||||
local models_config="$TARGET_HOME/.pi/agent/models.json"
|
||||
|
||||
info "Configuring clawd AGENT_TYPE=cutos-agent ..."
|
||||
run_root mkdir -p "$config_dir"
|
||||
@@ -168,10 +169,19 @@ configure_clawd_agent_type() {
|
||||
else
|
||||
printf '\nAGENT_TYPE=cutos-agent\n' | run_root tee -a "$env_file" >/dev/null
|
||||
fi
|
||||
|
||||
if run_root grep -q '^[[:space:]]*PI_MODELS_CONFIG=' "$env_file"; then
|
||||
run_root sed -i "s|^[[:space:]]*PI_MODELS_CONFIG=.*|PI_MODELS_CONFIG=$models_config|" "$env_file"
|
||||
elif run_root grep -q '^[[:space:]]*# PI_MODELS_CONFIG=' "$env_file"; then
|
||||
run_root sed -i "s|^[[:space:]]*# PI_MODELS_CONFIG=.*|PI_MODELS_CONFIG=$models_config|" "$env_file"
|
||||
else
|
||||
printf 'PI_MODELS_CONFIG=%s\n' "$models_config" | run_root tee -a "$env_file" >/dev/null
|
||||
fi
|
||||
else
|
||||
run_root tee "$env_file" >/dev/null <<EOF
|
||||
# clawd environment (loaded by systemd EnvironmentFile)
|
||||
AGENT_TYPE=cutos-agent
|
||||
PI_MODELS_CONFIG=$models_config
|
||||
EOF
|
||||
fi
|
||||
|
||||
@@ -204,8 +214,10 @@ info "Pi working directory: $PI_HOME"
|
||||
configure_clawd_agent_type
|
||||
|
||||
run_root mkdir -p "$PI_HOME"
|
||||
run_root mkdir -p "$PI_HOME/agent"
|
||||
if [ "$TARGET_USER" != "root" ]; then
|
||||
run_root chown "$TARGET_USER:$TARGET_GROUP" "$PI_HOME"
|
||||
run_root chown "$TARGET_USER:$TARGET_GROUP" "$PI_HOME/agent"
|
||||
fi
|
||||
|
||||
npm_global_install @earendil-works/pi-coding-agent@latest --allow-scripts=@google/genai,protobufjs,sharp
|
||||
|
||||
Reference in New Issue
Block a user