feat: migrate openai-video provider into tools plugin
This commit is contained in:
1 parent
42ef37f10a
commit
720f48844d
13 files changed
+1306
-38
No files matched your search
Vendored
+33
-14
@@ -1,17 +1,36 @@
|
||||
import { Type } from "typebox";
|
||||
import { defineToolPlugin } from "openclaw/plugin-sdk/tool-plugin";
|
||||
export default defineToolPlugin({
|
||||
import { jsonResult } from "openclaw/plugin-sdk/core";
|
||||
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
||||
import { toolPluginMetadataSymbol } from "openclaw/plugin-sdk/tool-plugin";
|
||||
import { echoTool } from "./tools/echo.js";
|
||||
import { buildOpenAIVideoGenerationProvider } from "./video/index.js";
|
||||
const entry = definePluginEntry({
|
||||
id: "tools",
|
||||
name: "Tools",
|
||||
description: "Add Tools tools to OpenClaw.",
|
||||
tools: (tool) => [
|
||||
tool({
|
||||
name: "echo",
|
||||
description: "Echo input text.",
|
||||
parameters: Type.Object({
|
||||
input: Type.String({ description: "Text to echo." }),
|
||||
}),
|
||||
execute: async ({ input }) => ({ input }),
|
||||
}),
|
||||
],
|
||||
description: "Custom Tools and Media Providers for OpenClaw.",
|
||||
register(api) {
|
||||
api.registerTool({
|
||||
name: echoTool.name,
|
||||
label: echoTool.label,
|
||||
description: echoTool.description,
|
||||
parameters: echoTool.parameters,
|
||||
execute: async (_toolCallId, params) => {
|
||||
const result = await echoTool.execute(params);
|
||||
return jsonResult(result);
|
||||
},
|
||||
});
|
||||
api.registerVideoGenerationProvider(buildOpenAIVideoGenerationProvider({
|
||||
isProviderApiKeyConfigured: api.runtime.modelAuth.isProviderApiKeyConfigured,
|
||||
getPluginConfig: () => api.pluginConfig,
|
||||
}));
|
||||
},
|
||||
});
|
||||
Object.defineProperty(entry, toolPluginMetadataSymbol, {
|
||||
value: {
|
||||
id: "tools",
|
||||
name: "Tools",
|
||||
description: "Custom Tools and Media Providers for OpenClaw.",
|
||||
tools: [echoTool],
|
||||
},
|
||||
enumerable: false,
|
||||
});
|
||||
export default entry;
|
||||
Reference in new issue
Block a user