Add ollama-plagin-swap remote swap control plugin
This commit is contained in:
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
CONFIG_DIR="${HOME}/.config/ollama-plagin-swap"
|
||||
OPENCODE_PLUGIN_DIR="${HOME}/.config/opencode/plugins"
|
||||
CLIENT_CONFIG="${CONFIG_DIR}/clients.json"
|
||||
|
||||
mkdir -p "${CONFIG_DIR}" "${OPENCODE_PLUGIN_DIR}"
|
||||
install -m 0755 "${ROOT}/.opencode/plugins/ollama-swap.js" "${OPENCODE_PLUGIN_DIR}/ollama-swap.js"
|
||||
|
||||
if [ ! -f "${CLIENT_CONFIG}" ]; then
|
||||
cat > "${CLIENT_CONFIG}" <<'JSON'
|
||||
{
|
||||
"interval_seconds": 60,
|
||||
"controls": [
|
||||
{
|
||||
"name": "ollama-remote",
|
||||
"host": "10.8.0.62",
|
||||
"agent_url": "http://10.8.0.62:8731",
|
||||
"token": "replace-with-agent-token",
|
||||
"ollama_base_url": "http://10.8.0.62:11434"
|
||||
}
|
||||
]
|
||||
}
|
||||
JSON
|
||||
fi
|
||||
|
||||
echo "Installed OpenCode client plugin to ${OPENCODE_PLUGIN_DIR}/ollama-swap.js"
|
||||
echo "Edit agent endpoints and tokens in ${CLIENT_CONFIG}"
|
||||
Reference in New Issue
Block a user