reneco-advanced-input-module 0.0.12 → 0.0.14

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 (40) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/voice-input-module.cjs.entry.js +41 -16
  3. package/dist/cjs/voice-input-module.cjs.entry.js.map +1 -1
  4. package/dist/cjs/voice-input-module.cjs.js +1 -1
  5. package/dist/cjs/voice-input-module.entry.cjs.js.map +1 -1
  6. package/dist/collection/components/voice-input-module/voice-input-module.js +46 -6
  7. package/dist/collection/components/voice-input-module/voice-input-module.js.map +1 -1
  8. package/dist/collection/services/llm.service.js +32 -8
  9. package/dist/collection/services/llm.service.js.map +1 -1
  10. package/dist/collection/services/speech-to-text.service.js +2 -2
  11. package/dist/collection/services/speech-to-text.service.js.map +1 -1
  12. package/dist/collection/types/service-providers.types.js.map +1 -1
  13. package/dist/collection/utils/schema-converter.js +1 -0
  14. package/dist/collection/utils/schema-converter.js.map +1 -1
  15. package/dist/components/voice-input-module.js +43 -16
  16. package/dist/components/voice-input-module.js.map +1 -1
  17. package/dist/esm/loader.js +1 -1
  18. package/dist/esm/voice-input-module.entry.js +41 -16
  19. package/dist/esm/voice-input-module.entry.js.map +1 -1
  20. package/dist/esm/voice-input-module.js +1 -1
  21. package/dist/types/components/voice-input-module/voice-input-module.d.ts +2 -0
  22. package/dist/types/components.d.ts +16 -0
  23. package/dist/types/services/speech-to-text.service.d.ts +1 -0
  24. package/dist/types/types/service-providers.types.d.ts +1 -0
  25. package/dist/voice-input-module/p-31382def.entry.js +3 -0
  26. package/dist/voice-input-module/p-31382def.entry.js.map +1 -0
  27. package/dist/voice-input-module/voice-input-module.entry.esm.js.map +1 -1
  28. package/dist/voice-input-module/voice-input-module.esm.js +1 -1
  29. package/package.json +1 -1
  30. package/www/build/p-31382def.entry.js +3 -0
  31. package/www/build/p-31382def.entry.js.map +1 -0
  32. package/www/build/p-ddbc8089.js +2 -0
  33. package/www/build/voice-input-module.entry.esm.js.map +1 -1
  34. package/www/build/voice-input-module.esm.js +1 -1
  35. package/www/index.html +4 -1
  36. package/dist/voice-input-module/p-da21f9a4.entry.js +0 -3
  37. package/dist/voice-input-module/p-da21f9a4.entry.js.map +0 -1
  38. package/www/build/p-0c467c9a.js +0 -2
  39. package/www/build/p-da21f9a4.entry.js +0 -3
  40. package/www/build/p-da21f9a4.entry.js.map +0 -1
@@ -6,7 +6,7 @@ var appGlobals = require('./app-globals-V2Kpy_OQ.js');
6
6
  const defineCustomElements = async (win, options) => {
7
7
  if (typeof window === 'undefined') return undefined;
8
8
  await appGlobals.globalScripts();
9
- return index.bootstrapLazy([["ocr-file-uploader.cjs",[[257,"ocr-file-uploader",{"batch":[4],"callback":[16],"jsonSchema":[1,"json-schema"],"theme":[1],"parsedTheme":[32]},null,{"theme":["parseTheme"]}]]],["voice-input-module.cjs",[[257,"voice-input-module",{"formJson":[1,"form-json"],"serviceConfig":[1,"service-config"],"apiKey":[1,"api-key"],"apiProxyUrl":[1,"api-proxy-url"],"context":[1],"classificationRootUrl":[1,"classification-root-url"],"language":[1],"inputTypes":[1,"input-types"],"theme":[1],"debug":[4],"renderForm":[4,"render-form"],"displayStatus":[4,"display-status"],"isRecording":[32],"isProcessing":[32],"statusMessage":[32],"hasError":[32],"transcription":[32],"filledData":[32],"debugInfo":[32],"isReadonlyMode":[32],"convertXmlToJson":[64],"convertJsonToXml":[64],"convertXmlToJsonLegacy":[64],"convertJsonToXmlLegacy":[64]},null,{"formJson":["initializeServices"],"serviceConfig":["initializeServices"],"theme":["initializeServices"]}]]]], options);
9
+ return index.bootstrapLazy([["ocr-file-uploader.cjs",[[257,"ocr-file-uploader",{"batch":[4],"callback":[16],"jsonSchema":[1,"json-schema"],"theme":[1],"parsedTheme":[32]},null,{"theme":["parseTheme"]}]]],["voice-input-module.cjs",[[257,"voice-input-module",{"formJson":[1,"form-json"],"serviceConfig":[1,"service-config"],"apiKey":[1,"api-key"],"apiProxyUrl":[1,"api-proxy-url"],"transcriptionModel":[1,"transcription-model"],"completionModel":[1,"completion-model"],"context":[1],"classificationRootUrl":[1,"classification-root-url"],"language":[1],"inputTypes":[1,"input-types"],"theme":[1],"debug":[4],"renderForm":[4,"render-form"],"displayStatus":[4,"display-status"],"isRecording":[32],"isProcessing":[32],"statusMessage":[32],"hasError":[32],"transcription":[32],"filledData":[32],"debugInfo":[32],"isReadonlyMode":[32],"convertXmlToJson":[64],"convertJsonToXml":[64],"convertXmlToJsonLegacy":[64],"convertJsonToXmlLegacy":[64]},null,{"formJson":["initializeServices"],"serviceConfig":["initializeServices"],"theme":["initializeServices"]}]]]], options);
10
10
  };
