reneco-advanced-input-module 0.0.1-beta.1

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 (108) hide show
  1. package/.editorconfig +15 -0
  2. package/.prettierrc.json +13 -0
  3. package/LICENSE +21 -0
  4. package/api-key-inject.js +46 -0
  5. package/dist/cjs/app-globals-V2Kpy_OQ.js +8 -0
  6. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
  7. package/dist/cjs/index-BTSzTkSZ.js +1494 -0
  8. package/dist/cjs/index-BTSzTkSZ.js.map +1 -0
  9. package/dist/cjs/index.cjs.js +5 -0
  10. package/dist/cjs/index.cjs.js.map +1 -0
  11. package/dist/cjs/loader.cjs.js +16 -0
  12. package/dist/cjs/loader.cjs.js.map +1 -0
  13. package/dist/cjs/ocr-file-uploader.voice-input-module.entry.cjs.js.map +1 -0
  14. package/dist/cjs/ocr-file-uploader_2.cjs.entry.js +1340 -0
  15. package/dist/cjs/ocr-file-uploader_2.cjs.entry.js.map +1 -0
  16. package/dist/cjs/voice-input-module.cjs.js +28 -0
  17. package/dist/cjs/voice-input-module.cjs.js.map +1 -0
  18. package/dist/collection/collection-manifest.json +13 -0
  19. package/dist/collection/components/ocr-file-uploader/ocr-file-uploader.css +26 -0
  20. package/dist/collection/components/ocr-file-uploader/ocr-file-uploader.js +130 -0
  21. package/dist/collection/components/ocr-file-uploader/ocr-file-uploader.js.map +1 -0
  22. package/dist/collection/components/voice-input-module/voice-input-module.css +286 -0
  23. package/dist/collection/components/voice-input-module/voice-input-module.js +897 -0
  24. package/dist/collection/components/voice-input-module/voice-input-module.js.map +1 -0
  25. package/dist/collection/index.js +12 -0
  26. package/dist/collection/index.js.map +1 -0
  27. package/dist/collection/services/audio-recorder.service.js +66 -0
  28. package/dist/collection/services/audio-recorder.service.js.map +1 -0
  29. package/dist/collection/services/llm.service.js +193 -0
  30. package/dist/collection/services/llm.service.js.map +1 -0
  31. package/dist/collection/services/speech-to-text.service.js +60 -0
  32. package/dist/collection/services/speech-to-text.service.js.map +1 -0
  33. package/dist/collection/types/form-schema.types.js +2 -0
  34. package/dist/collection/types/form-schema.types.js.map +1 -0
  35. package/dist/collection/types/service-providers.types.js +2 -0
  36. package/dist/collection/types/service-providers.types.js.map +1 -0
  37. package/dist/collection/utils/schema-converter.js +422 -0
  38. package/dist/collection/utils/schema-converter.js.map +1 -0
  39. package/dist/components/index.d.ts +33 -0
  40. package/dist/components/index.js +4 -0
  41. package/dist/components/index.js.map +1 -0
  42. package/dist/components/ocr-file-uploader.d.ts +11 -0
  43. package/dist/components/ocr-file-uploader.js +9 -0
  44. package/dist/components/ocr-file-uploader.js.map +1 -0
  45. package/dist/components/ocr-file-uploader2.js +98 -0
  46. package/dist/components/ocr-file-uploader2.js.map +1 -0
  47. package/dist/components/voice-input-module.d.ts +11 -0
  48. package/dist/components/voice-input-module.js +1313 -0
  49. package/dist/components/voice-input-module.js.map +1 -0
  50. package/dist/esm/app-globals-DQuL1Twl.js +6 -0
  51. package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
  52. package/dist/esm/index-jmc2yzBp.js +1487 -0
  53. package/dist/esm/index-jmc2yzBp.js.map +1 -0
  54. package/dist/esm/index.js +4 -0
  55. package/dist/esm/index.js.map +1 -0
  56. package/dist/esm/loader.js +14 -0
  57. package/dist/esm/loader.js.map +1 -0
  58. package/dist/esm/ocr-file-uploader.voice-input-module.entry.js.map +1 -0
  59. package/dist/esm/ocr-file-uploader_2.entry.js +1337 -0
  60. package/dist/esm/ocr-file-uploader_2.entry.js.map +1 -0
  61. package/dist/esm/voice-input-module.js +24 -0
  62. package/dist/esm/voice-input-module.js.map +1 -0
  63. package/dist/index.cjs.js +1 -0
  64. package/dist/index.js +1 -0
  65. package/dist/types/components/ocr-file-uploader/ocr-file-uploader.d.ts +8 -0
  66. package/dist/types/components/voice-input-module/voice-input-module.d.ts +60 -0
  67. package/dist/types/components.d.ts +158 -0
  68. package/dist/types/index.d.ts +9 -0
  69. package/dist/types/services/audio-recorder.service.d.ts +9 -0
  70. package/dist/types/services/llm.service.d.ts +15 -0
  71. package/dist/types/services/speech-to-text.service.d.ts +11 -0
  72. package/dist/types/stencil-public-runtime.d.ts +1709 -0
  73. package/dist/types/types/form-schema.types.d.ts +70 -0
  74. package/dist/types/types/service-providers.types.d.ts +20 -0
  75. package/dist/types/utils/schema-converter.d.ts +22 -0
  76. package/dist/voice-input-module/index.esm.js +2 -0
  77. package/dist/voice-input-module/index.esm.js.map +1 -0
  78. package/dist/voice-input-module/loader.esm.js.map +1 -0
  79. package/dist/voice-input-module/ocr-file-uploader.voice-input-module.entry.esm.js.map +1 -0
  80. package/dist/voice-input-module/p-52e59129.entry.js +2 -0
  81. package/dist/voice-input-module/p-52e59129.entry.js.map +1 -0
  82. package/dist/voice-input-module/p-DQuL1Twl.js +2 -0
  83. package/dist/voice-input-module/p-DQuL1Twl.js.map +1 -0
  84. package/dist/voice-input-module/p-jmc2yzBp.js +3 -0
  85. package/dist/voice-input-module/p-jmc2yzBp.js.map +1 -0
  86. package/dist/voice-input-module/voice-input-module.esm.js +2 -0
  87. package/dist/voice-input-module/voice-input-module.esm.js.map +1 -0
  88. package/env-config.js +4 -0
  89. package/inject-env.js +20 -0
  90. package/package.json +37 -0
  91. package/readme.md +111 -0
  92. package/src/components/ocr-file-uploader/ocr-file-uploader.css +26 -0
  93. package/src/components/ocr-file-uploader/ocr-file-uploader.tsx +100 -0
  94. package/src/components/ocr-file-uploader/readme.md +31 -0
  95. package/src/components/voice-input-module/readme.md +114 -0
  96. package/src/components/voice-input-module/voice-input-module.css +286 -0
  97. package/src/components/voice-input-module/voice-input-module.tsx +778 -0
  98. package/src/components.d.ts +158 -0
  99. package/src/index.html +1015 -0
  100. package/src/index.ts +12 -0
  101. package/src/services/audio-recorder.service.ts +74 -0
  102. package/src/services/llm.service.ts +221 -0
  103. package/src/services/speech-to-text.service.ts +70 -0
  104. package/src/types/form-schema.types.ts +78 -0
  105. package/src/types/service-providers.types.ts +22 -0
  106. package/src/utils/schema-converter.ts +494 -0
  107. package/stencil.config.ts +24 -0
  108. package/tsconfig.json +30 -0
