reneco-advanced-input-module 0.0.16 → 0.0.18

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.
Files changed (28) hide show
  1. package/dist/cjs/voice-input-module.cjs.entry.js +20 -17
  2. package/dist/cjs/voice-input-module.cjs.entry.js.map +1 -1
  3. package/dist/cjs/voice-input-module.entry.cjs.js.map +1 -1
  4. package/dist/collection/components/voice-input-module/voice-input-module.js +14 -12
  5. package/dist/collection/components/voice-input-module/voice-input-module.js.map +1 -1
  6. package/dist/collection/services/llm.service.js +6 -5
  7. package/dist/collection/services/llm.service.js.map +1 -1
  8. package/dist/collection/types/form-schema.types.js.map +1 -1
  9. package/dist/components/voice-input-module.js +20 -17
  10. package/dist/components/voice-input-module.js.map +1 -1
  11. package/dist/esm/voice-input-module.entry.js +20 -17
  12. package/dist/esm/voice-input-module.entry.js.map +1 -1
  13. package/dist/types/types/form-schema.types.d.ts +1 -0
  14. package/dist/voice-input-module/p-a6250bd5.entry.js +3 -0
  15. package/dist/voice-input-module/p-a6250bd5.entry.js.map +1 -0
  16. package/dist/voice-input-module/voice-input-module.entry.esm.js.map +1 -1
  17. package/dist/voice-input-module/voice-input-module.esm.js +1 -1
  18. package/package.json +1 -1
  19. package/www/build/{p-d3887227.js → p-61b611f7.js} +1 -1
  20. package/www/build/p-a6250bd5.entry.js +3 -0
  21. package/www/build/p-a6250bd5.entry.js.map +1 -0
  22. package/www/build/voice-input-module.entry.esm.js.map +1 -1
  23. package/www/build/voice-input-module.esm.js +1 -1
  24. package/www/index.html +1 -1
  25. package/dist/voice-input-module/p-835b3b72.entry.js +0 -3
  26. package/dist/voice-input-module/p-835b3b72.entry.js.map +0 -1
  27. package/www/build/p-835b3b72.entry.js +0 -3
  28. package/www/build/p-835b3b72.entry.js.map +0 -1
