foliko 1.0.47 → 1.0.48
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/package.json +1 -1
- package/plugins/web-plugin.js +11 -1
package/package.json
CHANGED
package/plugins/web-plugin.js
CHANGED
|
@@ -39,6 +39,12 @@ class WebPlugin extends Plugin {
|
|
|
39
39
|
install(framework) {
|
|
40
40
|
this._framework = framework
|
|
41
41
|
this._registerTools()
|
|
42
|
+
|
|
43
|
+
// 将 WEB_BASE_URL 注入到 framework 的元数据,供所有 agent 使用
|
|
44
|
+
if (this._baseUrl && framework._mainAgent) {
|
|
45
|
+
framework._mainAgent.setMetadata('WEB_BASE_URL', this._baseUrl)
|
|
46
|
+
}
|
|
47
|
+
|
|
42
48
|
return this
|
|
43
49
|
}
|
|
44
50
|
|
|
@@ -48,6 +54,10 @@ class WebPlugin extends Plugin {
|
|
|
48
54
|
|
|
49
55
|
reload(framework) {
|
|
50
56
|
this._framework = framework
|
|
57
|
+
// 重新注入 WEB_BASE_URL
|
|
58
|
+
if (this._baseUrl && framework._mainAgent) {
|
|
59
|
+
framework._mainAgent.setMetadata('WEB_BASE_URL', this._baseUrl)
|
|
60
|
+
}
|
|
51
61
|
}
|
|
52
62
|
|
|
53
63
|
uninstall() {
|
|
@@ -354,7 +364,7 @@ class WebPlugin extends Plugin {
|
|
|
354
364
|
}
|
|
355
365
|
|
|
356
366
|
console.log(`[Web] Route registered: ${method} ${path}`)
|
|
357
|
-
return { success: true, message: `Route ${method} ${path} registered`, route: { method, path, description } }
|
|
367
|
+
return { success: true, message: `Route ${method} ${path} registered`, url: this._getUrl(path), route: { method, path, description } }
|
|
358
368
|
}
|
|
359
369
|
|
|
360
370
|
async _registerWebhook(prompt, awaitResponse = false) {
|