update
This commit is contained in:
parent
90e7b5aecf
commit
f9f99639db
|
@ -7,7 +7,7 @@ import yaml from "js-yaml";
|
||||||
import { adapter } from "../utils";
|
import { adapter } from "../utils";
|
||||||
import { useAccessStore } from "./access";
|
import { useAccessStore } from "./access";
|
||||||
|
|
||||||
const isApp = getClientConfig()?.buildMode === "export";
|
const isApp = getClientConfig()?.isApp;
|
||||||
|
|
||||||
export type Plugin = {
|
export type Plugin = {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -231,7 +231,6 @@ export const usePluginStore = createPersistStore(
|
||||||
name: StoreKey.Plugin,
|
name: StoreKey.Plugin,
|
||||||
version: 1,
|
version: 1,
|
||||||
onRehydrateStorage(state) {
|
onRehydrateStorage(state) {
|
||||||
console.log("onRehydrateStorage", state);
|
|
||||||
// Skip store rehydration on server side
|
// Skip store rehydration on server side
|
||||||
if (typeof window === "undefined") {
|
if (typeof window === "undefined") {
|
||||||
return;
|
return;
|
||||||
|
@ -242,23 +241,29 @@ export const usePluginStore = createPersistStore(
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
Promise.all(
|
Promise.all(
|
||||||
res.map((item: any) =>
|
res.map((item: any) =>
|
||||||
fetch(item.schema)
|
// skip get schema
|
||||||
.then((res) => res.text())
|
state.get(item.id)
|
||||||
.then((content) => ({
|
? item
|
||||||
...item,
|
: fetch(item.schema)
|
||||||
content,
|
.then((res) => res.text())
|
||||||
})),
|
.then((content) => ({
|
||||||
|
...item,
|
||||||
|
content,
|
||||||
|
}))
|
||||||
|
.catch((e) => item),
|
||||||
),
|
),
|
||||||
).then((builtinPlugins: any) => {
|
).then((builtinPlugins: any) => {
|
||||||
builtinPlugins.forEach((item: any) => {
|
builtinPlugins
|
||||||
const plugin = state.create(item);
|
.filter((item: any) => item?.content)
|
||||||
state.updatePlugin(plugin.id, (plugin) => {
|
.forEach((item: any) => {
|
||||||
const tool = FunctionToolService.add(plugin, true);
|
const plugin = state.create(item);
|
||||||
plugin.title = tool.api.definition.info.title;
|
state.updatePlugin(plugin.id, (plugin) => {
|
||||||
plugin.version = tool.api.definition.info.version;
|
const tool = FunctionToolService.add(plugin, true);
|
||||||
plugin.builtin = true;
|
plugin.title = tool.api.definition.info.title;
|
||||||
|
plugin.version = tool.api.definition.info.version;
|
||||||
|
plugin.builtin = true;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue