n8n-nodes-supermachine 1.2.7 → 1.2.8
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.
|
@@ -500,13 +500,30 @@ class Supermachine {
|
|
|
500
500
|
// ══════════════════════════════════════════════════════
|
|
501
501
|
else if (resource === 'character') {
|
|
502
502
|
if (operation === 'listCharacters') {
|
|
503
|
+
// Get required modelId from top-level field
|
|
504
|
+
const modelTitle = this.getNodeParameter('modelId', i);
|
|
505
|
+
// Get optional filters
|
|
503
506
|
const filters = this.getNodeParameter('filters', i, {});
|
|
504
507
|
const qs = {};
|
|
508
|
+
// Resolve required modelId
|
|
509
|
+
const modelsResponse = await this.helpers.requestWithAuthentication.call(this, 'supermachineApi', { method: 'GET', url: 'https://dev.supermachine.art/v1/models', json: true });
|
|
510
|
+
const models = modelsResponse.items;
|
|
511
|
+
const model = models.find((m) => m.title === modelTitle);
|
|
512
|
+
if (!model) {
|
|
513
|
+
throw new Error(`Model "${modelTitle}" not found`);
|
|
514
|
+
}
|
|
515
|
+
qs.modelId = model.id;
|
|
505
516
|
if (!this.getNodeParameter('returnAll', i, false)) {
|
|
506
|
-
|
|
517
|
+
if (!this.getNodeParameter('returnAll', i, false)) {
|
|
518
|
+
qs.limit = this.getNodeParameter('limit', i, 20);
|
|
519
|
+
qs.limit = this.getNodeParameter('limit', i, 20);
|
|
520
|
+
}
|
|
507
521
|
}
|
|
508
522
|
if (filters.categoryId) {
|
|
509
|
-
|
|
523
|
+
if (filters.categoryId) {
|
|
524
|
+
qs.categoryId = filters.categoryId;
|
|
525
|
+
qs.categoryId = filters.categoryId;
|
|
526
|
+
}
|
|
510
527
|
}
|
|
511
528
|
if (filters.modelId) {
|
|
512
529
|
const modelTitle = filters.modelId;
|
|
@@ -61,39 +61,39 @@ exports.getCharacterFields = [
|
|
|
61
61
|
default: 20,
|
|
62
62
|
description: 'Max number of results to return',
|
|
63
63
|
},
|
|
64
|
+
// Model Name - REQUIRED
|
|
64
65
|
{
|
|
65
|
-
displayName: '
|
|
66
|
-
name: '
|
|
67
|
-
type: '
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
displayName: 'Model Name or ID',
|
|
67
|
+
name: 'modelId',
|
|
68
|
+
type: 'options',
|
|
69
|
+
typeOptions: {
|
|
70
|
+
loadOptionsMethod: 'getModels',
|
|
71
|
+
},
|
|
70
72
|
displayOptions: {
|
|
71
73
|
show: {
|
|
72
74
|
resource: ['character'],
|
|
73
75
|
operation: ['listCharacters'],
|
|
74
76
|
},
|
|
75
77
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
loadOptionsMethod: 'getModels',
|
|
93
|
-
},
|
|
94
|
-
default: '',
|
|
95
|
-
description: 'Filter by compatible model. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
|
78
|
+
default: '',
|
|
79
|
+
required: true,
|
|
80
|
+
description: 'Select model to list characters for. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
|
81
|
+
},
|
|
82
|
+
// Category Name - OPTIONAL (always visible)
|
|
83
|
+
{
|
|
84
|
+
displayName: 'Category Name or ID',
|
|
85
|
+
name: 'categoryId',
|
|
86
|
+
type: 'options',
|
|
87
|
+
typeOptions: {
|
|
88
|
+
loadOptionsMethod: 'getCharacterCategories',
|
|
89
|
+
},
|
|
90
|
+
displayOptions: {
|
|
91
|
+
show: {
|
|
92
|
+
resource: ['character'],
|
|
93
|
+
operation: ['listCharacters'],
|
|
96
94
|
},
|
|
97
|
-
|
|
95
|
+
},
|
|
96
|
+
default: '',
|
|
97
|
+
description: 'Filter by character category (optional). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
|
98
98
|
},
|
|
99
99
|
];
|
package/package.json
CHANGED