@workglow/ai 0.0.123 → 0.0.125
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/dist/browser.js +39 -2
- package/dist/browser.js.map +5 -5
- package/dist/bun.js +39 -2
- package/dist/bun.js.map +5 -5
- package/dist/node.js +39 -2
- package/dist/node.js.map +5 -5
- package/dist/provider/AiProvider.d.ts +4 -0
- package/dist/provider/AiProvider.d.ts.map +1 -1
- package/dist/provider/AiProviderRegistry.d.ts +11 -0
- package/dist/provider/AiProviderRegistry.d.ts.map +1 -1
- package/dist/task/ModelSearchTask.d.ts +4 -1
- package/dist/task/ModelSearchTask.d.ts.map +1 -1
- package/dist/worker.js +10 -1
- package/dist/worker.js.map +4 -4
- package/package.json +11 -11
package/dist/node.js
CHANGED
|
@@ -23,6 +23,15 @@ class AiProviderRegistry {
|
|
|
23
23
|
getProviders() {
|
|
24
24
|
return new Map(this.providers);
|
|
25
25
|
}
|
|
26
|
+
getInstalledProviderIds() {
|
|
27
|
+
return [...this.providers.keys()].sort();
|
|
28
|
+
}
|
|
29
|
+
getProviderIdsForTask(taskType) {
|
|
30
|
+
const taskMap = this.runFnRegistry.get(taskType);
|
|
31
|
+
if (!taskMap)
|
|
32
|
+
return [];
|
|
33
|
+
return [...taskMap.keys()].sort();
|
|
34
|
+
}
|
|
26
35
|
registerRunFn(modelProvider, taskType, runFn) {
|
|
27
36
|
if (!this.runFnRegistry.has(taskType)) {
|
|
28
37
|
this.runFnRegistry.set(taskType, new Map);
|
|
@@ -4481,7 +4490,7 @@ var ModelSearchInputSchema = {
|
|
|
4481
4490
|
provider: {
|
|
4482
4491
|
type: "string",
|
|
4483
4492
|
title: "Provider",
|
|
4484
|
-
description: "
|
|
4493
|
+
description: "Registered AI provider id to use for model search. At runtime the workflow UI lists only providers that support model search."
|
|
4485
4494
|
},
|
|
4486
4495
|
query: {
|
|
4487
4496
|
type: "string",
|
|
@@ -4492,6 +4501,30 @@ var ModelSearchInputSchema = {
|
|
|
4492
4501
|
required: ["provider", "query"],
|
|
4493
4502
|
additionalProperties: false
|
|
4494
4503
|
};
|
|
4504
|
+
function buildModelSearchInputSchemaDynamic() {
|
|
4505
|
+
const registry = getAiProviderRegistry();
|
|
4506
|
+
const ids = registry.getProviderIdsForTask("ModelSearchTask");
|
|
4507
|
+
const enumLabels = {};
|
|
4508
|
+
for (const id of ids) {
|
|
4509
|
+
enumLabels[id] = registry.getProvider(id)?.displayName ?? id;
|
|
4510
|
+
}
|
|
4511
|
+
const providerProp = {
|
|
4512
|
+
...ModelSearchInputSchema.properties.provider
|
|
4513
|
+
};
|
|
4514
|
+
if (ids.length > 0) {
|
|
4515
|
+
providerProp.enum = ids;
|
|
4516
|
+
providerProp["x-ui-enum-labels"] = enumLabels;
|
|
4517
|
+
}
|
|
4518
|
+
return {
|
|
4519
|
+
type: "object",
|
|
4520
|
+
properties: {
|
|
4521
|
+
provider: providerProp,
|
|
4522
|
+
query: ModelSearchInputSchema.properties.query
|
|
4523
|
+
},
|
|
4524
|
+
required: [...ModelSearchInputSchema.required],
|
|
4525
|
+
additionalProperties: ModelSearchInputSchema.additionalProperties
|
|
4526
|
+
};
|
|
4527
|
+
}
|
|
4495
4528
|
var ModelSearchOutputSchema = {
|
|
4496
4529
|
type: "object",
|
|
4497
4530
|
properties: {
|
|
@@ -4521,12 +4554,16 @@ class ModelSearchTask extends Task11 {
|
|
|
4521
4554
|
static title = "Model Search";
|
|
4522
4555
|
static description = "Search for models using provider-specific search functions";
|
|
4523
4556
|
static cacheable = false;
|
|
4557
|
+
static hasDynamicSchemas = true;
|
|
4524
4558
|
static inputSchema() {
|
|
4525
4559
|
return ModelSearchInputSchema;
|
|
4526
4560
|
}
|
|
4527
4561
|
static outputSchema() {
|
|
4528
4562
|
return ModelSearchOutputSchema;
|
|
4529
4563
|
}
|
|
4564
|
+
inputSchema() {
|
|
4565
|
+
return buildModelSearchInputSchemaDynamic();
|
|
4566
|
+
}
|
|
4530
4567
|
async execute(input, context) {
|
|
4531
4568
|
const registry = getAiProviderRegistry();
|
|
4532
4569
|
const noop = () => {};
|
|
@@ -7208,4 +7245,4 @@ export {
|
|
|
7208
7245
|
AgentInputSchema
|
|
7209
7246
|
};
|
|
7210
7247
|
|
|
7211
|
-
//# debugId=
|
|
7248
|
+
//# debugId=D07E930D64256EAD64756E2164756E21
|