@things-factory/operato-codelingua 6.1.4

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 (78) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/Dockerfile +16 -0
  3. package/README.md +37 -0
  4. package/_index.html +89 -0
  5. package/assets/favicon.ico +0 -0
  6. package/assets/helps/index.md +1 -0
  7. package/assets/images/hatiolab-logo.png +0 -0
  8. package/assets/images/spinner.png +0 -0
  9. package/assets/manifest/apple-1024.png +0 -0
  10. package/assets/manifest/apple-120.png +0 -0
  11. package/assets/manifest/apple-152.png +0 -0
  12. package/assets/manifest/apple-167.png +0 -0
  13. package/assets/manifest/apple-180.png +0 -0
  14. package/assets/manifest/apple-touch-icon.png +0 -0
  15. package/assets/manifest/badge-128x128.png +0 -0
  16. package/assets/manifest/chrome-splashscreen-icon-384x384.png +0 -0
  17. package/assets/manifest/chrome-touch-icon-192x192.png +0 -0
  18. package/assets/manifest/icon-128x128.png +0 -0
  19. package/assets/manifest/icon-192x192.png +0 -0
  20. package/assets/manifest/icon-512x512.png +0 -0
  21. package/assets/manifest/icon-72x72.png +0 -0
  22. package/assets/manifest/icon-96x96.png +0 -0
  23. package/assets/manifest/image-metaog.png +0 -0
  24. package/assets/manifest/maskable_icon.png +0 -0
  25. package/assets/manifest/ms-icon-144x144.png +0 -0
  26. package/assets/manifest/ms-touch-icon-144x144-precomposed.png +0 -0
  27. package/assets/manifest.json +27 -0
  28. package/client/actions/main.ts +1 -0
  29. package/client/bootstrap.ts +8 -0
  30. package/client/index.ts +1 -0
  31. package/client/pages/main.ts +33 -0
  32. package/client/reducers/main.ts +17 -0
  33. package/client/route.ts +10 -0
  34. package/client/themes/app-theme.css +142 -0
  35. package/client/tsconfig.json +12 -0
  36. package/config/config.development.js +7 -0
  37. package/config/config.production.js +41 -0
  38. package/config.development.js +7 -0
  39. package/db.sqlite +0 -0
  40. package/dist-server/controllers/index.js +5 -0
  41. package/dist-server/controllers/index.js.map +1 -0
  42. package/dist-server/controllers/openai-connection.js +26 -0
  43. package/dist-server/controllers/openai-connection.js.map +1 -0
  44. package/dist-server/index.js +6 -0
  45. package/dist-server/index.js.map +1 -0
  46. package/dist-server/routes.js +25 -0
  47. package/dist-server/routes.js.map +1 -0
  48. package/dist-server/service/index.js +14 -0
  49. package/dist-server/service/index.js.map +1 -0
  50. package/dist-server/tsconfig.tsbuildinfo +1 -0
  51. package/installer/config.production.js +40 -0
  52. package/installer/docker-compose.yml +37 -0
  53. package/installer/install.sh +54 -0
  54. package/installer/migrate.sh +1 -0
  55. package/installer/start.sh +18 -0
  56. package/installer/stop.sh +1 -0
  57. package/installer/upgrade.sh +1 -0
  58. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +30 -0
  59. package/logs/application-2023-06-25-11.log +12 -0
  60. package/logs/application-2023-06-25-12.log +34 -0
  61. package/logs/application-2023-06-25-13.log +8 -0
  62. package/openapi/unstable.yaml +41 -0
  63. package/package.json +55 -0
  64. package/schema.gql +841 -0
  65. package/server/controllers/index.ts +1 -0
  66. package/server/controllers/openai-connection.ts +27 -0
  67. package/server/index.ts +3 -0
  68. package/server/routes.ts +28 -0
  69. package/server/service/index.ts +13 -0
  70. package/server/tsconfig.json +9 -0
  71. package/things-factory.config.ts +13 -0
  72. package/translations/en.json +1 -0
  73. package/translations/ja.json +1 -0
  74. package/translations/ko.json +1 -0
  75. package/translations/ms.json +1 -0
  76. package/translations/zh.json +1 -0
  77. package/views/auth-page.html +93 -0
  78. package/views/public/home.html +83 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
+ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
+
8
+ <!-- ## [Unreleased] -->
package/Dockerfile ADDED
@@ -0,0 +1,16 @@
1
+ # Use an official ubuntu image
2
+ FROM hatiolab/operato-env:latest
3
+
4
+ # Set the working directory to /app
5
+ WORKDIR /app
6
+
7
+ # copy application & configuration files
8
+ COPY . .
9
+
10
+ # run node install command
11
+ RUN yarn install
12
+
13
+ # Make port 3000 available to the world outside this container
14
+ EXPOSE 3000
15
+
16
+ CMD [ "yarn", "run", "serve" ]
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Operato CodeLingua
2
+
3
+ ## Deciphering Code, Simplifying Understanding
4
+
5
+ CodeLingua is a revolutionary service that deciphers technical system responses and translates them into understandable language. Leveraging the power of AI, CodeLingua turns cryptic error codes and system messages into user-friendly explanations. This facilitates a more efficient and user-friendly approach to technical troubleshooting and system understanding.
6
+
7
+ ### Features:
8
+
9
+ - **System Error Translation**: Convert technical system error codes and messages into user-friendly language.
10
+ - **Integration with Various Systems**: Compatible with various external systems like databases, middleware, platform services, etc.
11
+ - **AI-Powered Interpretation**: Utilizes OpenAI's GPT models to interpret and explain complex system messages.
12
+
13
+ ### Getting Started:
14
+
15
+ To get started with CodeLingua, follow these steps:
16
+
17
+ 1. **Installation**: Download or clone this repository to your local system.
18
+ 2. **Setup**: Install all the required dependencies by running `npm install` in the project root directory.
19
+ 3. **Usage**: Start the service by running `npm start` in the project root directory.
20
+
21
+ ### Contributing:
22
+
23
+ Contributions to CodeLingua are always welcome. Whether it's feature enhancements, bug fixes, or design improvements, we appreciate all help! For major changes, please open an issue first to discuss what you would like to change.
24
+
25
+ ### License:
26
+
27
+ [MIT](https://choosealicense.com/licenses/mit/)
28
+
29
+ ### Contact:
30
+
31
+ For any questions or concerns, please open an issue on this repository, and we will try to respond as soon as possible.
32
+
33
+ Note: This project is in its early stage, and we appreciate your patience and support as we work towards a more complete and robust solution.
34
+
35
+ CodeLingua is proudly built on top of the [Things-Factory framework](https://www.hatiolab.com/things-factory.html) by [Hatiolab](https://www.hatiolab.com).
36
+
37
+ Join us in our journey of translating code into language for everyone to understand!
package/_index.html ADDED
@@ -0,0 +1,89 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>Codelingua</title>
6
+ <meta name="generator" content="Things Factory Starter Kit" />
7
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
8
+ <meta name="description" content="Deciphering Code, Simplifying Understanding" />
9
+
10
+ <base href="/" />
11
+
12
+ <link rel="icon" href="/assets/favicon.ico" />
13
+
14
+ <!-- See https://goo.gl/OOhYW5 -->
15
+ <link rel="manifest" href="/assets/manifest.json" />
16
+
17
+ <!-- See https://goo.gl/qRE0vM -->
18
+ <meta name="theme-color" content="#22a6a7" />
19
+
20
+ <!-- Add to homescreen for Chrome on Android. Fallback for manifest.json -->
21
+ <meta name="mobile-web-app-capable" content="yes" />
22
+ <meta name="application-name" content="Codelingua" />
23
+ <meta name="application-description" content="Deciphering Code, Simplifying Understanding" />
24
+ <meta name="application-copyright" content="Copyright © hatiolab.com. All Rights Reserved." />
25
+ <link rel="application-icon" href="/assets/manifest/icon-96x96.png" />
26
+
27
+ <!-- Add to homescreen for Safari on iOS -->
28
+ <meta name="apple-mobile-web-app-capable" content="yes" />
29
+ <meta name="apple-mobile-web-app-status-bar-style" content="default" />
30
+ <meta name="apple-mobile-web-app-title" content="Codelingua" />
31
+
32
+ <!-- Homescreen icons -->
33
+ <link rel="apple-touch-icon" href="/assets/manifest/icon-48x48.png" />
34
+ <link rel="apple-touch-icon" sizes="72x72" href="/assets/manifest/icon-72x72.png" />
35
+ <link rel="apple-touch-icon" sizes="96x96" href="/assets/manifest/icon-96x96.png" />
36
+ <link rel="apple-touch-icon" sizes="144x144" href="/assets/manifest/icon-144x144.png" />
37
+ <link rel="apple-touch-icon" sizes="192x192" href="/assets/manifest/icon-192x192.png" />
38
+
39
+ <!-- Tile icon for Windows 8 (144x144 + tile color) -->
40
+ <meta name="msapplication-TileImage" content="/assets/manifest/icon-144x144.png" />
41
+ <meta name="msapplication-TileColor" content="#3f51b5" />
42
+ <meta name="msapplication-tap-highlight" content="no" />
43
+
44
+ <!-- Default twitter cards -->
45
+ <meta name="twitter:card" content="summary" />
46
+ <meta name="twitter:site" content="@username" />
47
+ <meta property="og:type" content="website" />
48
+ <meta property="og:site_name" content="Codelingua, Deciphering Code, Simplifying Understanding." />
49
+ <meta property="og:image" content="/assets/manifest/image-metaog.png" />
50
+
51
+ <!-- Performance tip: hint to the browser to start the handshake for the fonts site -->
52
+ <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin />
53
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" />
54
+
55
+ <!-- Add any global styles for body, document, etc. -->
56
+ <style>
57
+ body {
58
+ margin: 0;
59
+ padding: 0;
60
+ overflow: hidden;
61
+
62
+ /* This is a font-stack that tries to use the system-default sans-serifs first */
63
+ font-family: Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
64
+ line-height: 1.5;
65
+ -webkit-font-smoothing: antialiased;
66
+
67
+ accent-color: var(--primary-color);
68
+ }
69
+ </style>
70
+
71
+ <script>
72
+ if ('serviceWorker' in navigator) {
73
+ navigator.serviceWorker.register('/service-worker.js', {
74
+ scope: '/'
75
+ })
76
+ }
77
+ </script>
78
+ </head>
79
+
80
+ <body>
81
+ <things-app></things-app>
82
+ <noscript> Please enable JavaScript to view this website. </noscript>
83
+ <!-- Load webcomponents-loader.js to check and load any polyfills your browser needs -->
84
+ <script src="node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
85
+ <script src="node_modules/web-animations-js/web-animations-next.min.js"></script>
86
+ <script src="node_modules/@hatiolab/things-scene/things-scene-min.js"></script>
87
+ <!-- Built with love using PWA Starter Kit -->
88
+ </body>
89
+ </html>
Binary file
@@ -0,0 +1 @@
1
+ # Operato-Codelingua
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "Codelingua",
3
+ "short_name": "Codelingua",
4
+ "description": "Deciphering Code, Simplifying Understanding",
5
+ "icons": [
6
+ {
7
+ "src": "manifest/icon-192x192.png",
8
+ "sizes": "192x192",
9
+ "type": "image/png"
10
+ },
11
+ {
12
+ "src": "manifest/icon-512x512.png",
13
+ "sizes": "512x512",
14
+ "type": "image/png"
15
+ },
16
+ {
17
+ "src": "manifest/maskable_icon.png",
18
+ "sizes": "682x682",
19
+ "type": "image/png",
20
+ "purpose": "maskable"
21
+ }
22
+ ],
23
+ "start_url": "/",
24
+ "display": "standalone",
25
+ "theme_color": "#3f51b5",
26
+ "background_color": "#3f51b5"
27
+ }
@@ -0,0 +1 @@
1
+ export const UPDATE_OPERATO_CODELINGUA = 'UPDATE_OPERATO_CODELINGUA'
@@ -0,0 +1,8 @@
1
+ import { store } from '@operato/shell'
2
+ import operatoCodelingua from './reducers/main'
3
+
4
+ export default function bootstrap() {
5
+ store.addReducers({
6
+ operatoCodelingua
7
+ })
8
+ }
@@ -0,0 +1 @@
1
+ export * from './actions/main'
@@ -0,0 +1,33 @@
1
+ import { html, css } from 'lit'
2
+ import { customElement, property } from 'lit/decorators.js'
3
+ import { connect } from 'pwa-helpers/connect-mixin.js'
4
+ import { store, PageView } from '@operato/shell'
5
+
6
+ import logo from '../../assets/images/hatiolab-logo.png'
7
+
8
+ @customElement('operato-codelingua-main')
9
+ export class OperatoCodelinguaMain extends connect(store)(PageView) {
10
+ static styles = [
11
+ css`
12
+ :host {
13
+ display: flex;
14
+ }
15
+ `
16
+ ]
17
+
18
+ @property({ type: String }) operatoCodelingua?: string
19
+
20
+ render() {
21
+ return html`
22
+ <section>
23
+ <h2>OperatoCodelingua</h2>
24
+ <img src=${logo}>
25
+ </section>
26
+ `
27
+ }
28
+
29
+ stateChanged(state: any) {
30
+ this.operatoCodelingua = state.operatoCodelingua.state_main
31
+ }
32
+ }
33
+
@@ -0,0 +1,17 @@
1
+ import { UPDATE_OPERATO_CODELINGUA } from '../actions/main'
2
+
3
+ const INITIAL_STATE = {
4
+ operatoCodelingua: 'ABC'
5
+ }
6
+
7
+ const operatoCodelingua = (state = INITIAL_STATE, action) => {
8
+ switch (action.type) {
9
+ case UPDATE_OPERATO_CODELINGUA:
10
+ return { ...state }
11
+
12
+ default:
13
+ return state
14
+ }
15
+ }
16
+
17
+ export default operatoCodelingua
@@ -0,0 +1,10 @@
1
+ export default function route(page: string) {
2
+ switch (page) {
3
+ case '':
4
+ return '/operato-codelingua-main'
5
+
6
+ case 'operato-codelingua-main':
7
+ import('./pages/main')
8
+ return page
9
+ }
10
+ }
@@ -0,0 +1,142 @@
1
+ body {
2
+ /* theme color */
3
+ --primary-color-rgb: 34, 166, 167;
4
+ --primary-color: rgb(var(--primary-color-rgb));
5
+ --secondary-color-rgb: 57, 78, 100;
6
+ --secondary-color: rgb(var(--secondary-color-rgb));
7
+ --focus-color: var(--theme-white-color);
8
+ --primary-background-color: var(--secondary-color);
9
+ --secondary-background-color: #283644;
10
+ --main-section-background-color: #f4f7fb;
11
+ --theme-white-color: #fff;
12
+ --theme-black-color: rgba(0, 0, 0, 0.9);
13
+
14
+ --focus-background-color: var(--primary-color);
15
+ --primary-text-color: #111;
16
+ --secondary-text-color: #017e7f;
17
+
18
+ --opacity-dark-color: rgba(0, 0, 0, 0.4);
19
+ --opacity-light-color: rgba(255, 255, 255, 0.8);
20
+
21
+ /* status color */
22
+ --status-success-color: #35a24a;
23
+ --status-warning-color: #ee8d03;
24
+ --status-danger-color: #d14946;
25
+ --status-info-color: #398ace;
26
+
27
+ /* common style */
28
+ --border-radius: 4px;
29
+ --border-dark-color: 1px solid rgba(0, 0, 0, 0.15);
30
+ --border-light-color: 1px solid rgba(255, 255, 255, 0.3);
31
+
32
+ --box-shadow: 2px 2px 3px 0px rgba(0, 0, 0, 0.1);
33
+
34
+ --theme-font: 'Noto', Helvetica;
35
+
36
+ --margin-default: 9px;
37
+ --margin-narrow: 4px;
38
+ --margin-wide: 15px;
39
+ --padding-default: var(--margin-default);
40
+ --padding-narrow: var(--margin-narrow);
41
+ --padding-wide: var(--margin-wide);
42
+
43
+ --scrollbar-thumb-color: rgba(57, 78, 100, 0.5);
44
+ --scrollbar-thumb-hover-color: var(--primary-color);
45
+
46
+ --fontsize-default: 14px;
47
+ --fontsize-small: 13px;
48
+ --fontsize-large: 16px;
49
+
50
+ /* app layout style */
51
+ --app-grid-template-area: 'header header header' 'nav main aside' 'nav footer aside';
52
+
53
+ /* title & description style */
54
+ --title-margin: var(--margin-narrow) 0;
55
+ --title-font: bold 24px var(--theme-font);
56
+ --title-text-color: var(--secondary-color);
57
+ --title-font-mobile: bold 20px var(--theme-font);
58
+
59
+ --page-description-margin: var(--margin-narrow) 0 var(--margin-wide) 0;
60
+ --page-description-font: normal var(--fontsize-default) / 1.2rem var(--theme-font);
61
+ --page-description-color: var(--secondary-text-color);
62
+
63
+ --subtitle-padding: 12px 5px 3px 5px;
64
+ --subtitle-font: bold 18px var(--theme-font);
65
+ --subtitle-text-color: var(--primary-color);
66
+ --subtitle-border-bottom: 1px solid var(--primary-color);
67
+
68
+ /* icon style */
69
+ --icon-tiny-size: 24px;
70
+ --icon-default-size: 36px;
71
+ --icon-big-size: 48px;
72
+ --icon-default-color: var(--theme-white-color);
73
+
74
+ /* material design component themes */
75
+ --mdc-theme-on-primary: var(--theme-white-color);
76
+ --mdc-theme-primary: var(--secondary-text-color);
77
+ --mdc-theme-on-secondary: var(--theme-white-color);
78
+ --mdc-theme-secondary: var(--primary-color);
79
+ --mdc-button-outline-color: var(--primary-color);
80
+ --mdc-danger-button-primary-color: var(--status-danger-color);
81
+ --mdc-danger-button-outline-color: var(--status-danger-color);
82
+ --mdc-button-outline-width: 1px;
83
+ --mdc-button-horizontal-padding: 16px;
84
+
85
+ /* button style */
86
+ --button-background-color: #fafbfc;
87
+ --button-background-focus-color: var(--primary-color);
88
+ --button-border: var(--border-dark-color);
89
+ --button-border-radius: var(--border-radius);
90
+ --button-margin: var(--margin-default) var(--margin-default) var(--margin-default) 0;
91
+ --button-padding: var(--padding-default);
92
+ --button-color: var(--secondary-color);
93
+ --button-font: normal 15px var(--theme-font);
94
+ --button-text-transform: capitalize;
95
+ --button-active-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);
96
+ --button-activ-border: 1px solid var(--primary-color);
97
+
98
+ --button-primary-background-color: var(--primary-color);
99
+ --button-primary-active-background-color: var(--status-success-color);
100
+ --button-primary-padding: var(--margin-default) var(--margin-wide);
101
+ --button-primary-color: var(--theme-white-color);
102
+ --button-primary-font: bold 16px var(--theme-font);
103
+
104
+ /* table style */
105
+ --th-padding: var(--padding-default) 0 var(--padding-default) var(--padding-default);
106
+ --th-border-top: 2px solid var(--secondary-color);
107
+ --th-text-transform: capitalize;
108
+ --th-font: bold var(--fontsize-small) var(--theme-font);
109
+ --th-color: rgba(var(--secondary-color-rgb), 0.8);
110
+
111
+ --tr-background-color: var(--theme-white-color);
112
+ --tr-background-odd-color: rgba(255, 255, 255, 0.4);
113
+ --tr-background-hover-color: #e1f5fe;
114
+ --td-border-bottom: 1px solid rgba(0, 0, 0, 0.09);
115
+ --td-padding: var(--padding-default);
116
+ --td-font: normal 13px var(--theme-font);
117
+ --td-color: var(--secondary-color);
118
+
119
+ /* form style */
120
+ --label-font: normal var(--fontsize-default) var(--theme-font);
121
+ --label-color: var(--secondary-color);
122
+ --label-text-transform: capitalize;
123
+ --input-margin: var(--margin-narrow) 0;
124
+ --input-padding: var(--padding-default);
125
+ --input-min-width: 200px;
126
+ --input-font: normal var(--fontsize-default) var(--theme-font);
127
+ --input-hint-font: normal var(--fontsize-small) var(--theme-font);
128
+ --input-hint-color: #666;
129
+ --input-container-max-width: 900px;
130
+ --fieldset-margin: var(--padding-wide) 0;
131
+ --fieldset-padding: 0 var(--padding-wide) var(--padding-wide) var(--padding-wide);
132
+ --legend-padding: var(--padding-default) 0;
133
+ --legend-color: var(--secondary-text-color);
134
+ --legend-font: bold 16px var(--theme-font);
135
+ }
136
+
137
+ @media only screen and (max-width: 460px) {
138
+ body {
139
+ /* subtitle style */
140
+ --subtitle-margin: 0;
141
+ }
142
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "../../tsconfig-base.json",
3
+ "compilerOptions": {
4
+ "experimentalDecorators": true,
5
+ "strict": true,
6
+ "declaration": true,
7
+ "module": "esnext",
8
+ "outDir": "../dist-client",
9
+ "baseUrl": "./"
10
+ },
11
+ "include": ["./**/*"]
12
+ }
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ subdomain: 'system',
3
+ openai: {
4
+ organization: 'org-XXXXXXXXXXXXXXXX',
5
+ apiKey: 'sk-YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'
6
+ }
7
+ }
@@ -0,0 +1,41 @@
1
+ module.exports = {
2
+ subdomain: 'system',
3
+ openai: {
4
+ organization: 'org-XXXXXXXXXXXXXXXX',
5
+ apiKey: 'sk-YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'
6
+ },
7
+ email: {
8
+ host: 'smtp.office365.com', // your sender-email smtp host
9
+ port: 587, // smtp server port
10
+ secure: false, // true for 465, false for other ports
11
+ auth: {
12
+ user: 'your sender-email',
13
+ pass: 'your sender-email password' // generated ethereal password
14
+ },
15
+ secureConnection: false,
16
+ tls: {
17
+ ciphers: 'SSLv3'
18
+ }
19
+ },
20
+ logger: {
21
+ file: {
22
+ filename: 'logs/application-%DATE%.log',
23
+ datePattern: 'YYYY-MM-DD-HH',
24
+ zippedArchive: false,
25
+ maxSize: '20m',
26
+ maxFiles: '2d',
27
+ level: 'info'
28
+ },
29
+ console: {
30
+ level: 'silly'
31
+ }
32
+ },
33
+ ormconfig: {
34
+ name: 'default',
35
+ type: 'sqlite',
36
+ database: 'db.sqlite',
37
+ synchronize: false,
38
+ logging: true,
39
+ logger: 'debug'
40
+ }
41
+ }
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ subdomain: 'system'
3
+ // openai: {
4
+ // organization: 'org-WL2H4Xpiumk2fcpwuNklefnh',
5
+ // apiKey: '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'
6
+ // }
7
+ }
package/db.sqlite ADDED
Binary file
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./openai-connection"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":";;;AAAA,8DAAmC","sourcesContent":["export * from './openai-connection'\n"]}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decipher = void 0;
4
+ const openai_1 = require("openai");
5
+ const env_1 = require("@things-factory/env");
6
+ const OPENAI = env_1.config.get('openai', {});
7
+ const { organization, apiKey } = OPENAI;
8
+ if (!organization || !apiKey) {
9
+ console.error("'OPENAI_API_KEY' is not configured.");
10
+ process.exit(1);
11
+ }
12
+ const configuration = new openai_1.Configuration({
13
+ organization,
14
+ apiKey
15
+ });
16
+ const client = new openai_1.OpenAIApi(configuration);
17
+ const role = 'user';
18
+ async function decipher(prompt) {
19
+ const completion = await client.createChatCompletion({
20
+ model: 'gpt-3.5-turbo',
21
+ messages: [{ role, content: prompt }]
22
+ });
23
+ return completion.data.choices[0].message.content;
24
+ }
25
+ exports.decipher = decipher;
26
+ //# sourceMappingURL=openai-connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai-connection.js","sourceRoot":"","sources":["../../server/controllers/openai-connection.ts"],"names":[],"mappings":";;;AAAA,mCAAiD;AACjD,6CAA4C;AAE5C,MAAM,MAAM,GAAG,YAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;AACvC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,CAAA;AAEvC,IAAI,CAAC,YAAY,IAAI,CAAC,MAAM,EAAE;IAC5B,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAA;IACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;CAChB;AAED,MAAM,aAAa,GAAG,IAAI,sBAAa,CAAC;IACtC,YAAY;IACZ,MAAM;CACP,CAAC,CAAA;AAEF,MAAM,MAAM,GAAG,IAAI,kBAAS,CAAC,aAAa,CAAC,CAAA;AAC3C,MAAM,IAAI,GAAG,MAAM,CAAA;AAEZ,KAAK,UAAU,QAAQ,CAAC,MAAc;IAC3C,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC;QACnD,KAAK,EAAE,eAAe;QACtB,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;KACtC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAA;AACnD,CAAC;AAPD,4BAOC","sourcesContent":["import { Configuration, OpenAIApi } from 'openai'\nimport { config } from '@things-factory/env'\n\nconst OPENAI = config.get('openai', {})\nconst { organization, apiKey } = OPENAI\n\nif (!organization || !apiKey) {\n console.error(\"'OPENAI_API_KEY' is not configured.\")\n process.exit(1)\n}\n\nconst configuration = new Configuration({\n organization,\n apiKey\n})\n\nconst client = new OpenAIApi(configuration)\nconst role = 'user'\n\nexport async function decipher(prompt: string): Promise<string> {\n const completion = await client.createChatCompletion({\n model: 'gpt-3.5-turbo',\n messages: [{ role, content: prompt }]\n })\n\n return completion.data.choices[0].message.content\n}\n"]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ require("./routes");
5
+ tslib_1.__exportStar(require("./service"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;AAAA,oBAAiB;AAEjB,oDAAyB","sourcesContent":["import './routes'\n\nexport * from './service'\n"]}
@@ -0,0 +1,25 @@
1
+ const debug = require('debug')('things-factory:operato-codelingua:routes');
2
+ process.on('bootstrap-module-global-public-route', (app, globalPublicRouter) => {
3
+ /*
4
+ * can add global public routes to application (auth not required, tenancy not required)
5
+ *
6
+ * ex) routes.get('/path', async(context, next) => {})
7
+ * ex) routes.post('/path', async(context, next) => {})
8
+ */
9
+ });
10
+ process.on('bootstrap-module-global-private-route', (app, globalPrivateRouter) => {
11
+ /*
12
+ * can add global private routes to application (auth required, tenancy not required)
13
+ */
14
+ });
15
+ process.on('bootstrap-module-domain-public-route', (app, domainPublicRouter) => {
16
+ /*
17
+ * can add domain public routes to application (auth not required, tenancy required)
18
+ */
19
+ });
20
+ process.on('bootstrap-module-domain-private-route', (app, domainPrivateRouter) => {
21
+ /*
22
+ * can add domain private routes to application (auth required, tenancy required)
23
+ */
24
+ });
25
+ //# sourceMappingURL=routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,0CAA0C,CAAC,CAAA;AAE1E,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF;;;;;OAKG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF;;OAEG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF;;OAEG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF;;OAEG;AACL,CAAC,CAAC,CAAA","sourcesContent":["const debug = require('debug')('things-factory:operato-codelingua:routes')\n\nprocess.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {\n /*\n * can add global public routes to application (auth not required, tenancy not required)\n *\n * ex) routes.get('/path', async(context, next) => {})\n * ex) routes.post('/path', async(context, next) => {})\n */\n})\n\nprocess.on('bootstrap-module-global-private-route' as any, (app, globalPrivateRouter) => {\n /*\n * can add global private routes to application (auth required, tenancy not required)\n */\n})\n\nprocess.on('bootstrap-module-domain-public-route' as any, (app, domainPublicRouter) => {\n /*\n * can add domain public routes to application (auth not required, tenancy required)\n */\n})\n\nprocess.on('bootstrap-module-domain-private-route' as any, (app, domainPrivateRouter) => {\n /*\n * can add domain private routes to application (auth required, tenancy required)\n */\n})\n"]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /* EXPORT ENTITY TYPES */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.schema = exports.entities = void 0;
5
+ /* IMPORT ENTITIES AND RESOLVERS */
6
+ exports.entities = [
7
+ /* ENTITIES */
8
+ ];
9
+ exports.schema = {
10
+ resolverClasses: [
11
+ /* RESOLVER CLASSES */
12
+ ]
13
+ };
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";AAAA,yBAAyB;;;AAEzB,mCAAmC;AAEtB,QAAA,QAAQ,GAAG;AACtB,cAAc;CACf,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;IACf,sBAAsB;KACvB;CACF,CAAA","sourcesContent":["/* EXPORT ENTITY TYPES */\n\n/* IMPORT ENTITIES AND RESOLVERS */\n\nexport const entities = [\n /* ENTITIES */\n]\n\nexport const schema = {\n resolverClasses: [\n /* RESOLVER CLASSES */\n ]\n}\n"]}