package/.editorconfig ADDED
@@ -0,0 +1,15 @@
1
+ # http://editorconfig.org
2
+
3
+ root = true
4
+
5
+ [*]
6
+ charset = utf-8
7
+ indent_style = space
8
+ indent_size = 2
9
+ end_of_line = lf
10
+ insert_final_newline = true
11
+ trim_trailing_whitespace = true
12
+
13
+ [*.md]
14
+ insert_final_newline = false
15
+ trim_trailing_whitespace = false
@@ -0,0 +1,13 @@
1
+ {
2
+ "arrowParens": "avoid",
3
+ "bracketSpacing": true,
4
+ "jsxBracketSameLine": false,
5
+ "jsxSingleQuote": false,
6
+ "quoteProps": "consistent",
7
+ "printWidth": 180,
8
+ "semi": true,
9
+ "singleQuote": true,
10
+ "tabWidth": 2,
11
+ "trailingComma": "all",
12
+ "useTabs": false
13
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,46 @@
1
+ // This script injects the API key from server environment into the client
2
+ // This would normally be handled by a server-side framework, but for demo purposes
3
+ // we'll create a simple endpoint to fetch the key
4
+
5
+ async function getApiKey() {
6
+ try {
7
+ // In a real application, you'd have a secure endpoint that provides the API key
8
+ // For this demo, we'll check if it's available in some global scope
9
+ if (typeof process !== 'undefined' && process.env && process.env.OPENAI_API_KEY) {
10
+ return process.env.OPENAI_API_KEY;
11
+ }
12
+
13
+ // Check if Replit has exposed it as a global variable
14
+ if (window.REPLIT_ENV && window.REPLIT_ENV.OPENAI_API_KEY) {
15
+ return window.REPLIT_ENV.OPENAI_API_KEY;
16
+ }
17
+
18
+ // For demo purposes, we'll show a prompt to enter the API key
19
+ return null;
20
+ } catch (error) {
21
+ console.error('Error getting API key:', error);
22
+ return null;
23
+ }
24
+ }
25
+
26
+ // Function to inject API key into components
27
+ async function injectApiKey() {
28
+ const apiKey = await getApiKey();
29
+
30
+ if (apiKey) {
31
+ // Find all voice-input-module components and set their API key
32
+ const components = document.querySelectorAll('voice-input-module');
33
+ components.forEach(component => {
34
+ component.setAttribute('api-key', apiKey);
35
+ });
36
+ } else {
37
+ console.warn('No API key found. Components will show initialization error until API key is provided.');
38
+ }
39
+ }
40
+
41
+ // Run when DOM is loaded
42
+ if (document.readyState === 'loading') {
43
+ document.addEventListener('DOMContentLoaded', injectApiKey);
44
+ } else {
45
+ injectApiKey();
46
+ }
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ const globalScripts = () => {};
4
+
5
+ exports.globalScripts = globalScripts;
6
+ //# sourceMappingURL=app-globals-V2Kpy_OQ.js.map
7
+
8
+ //# sourceMappingURL=app-globals-V2Kpy_OQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-globals-V2Kpy_OQ.js","sources":["@stencil/core/internal/app-globals"],"sourcesContent":["export const globalScripts = () => {};\nexport const globalStyles = \"\";\n"],"names":[],"mappings":";;AAAY,MAAC,aAAa,GAAG,MAAM;;;;"}