11
11
 
12
12
  exports.setNonce = index.setNonce;
@@ -72,6 +72,7 @@ class WhisperSpeechToTextService {
72
72
  constructor(config) {
73
73
  this.useProxy = (config === null || config === void 0 ? void 0 : config.useProxy) || false;
74
74
  this.proxyUrl = (config === null || config === void 0 ? void 0 : config.proxyUrl) || 'http://localhost:8492';
75
+ this.model = (config === null || config === void 0 ? void 0 : config.model) || 'gpt-4o-transcribe';
75
76
  if (this.useProxy) {
76
77
  // Mode proxy: pas besoin d'API key
77
78
  this.apiKey = '';
@@ -99,8 +100,7 @@ class WhisperSpeechToTextService {
99
100
  try {
100
101
  const formData = new FormData();
101
102
  formData.append('file', audioContent);
102
- formData.append('model', 'gpt-4o-transcribe');
103
- // formData.append('model', 'whisper-1');
103
+ formData.append('model', this.model);
104
104
  formData.append('language', lang);
105
105
  formData.append('response_format', 'json');
106
106
  formData.append('max_output_tokens', '2000');
@@ -318,22 +318,40 @@ class OpenAILLMService {
318
318
  return window[name] || undefined;
319
319
  }
320
320
  getOptimizeFieldsDescription(schema) {
321
- return Object.values(schema).map((field) => {
322
- var _a;
323
- let description = `- ${(_a = field.name) !== null && _a !== void 0 ? _a : field.title} ` +
321
+ if (Array.isArray(schema)) {
322
+ return schema.map((field) => {
323
+ let description = `- ${field.name || field.title} ` +
324
+ `(${field.type}` +
325
+ `${field.required ? ', required' : ''}` +
326
+ `${field.readonly ? ', readonly' : ''}` +
327
+ `${field.min && field.min !== "" ? ', min=' + field.min : ''}` +
328
+ `${field.max && field.max !== "" ? ', max=' + field.max : ''}`;
329
+ if (field.options && field.options.length > 0) {
330
+ if (field.options.length < 50) {
331
+ description += `) - options: ${field.options.join(', ')}`;
332
+ }
333
+ else {
334
+ description += `, many options: ${field.options.length} total) - extract raw value, will be matched locally`;
335
+ }
336
+ }
337
+ else {
338
+ description += ')';
339
+ }
340
+ return description;
341
+ }).join('\n');
342
+ }
343
+ return Object.entries(schema).map(([fieldName, field]) => {
344
+ let description = `- ${field.title || fieldName} ` +
324
345
  `(${field.type}` +
325
346
  `${field.required ? ', required' : ''}` +
326
347
  `${field.readonly ? ', readonly' : ''}` +
327
348
  `${field.min && field.min !== "" ? ', min=' + field.min : ''}` +
328
349
  `${field.max && field.max !== "" ? ', max=' + field.max : ''}`;
329
- // Handle options based on count
330
350
  if (field.options && field.options.length > 0) {
331
351
  if (field.options.length < 50) {
332
- // Send all options if less than 50
333
352
  description += `) - options: ${field.options.join(', ')}`;
334
353
  }
335
354
  else {
336
- // Don't send options if 50 or more, just indicate there are many
337
355
  description += `, many options: ${field.options.length} total) - extract raw value, will be matched locally`;
338
356
  }
339
357
  }
@@ -471,7 +489,10 @@ class OpenAILLMService {
471
489
  6. For select fields, use exact option values from the provided choices
472
490
  7. Only include fields where relevant information is found
473
491
  8. The current GMT datetime is ${new Date().toGMTString()}
474
- 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
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
+ 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). If the user repeats values for the same field name, fill all occurrences in order. If there is ANY doubt about which occurrence to fill, leave ALL of them empty to avoid errors
495
+ 12. Use readonly fields as contextual hints to understand form structure and field grouping, but never fill them
475
496
 
476
497
  Respond with JSON in this exact format: {"fields": [{"name": "field_name", "value": "extracted_value"}]}`;
477
498
  let userPrompt = `
@@ -539,7 +560,10 @@ class OpenAILLMService {
539
560
  7. Leave fields empty if no relevant information is found
540
561
  8. Return the same schema structure with 'default' values filled
541
562
  9. The current GMT datetime is ${new Date().toGMTString()}
542
- 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
563
+ 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
564
+ 11. IMPORTANT: Fields marked as "readonly" are presentation elements (headers, labels) that provide context but MUST NOT receive values
565
+ 12. IMPORTANT: Some field names may appear multiple times in the form (e.g., in different sub-sections marked by readonly headers). If the user repeats values for the same field name, fill all occurrences in order. If there is ANY doubt about which occurrence to fill, leave ALL of them empty to avoid errors
566
+ 13. Use readonly fields as contextual hints to understand form structure and field grouping, but never fill them
543
567
 
544
568
  Respond with JSON in this exact format: {"schema": {...}}`;
545
569
  let userPrompt = `
@@ -1031,6 +1055,7 @@ class SchemaConverter {
1031
1055
  case 'checkbox':
1032
1056
  return 'boolean';
1033
1057
  case 'realpicker':
1058
+ case 'numberpicker':
1034
1059
  return 'number';
1035
1060
  default:
1036
1061
  return 'string';
@@ -4128,6 +4153,8 @@ const VoiceFormRecorder = class {
4128
4153
  this.formJson = '{}';
4129
4154
  this.serviceConfig = '{}';
4130
4155
  this.apiProxyUrl = 'http://localhost:8492';
4156
+ this.transcriptionModel = 'gpt-4o-transcribe';
4157
+ this.completionModel = 'gpt-5-mini';
4131
4158
  this.context = undefined;
4132
4159
  this.classificationRootUrl = 'http://localhost';
4133
4160
  this.language = 'en';
@@ -4181,11 +4208,11 @@ const VoiceFormRecorder = class {
4181
4208
  this.parsedConfig = JSON.parse(this.serviceConfig || '{}');
4182
4209
  // Add API key to config if provided via prop
4183
4210
  if (this.apiKey) {
4184
- this.parsedConfig = Object.assign(Object.assign({}, this.parsedConfig), { speechToText: Object.assign(Object.assign({}, this.parsedConfig.speechToText), { apiKey: this.apiKey }), llm: Object.assign(Object.assign({}, this.parsedConfig.llm), { apiKey: this.apiKey }) });
4211
+ this.parsedConfig = Object.assign(Object.assign({}, this.parsedConfig), { speechToText: Object.assign(Object.assign({}, this.parsedConfig.speechToText), { apiKey: this.apiKey, model: this.transcriptionModel }), llm: Object.assign(Object.assign({}, this.parsedConfig.llm), { apiKey: this.apiKey, model: this.completionModel }) });
4185
4212
  }
4186
4213
  else {
4187
4214
  // Use proxy API if no API key provided
4188
- this.parsedConfig = Object.assign(Object.assign({}, this.parsedConfig), { speechToText: Object.assign(Object.assign({}, this.parsedConfig.speechToText), { useProxy: true, proxyUrl: this.apiProxyUrl }), llm: Object.assign(Object.assign({}, this.parsedConfig.llm), { useProxy: true, proxyUrl: this.apiProxyUrl }) });
4215
+ this.parsedConfig = Object.assign(Object.assign({}, this.parsedConfig), { speechToText: Object.assign(Object.assign({}, this.parsedConfig.speechToText), { useProxy: true, proxyUrl: this.apiProxyUrl, model: this.transcriptionModel }), llm: Object.assign(Object.assign({}, this.parsedConfig.llm), { useProxy: true, proxyUrl: this.apiProxyUrl, model: this.completionModel }) });
4189
4216
  }
4190
4217
  // Initialize services
4191
4218
  this.speechToTextService = SpeechToTextServiceFactory.create(this.parsedConfig);
@@ -4519,13 +4546,11 @@ const VoiceFormRecorder = class {
4519
4546
  };
4520
4547
  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;
4521
4548
  Object.entries(finalSchema).forEach(([fieldName, field]) => {
4522
- if (field.type === 'header')
4523
- return;
4524
4549
  trimmedSchema.schema[fieldName] = {
4525
4550
  type: field.type,
4526
4551
  title: field.title,
4527
4552
  options: field.options,
4528
- readonly: field.Enabled === false,
4553
+ readonly: field.type === 'header' || field.Enabled === false,
4529
4554
  default: field.DefaultValue,
4530
4555
  pattern: field.Mask,
4531
4556
  min: field.ValidationMin,
@@ -4855,7 +4880,7 @@ const VoiceFormRecorder = class {
4855
4880
  render() {
4856
4881
  const containerStyle = this.getContainerStyle();
4857
4882
  const statusStyle = this.getStatusStyle();
4858
- return (index.h("div", { key: 'd30cc9c267afa2890f2df40c1a892ce1b63b1e11' }, index.h("div", { key: '190d7a363097928283f901554c97275ad68f9f78', class: "voice-recorder-container" + (this.debug || this.renderForm ? "-debug" : ""), style: containerStyle }, index.h("div", { key: 'be008f255d80a8d434c02330dbf5a1c0fe3280fd', 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() : "")));
4883
+ 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() : "")));
4859
4884
  }
4860
4885
  static get watchers() { return {
4861
4886
  "formJson": ["initializeServices"],