feat: apply VPS provider to OpenClaw on status_update (fetch models, merge config)
- Add openclaw-provider: fetch /v1/models, merge provider/auth, remove by name - Wire client _applyStatus: inactive removes provider; active applies full provider then origin - Single-flight _busy to ignore concurrent apply/remove; isFullProvider uses base-url key Made-with: Cursor
This commit is contained in:
@@ -12,6 +12,7 @@ const { getDashboardInfo, resolveOpenclawConfigFile, startTtyd, FrpcManager } =
|
||||
const { ProvisionManager } = require('./provisioning');
|
||||
const { BtMonitor } = require('./bt-monitor');
|
||||
const { hasInternet, hasWiredInternetProbe, getLocalIps } = require('./network');
|
||||
const { applyFullProviderFromVps, removeProviderByName, isFullProvider } = require('./openclaw-provider');
|
||||
const led = require('./led');
|
||||
|
||||
const MAX_BACKOFF_MS = 60_000;
|
||||
@@ -408,6 +409,9 @@ class ClawClient {
|
||||
|
||||
_applyStatus(msg) {
|
||||
if (msg.status === 'inactive') {
|
||||
if (msg.provider && msg.provider.name) {
|
||||
removeProviderByName(String(msg.provider.name));
|
||||
}
|
||||
this._cfg.activated = false;
|
||||
config.save(this._cfg);
|
||||
led.status.setSetup();
|
||||
@@ -429,7 +433,14 @@ class ClawClient {
|
||||
led.status.setApps();
|
||||
led.display.showTime();
|
||||
log.info('clawd', `已激活 claw_id = ${this._cfg.claw_id}`);
|
||||
this._updateOpenClawOrigin(String(this._cfg.claw_id));
|
||||
const clawIdStr = String(this._cfg.claw_id);
|
||||
if (isFullProvider(msg.provider)) {
|
||||
applyFullProviderFromVps(msg.provider, () => {
|
||||
this._updateOpenClawOrigin(clawIdStr);
|
||||
});
|
||||
} else {
|
||||
this._updateOpenClawOrigin(clawIdStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user