@@ -320,7 +320,7 @@ class OpenAILLMService {
320
320
  getOptimizeFieldsDescription(schema) {
321
321
  if (Array.isArray(schema)) {
322
322
  return schema.map((field) => {
323
- let description = `- ${field.name || field.title} ` +
323
+ let description = `- ID:${field.id || field.name} | ${field.name || field.title} ` +
324
324
  `(${field.type}` +
325
325
  `${field.required ? ', required' : ''}` +
326
326
  `${field.readonly ? ', readonly' : ''}` +
@@ -341,7 +341,7 @@ class OpenAILLMService {
341
341
  }).join('\n');
342
342
  }
343
343
  return Object.entries(schema).map(([fieldName, field]) => {
344
- let description = `- ${field.title || fieldName} ` +
344
+ let description = `- ID:${field.id || fieldName} | ${field.title || fieldName} ` +
345
345
  `(${field.type}` +
346
346
  `${field.required ? ', required' : ''}` +
347
347
  `${field.readonly ? ', readonly' : ''}` +
@@ -491,11 +491,12 @@ class OpenAILLMService {
491
491
  8. The current GMT datetime is ${new Date().toGMTString()}
492
492
  9. Respect the constraints written between parenthesis for readonly status (readonly fields MUST NOT be filled with values), min and max values, whatever the transcription says
493
493
  10. IMPORTANT: Fields marked as "readonly" are presentation elements (headers, labels) that provide context but MUST NOT receive values
494
- 11. IMPORTANT: Some field names may appear multiple times in the form (e.g., in different sub-sections marked by readonly headers). Pay close attention to the user's spoken context to determine which occurrence they are referring to. Only fill the specific occurrence mentioned by the user. If there is ANY doubt about which occurrence to fill, leave ALL of them empty to avoid errors
494
+ 11. IMPORTANT: Some field names may appear multiple times in the form (e.g., in different sub-sections marked by readonly headers). ALWAYS prioritize the user's explicit instructions about which section/occurrence to fill. Only use sequential order as a fallback if the user provides no context. If there is ANY doubt, leave ALL occurrences empty to avoid errors
495
495
  12. Use readonly fields as contextual hints to understand form structure and field grouping, but never fill them
496
496
  13. CRITICAL: For select fields, options like "No", "Non", "Non applicable", "Inconnu", "Unknown", "N/A" are VALID VALUES that can be selected. When the user says these words, treat them as legitimate option choices, NOT always as negations or refusals to answer
497
+ 14. CRITICAL: Each field has a unique ID shown as "ID:xxx" at the start of its description. You MUST include this exact ID in your response for each field you fill
497
498
 
498
- Respond with JSON in this exact format: {"fields": [{"name": "field_name", "value": "extracted_value"}]}`;
499
+ Respond with JSON in this exact format: {"fields": [{"id": "field_id", "name": "field_name", "value": "extracted_value"}]}`;
499
500
  let userPrompt = `
500
501
  Voice transcription: "${data}"
501
502
 
@@ -563,7 +564,7 @@ class OpenAILLMService {
563
564
  9. The current GMT datetime is ${new Date().toGMTString()}
564
565
  10. Respect the constraints written between parenthesis for readonly status (readonly fields MUST NOT be filled with values), min and max values, whatever the transcription says
565
566
  11. IMPORTANT: Fields marked as "readonly" are presentation elements (headers, labels) that provide context but MUST NOT receive values
566
- 12. IMPORTANT: Some field names may appear multiple times in the form (e.g., in different sub-sections marked by readonly headers). Pay close attention to the user's spoken context to determine which occurrence they are referring to. Only fill the specific occurrence mentioned by the user. If there is ANY doubt about which occurrence to fill, leave ALL of them empty to avoid errors
567
+ 12. IMPORTANT: Some field names may appear multiple times in the form (e.g., in different sub-sections marked by readonly headers). ALWAYS prioritize the user's explicit instructions about which section/occurrence to fill. Only use sequential order as a fallback if the user provides no context. If there is ANY doubt, leave ALL occurrences empty to avoid errors
567
568
  13. Use readonly fields as contextual hints to understand form structure and field grouping, but never fill them
568
569
  14. CRITICAL: For select fields, options like "No", "Non", "Non applicable", "Inconnu", "Unknown", "N/A" are VALID VALUES that can be selected. When the user says these words, treat them as legitimate option choices, NOT always as negations or refusals to answer
569
570
 
@@ -4437,23 +4438,24 @@ const VoiceFormRecorder = class {
4437
4438
  case "track":
4438
4439
  default:
4439
4440
  if (filledData === null || filledData === void 0 ? void 0 : filledData.fields) {
4440
- const nameOccurrences = {};
4441
4441
  Object.entries(filledData.fields).forEach(([fieldID, field]) => {
4442
4442
  if (field.value !== undefined && field.value !== null && field.value !== '') {
4443
- const fieldName = field.name;
4444
- if (!nameOccurrences[fieldName])
4445
- nameOccurrences[fieldName] = 0;
4446
- let matchCount = 0;
4447
- for (const key in updatedSchema.fields) {
4448
- const schemaField = updatedSchema.fields[key];
4449
- if (schemaField.title === fieldName) {
4450
- if (matchCount === nameOccurrences[fieldName]) {
4443
+ if (field.id) {
4444
+ const schemaField = updatedSchema.fields[field.id];
4445
+ if (schemaField) {
4446
+ schemaField.value = field.value;
4447
+ schemaField.default = field.value;
4448
+ }
4449
+ }
4450
+ else {
4451
+ const fieldName = field.name;
4452
+ for (const key in updatedSchema.fields) {
4453
+ const schemaField = updatedSchema.fields[key];
4454
+ if (schemaField.title === fieldName) {
4451
4455
  schemaField.value = field.value;
4452
4456
  schemaField.default = field.value;
4453
- nameOccurrences[fieldName]++;
4454
4457
  break;
4455
4458
  }
4456
- matchCount++;
4457
4459
  }
4458
4460
  }
4459
4461
  }
@@ -4549,6 +4551,7 @@ const VoiceFormRecorder = class {
4549
4551
  const finalSchema = (_b = schema === null || schema === void 0 ? void 0 : schema.schema) !== null && _b !== void 0 ? _b : schema === null || schema === void 0 ? void 0 : schema.fields;
4550
4552
  Object.entries(finalSchema).forEach(([fieldName, field]) => {
4551
4553
  trimmedSchema.schema[fieldName] = {
4554
+ id: fieldName,
4552
4555
  type: field.type,
4553
4556
  title: field.title,
4554
4557
  options: field.options,
@@ -4882,7 +4885,7 @@ const VoiceFormRecorder = class {
4882
4885
  render() {
4883
4886
  const containerStyle = this.getContainerStyle();
4884
4887
  const statusStyle = this.getStatusStyle();
4885
- return (index.h("div", { key: '9d578386f031ab6b00ed00d38b84d0fe189f927c' }, index.h("div", { key: '32dd396366e5e119b8d50a4716e22d7669cf4bce', class: "voice-recorder-container" + (this.debug || this.renderForm ? "-debug" : ""), style: containerStyle }, index.h("div", { key: '5138b6625c881242a97063f39b2be88d88af43fd', class: "row-audio-area" }, this.renderRecordButton(), this.renderUploadRecordButton(), this.renderUploadButton()), this.displayStatus ? index.h("div", { class: "status-text", style: statusStyle }, this.statusMessage) : "", this.renderForm ? this.renderFormPreview() : "", this.debug ? this.renderDebugPanel() : "")));
4888
+ return (index.h("div", { key: '4f71f7f6dc15cb9be9545060fe992b4076f592e6' }, index.h("div", { key: '84b0fbc8e896b2b695bf32cd937763621c7fa62a', class: "voice-recorder-container" + (this.debug || this.renderForm ? "-debug" : ""), style: containerStyle }, index.h("div", { key: 'd84473027ffd89b30ade93eaa9d8e69c532549a3', class: "row-audio-area" }, this.renderRecordButton(), this.renderUploadRecordButton(), this.renderUploadButton()), this.displayStatus ? index.h("div", { class: "status-text", style: statusStyle }, this.statusMessage) : "", this.renderForm ? this.renderFormPreview() : "", this.debug ? this.renderDebugPanel() : "")));
4886
4889
  }
4887
4890
  static get watchers() { return {
4888
4891
  "formJson": ["initializeServices"],