@peopl-health/nexus 3.2.11 → 3.2.12

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.
@@ -16,7 +16,7 @@ const isThreadNotFoundError = (error) => {
16
16
  const recreateThread = async (thread, variant = 'assistants') => {
17
17
  const provider = createProvider({ variant });
18
18
  const newConversation = await provider.createConversation({
19
- metadata: { phoneNumber: thread.code, recreated: true }
19
+ metadata: { phoneNumber: thread.code }
20
20
  });
21
21
 
22
22
  await Thread.updateOne(
@@ -290,11 +290,13 @@ class OpenAIResponsesProvider {
290
290
  let totalRetries = 0;
291
291
  let allToolsExecuted = [];
292
292
 
293
- let input = context || this._convertItemsToApiFormat(additionalMessages);
294
- input = input.filter(item => item.type !== 'function_call' && item.type !== 'function_call_output');
295
- let devMessage = await getRecordByFilter(Config_ID, 'responses', `{prompt_id} = "${assistantId}"`);
296
- devMessage = devMessage?.[0]?.content || '';
297
- input = [{ role: 'developer', content: devMessage }, ...input];
293
+ const devRecord = await getRecordByFilter(Config_ID, 'responses', `{prompt_id} = "${assistantId}"`);
294
+ let devContent = devRecord?.[0]?.content || '';
295
+ if (promptVariables) devContent = devContent.replace(/\{\{(\w+)\}\}/g, (_, key) => promptVariables[key] ?? '');
296
+
297
+ const messages = (context || this._convertItemsToApiFormat(additionalMessages))
298
+ .filter(item => item.type !== 'function_call' && item.type !== 'function_call_output');
299
+ const input = [{ role: 'developer', content: devContent }, ...messages];
298
300
 
299
301
  const promptConfig = { id: assistantId };
300
302
  if (promptVariables) promptConfig.variables = promptVariables;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "3.2.11",
3
+ "version": "3.2.12",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",