File size: 664 Bytes
df23150 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import { definePlugin, runWorker } from "@paperclipai/plugin-sdk";
import { FETCH_MODELS_ACTION } from "./constants.js";
import { fetchOpenAiModelCatalog } from "./lib/providers.js";
const plugin = definePlugin({
async setup(ctx) {
ctx.actions.register(FETCH_MODELS_ACTION, async (params) => {
const baseUrl = String(params.baseUrl ?? "");
const apiKey = String(params.apiKey ?? "");
return fetchOpenAiModelCatalog(ctx.http.fetch, { baseUrl, apiKey });
});
},
async onHealth() {
return { status: "ok", message: "Global OpenAI Provider worker is running" };
},
});
export default plugin;
runWorker(plugin, import.meta.url);
|