@efengx/openclaw-channel-dragon 0.1.48 → 0.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +20 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -42,7 +42,26 @@ async function ensureConnection(account, runtimeLogger) {
|
|
|
42
42
|
}
|
|
43
43
|
// Instructions from Dragon Client UI
|
|
44
44
|
if (t === "hot_control") {
|
|
45
|
-
|
|
45
|
+
const { command, payload } = msg;
|
|
46
|
+
runtimeLogger?.info?.(`dragon channel: received hot control: ${command}`);
|
|
47
|
+
if (command === "switch_model" && payload && cachedRuntime) {
|
|
48
|
+
try {
|
|
49
|
+
// Use the standard OpenClaw runtime config API to set the primary model
|
|
50
|
+
// The payload should be the model ID (e.g., "google/gemini-2.0-flash")
|
|
51
|
+
cachedRuntime.config.set("agents.defaults.model.primary", payload);
|
|
52
|
+
runtimeLogger?.info?.(`[Dragon] Successfully switched primary model to: ${payload}`);
|
|
53
|
+
// Confirm back to UI
|
|
54
|
+
client.sendJson({
|
|
55
|
+
type: "hot_control_res",
|
|
56
|
+
command: "switch_model",
|
|
57
|
+
status: "ok",
|
|
58
|
+
currentModel: payload
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
runtimeLogger?.error?.(`[Dragon] Failed to switch model: ${e.message}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
46
65
|
}
|
|
47
66
|
},
|
|
48
67
|
});
|