Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(openclaw-plugin): preserve existing ov.conf on auto install (#1098)

Qin Haojie82aeb6c13742
diff --git a/examples/openclaw-plugin/install.sh b/examples/openclaw-plugin/install.sh
index b62887708..a77918869 100755
--- a/examples/openclaw-plugin/install.sh
+++ b/examples/openclaw-plugin/install.sh
@@ -1669,6 +1669,14 @@ configure_openviking_conf() {
local embedding_api_key="${OPENVIKING_EMBEDDING_API_KEY:-${OPENVIKING_ARK_API_KEY:-}}"
local conf_path="${OPENVIKING_DIR}/ov.conf"
+ if [[ "$INSTALL_YES" == "1" && -f "${conf_path}" ]]; then
+ SELECTED_SERVER_PORT="$(readPortFromOvConf "${conf_path}" || true)"
+ [[ -z "${SELECTED_SERVER_PORT}" ]] && SELECTED_SERVER_PORT="${DEFAULT_SERVER_PORT}"
+ SELECTED_CONFIG_PATH="${conf_path}"
+ info "$(tr "Preserved existing config: ${conf_path}" "已保留现有配置: ${conf_path}")"
+ return 0
+ fi
+
if [[ "$INSTALL_YES" != "1" ]]; then
echo ""
read -r -p "$(tr "OpenViking workspace path [${workspace}]: " "OpenViking 数据目录 [${workspace}]: ")" _workspace < /dev/tty || true
diff --git a/examples/openclaw-plugin/setup-helper/install.js b/examples/openclaw-plugin/setup-helper/install.js
index c53ebca80..a57692eb9 100755
--- a/examples/openclaw-plugin/setup-helper/install.js
+++ b/examples/openclaw-plugin/setup-helper/install.js
@@ -1106,6 +1106,18 @@ async function installOpenViking() {
async function configureOvConf() {
await mkdir(OPENVIKING_DIR, { recursive: true });
+ const configPath = join(OPENVIKING_DIR, "ov.conf");
+ if (installYes && existsSync(configPath)) {
+ selectedServerPort = await readPortFromOvConf(configPath) || DEFAULT_SERVER_PORT;
+ info(
+ tr(
+ `Preserved existing config: ${configPath}`,
+ `已保留现有配置: ${configPath}`,
+ ),
+ );
+ return;
+ }
+
let workspace = join(OPENVIKING_DIR, "data");
let serverPort = String(DEFAULT_SERVER_PORT);
let agfsPort = String(DEFAULT_AGFS_PORT);
@@ -1173,7 +1185,6 @@ async function configureOvConf() {
},
};
- const configPath = join(OPENVIKING_DIR, "ov.conf");
await writeFile(configPath, JSON.stringify(config, null, 2) + "\n", "utf8");
info(tr(`Config generated: ${configPath}`, `已生成配置: ${configPath}`));
}