@peopl-health/nexus 3.8.21 → 3.8.22
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.
|
@@ -103,7 +103,10 @@ async function composePrompt({ presetId = null, promptId = null, variables = nul
|
|
|
103
103
|
const promptRecordId = preset.prompt?.[0];
|
|
104
104
|
if (promptRecordId) {
|
|
105
105
|
const promptRecords = await getRecordByFilter(Config_ID, 'responses', `RECORD_ID()="${promptRecordId}"`);
|
|
106
|
-
|
|
106
|
+
const presetPromptId = promptRecords?.[0]?.prompt_id;
|
|
107
|
+
if (presetPromptId) {
|
|
108
|
+
resolvedPromptId = presetPromptId;
|
|
109
|
+
}
|
|
107
110
|
}
|
|
108
111
|
} else {
|
|
109
112
|
logger.error('[promptComposer] Preset not found in Airtable', { presetId });
|
|
@@ -112,6 +115,18 @@ async function composePrompt({ presetId = null, promptId = null, variables = nul
|
|
|
112
115
|
|
|
113
116
|
const baseRecord = await fetchBasePrompt(resolvedPromptId);
|
|
114
117
|
|
|
118
|
+
// If no explicit preset was passed, check if the prompt defines one via preset_id field
|
|
119
|
+
if (!presetId && baseRecord?.preset_id) {
|
|
120
|
+
presetId = baseRecord.preset_id;
|
|
121
|
+
const preset = await fetchPreset(presetId);
|
|
122
|
+
if (preset) {
|
|
123
|
+
presetSnippetIds = preset.snippets || [];
|
|
124
|
+
presetToolIds = preset.tools || [];
|
|
125
|
+
} else {
|
|
126
|
+
logger.error('[promptComposer] Prompt-level preset not found in Airtable', { presetId, promptId: resolvedPromptId });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
115
130
|
if (!baseRecord) {
|
|
116
131
|
logger.error('[promptComposer] Base prompt not found in Airtable', { promptId: resolvedPromptId });
|
|
117
132
|
}
|