mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-05-01 05:00:34 +00:00
generic markdown modal and plugins wiring
This commit is contained in:
parent
8639069104
commit
59ed70d8c1
6 changed files with 138 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ import { createStore } from "/js/AlpineStore.js";
|
|||
import * as api from "/js/api.js";
|
||||
import "/components/plugins/plugin-settings-store.js";
|
||||
import "/components/plugins/toggle/plugin-toggle-store.js";
|
||||
import "/components/modals/markdown/markdown-store.js";
|
||||
import {
|
||||
store as notificationStore,
|
||||
defaultPriority,
|
||||
|
|
@ -126,6 +127,23 @@ const model = {
|
|||
}
|
||||
},
|
||||
|
||||
async openPluginDoc(plugin, doc) {
|
||||
try {
|
||||
const response = await api.callJsonApi("plugins", {
|
||||
action: "get_doc",
|
||||
plugin_name: plugin.name,
|
||||
doc,
|
||||
});
|
||||
if (response?.error) throw new Error(response.error);
|
||||
const markdownModal = Alpine.store("markdownModal");
|
||||
if (!markdownModal) throw new Error("Markdown modal store unavailable.");
|
||||
markdownModal.open(response.filename, response.content);
|
||||
window.openModal?.("components/modals/markdown/markdown-modal.html");
|
||||
} catch (e) {
|
||||
showErrorNotification(e, "Failed to open document");
|
||||
}
|
||||
},
|
||||
|
||||
openPluginInfo(plugin) {
|
||||
if (!plugin) return;
|
||||
this.selectedPlugin = plugin;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue