@rxap/plugin-gpt 16.0.1-dev.3 → 16.0.1-dev.5

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [16.0.1-dev.5](https://gitlab.com/rxap/packages/compare/@rxap/plugin-gpt@16.0.1-dev.4...@rxap/plugin-gpt@16.0.1-dev.5) (2023-08-31)
7
+
8
+ ### Bug Fixes
9
+
10
+ - ensure the API key env is defined ([3c292ad](https://gitlab.com/rxap/packages/commit/3c292adf8cb5958ca02f7eadca9db92380dcc86b))
11
+ - ensure the project name is not included in the project tag list ([b131ac3](https://gitlab.com/rxap/packages/commit/b131ac3bd92b3b8799d62f15bbd30a1997d7c753))
12
+
13
+ ## [16.0.1-dev.4](https://gitlab.com/rxap/packages/compare/@rxap/plugin-gpt@16.0.1-dev.3...@rxap/plugin-gpt@16.0.1-dev.4) (2023-08-17)
14
+
15
+ ### Reverts
16
+
17
+ - change from commonjs to es2022 ([747a381](https://gitlab.com/rxap/packages/commit/747a381a090f0a276cf363da61bb19ed0c9cb5b7))
18
+
6
19
  ## [16.0.1-dev.3](https://gitlab.com/rxap/packages/compare/@rxap/plugin-gpt@16.0.1-dev.2...@rxap/plugin-gpt@16.0.1-dev.3) (2023-08-16)
7
20
 
8
21
  ### Bug Fixes
package/README.md CHANGED
@@ -18,7 +18,7 @@ yarn add @rxap/plugin-gpt
18
18
  ```
19
19
  **Install peer dependencies:**
20
20
  ```bash
21
- yarn add @nx/devkit@^16.5.0 @rxap/generator-ts-morph@^1.0.1-dev.3 @rxap/generator-utilities@^1.1.0-dev.4 gpt-3-encoder@^1.1.4 openai@^3.3.0 ts-morph@^18.0.0
21
+ yarn add @nx/devkit@^16.5.0 @rxap/generator-ts-morph@^1.0.1-dev.6 @rxap/generator-utilities@^1.1.0-dev.7 gpt-3-encoder@^1.1.4 openai@^3.3.0 ts-morph@^18.0.0
22
22
  ```
23
23
  # Generators
24
24
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rxap/plugin-gpt",
3
- "version": "16.0.1-dev.3",
4
- "type": "module",
3
+ "version": "16.0.1-dev.5",
4
+ "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "directory": "../../../dist/packages/plugin/gpt"
@@ -13,7 +13,8 @@
13
13
  "nx-plugin",
14
14
  "gpt",
15
15
  "openai",
16
- "packages"
16
+ "packages",
17
+ "plugin-gpt"
17
18
  ],
18
19
  "homepage": "https:/gitlab.com/rxap/packages/packages/plugin/gpt",
19
20
  "bugs": {
@@ -39,30 +40,30 @@
39
40
  },
40
41
  "peerDependencies": {
41
42
  "@nx/devkit": "^16.5.0",
42
- "@rxap/generator-ts-morph": "^1.0.1-dev.3",
43
- "@rxap/generator-utilities": "^1.1.0-dev.4",
43
+ "@rxap/generator-ts-morph": "^1.0.1-dev.6",
44
+ "@rxap/generator-utilities": "^1.1.0-dev.7",
44
45
  "gpt-3-encoder": "^1.1.4",
45
46
  "openai": "^3.3.0",
46
47
  "ts-morph": "^18.0.0",
47
- "@rxap/node-utilities": "1.1.0-dev.2",
48
- "@rxap/utilities": "16.0.0-dev.10",
49
- "@rxap/workspace-ts-morph": "0.1.0-dev.1",
50
- "@rxap/workspace-utilities": "0.1.0-dev.4"
48
+ "@rxap/node-utilities": "1.1.0-dev.4",
49
+ "@rxap/utilities": "16.0.0-dev.13",
50
+ "@rxap/workspace-ts-morph": "0.1.0-dev.3",
51
+ "@rxap/workspace-utilities": "0.1.0-dev.6"
51
52
  },
52
53
  "nx-migrations": {
53
54
  "packageGroup": [
54
55
  {
55
56
  "package": "@rxap/generator-ts-morph",
56
- "version": "1.0.1-dev.3"
57
+ "version": "1.0.1-dev.5"
57
58
  },
58
59
  {
59
60
  "package": "@rxap/generator-utilities",
60
- "version": "1.1.0-dev.4"
61
+ "version": "1.1.0-dev.6"
61
62
  }
62
63
  ]
63
64
  },
64
65
  "schematics": "./generators.json",
65
- "gitHead": "bbab80e59acbe435a02e69c9fec022780cf4640d",
66
+ "gitHead": "3d49d0a2548a0c403ad55c564108b54ba734a677",
66
67
  "main": "./src/index.js",
67
68
  "types": "./src/index.d.ts"
68
69
  }
@@ -1,25 +1,29 @@
1
- import { getProjects, } from '@nx/devkit';
2
- import { IndentationText, Project, QuoteKind, } from 'ts-morph';
3
- import { AddDir } from '@rxap/generator-ts-morph';
4
- import { GetProjectSourceRoot } from '@rxap/generator-utilities';
5
- import * as process from 'process';
6
- import { Configuration, OpenAIApi, } from 'openai';
7
- import { SimplePrompt } from './simple-prompt';
8
- import { join } from 'path';
9
- import { existsSync, readFileSync, } from 'fs';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.documentationGenerator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const generator_ts_morph_1 = require("@rxap/generator-ts-morph");
7
+ const generator_utilities_1 = require("@rxap/generator-utilities");
8
+ const fs_1 = require("fs");
9
+ const openai_1 = require("openai");
10
+ const path_1 = require("path");
11
+ const process = require("process");
12
+ const ts_morph_1 = require("ts-morph");
13
+ const simple_prompt_1 = require("./simple-prompt");
10
14
  function getOpenAi(param = {}) {
11
- const configuration = new Configuration({
12
- ...param,
13
- apiKey: process.env.OPENAI_API_KEY,
14
- });
15
- return new OpenAIApi(configuration);
15
+ if (!process.env.OPENAI_API_KEY) {
16
+ throw new Error('Can not find OPENAI_API_KEY environment variable');
17
+ }
18
+ const configuration = new openai_1.Configuration(Object.assign(Object.assign({}, param), { apiKey: process.env.OPENAI_API_KEY }));
19
+ return new openai_1.OpenAIApi(configuration);
16
20
  }
17
21
  function loadSystemPrompt(name) {
18
- const filePath = join(__dirname, 'system-prompts', `${name}.txt`);
19
- if (!existsSync(filePath)) {
22
+ const filePath = (0, path_1.join)(__dirname, 'system-prompts', `${name}.txt`);
23
+ if (!(0, fs_1.existsSync)(filePath)) {
20
24
  throw new Error(`Can not find system prompt file '${filePath}'`);
21
25
  }
22
- return readFileSync(filePath).toString();
26
+ return (0, fs_1.readFileSync)(filePath).toString();
23
27
  }
24
28
  const FUNCTION_SYSTEM_PROMPT = loadSystemPrompt('function');
25
29
  const METHOD_SYSTEM_PROMPT = loadSystemPrompt('method');
@@ -27,11 +31,13 @@ const CLASS_SYSTEM_PROMPT = loadSystemPrompt('class');
27
31
  function hasJsDoc(node) {
28
32
  return node.getJsDocs().length > 0;
29
33
  }
30
- async function prompt(options, systemPrompt, prompt) {
31
- if (options.offline) {
32
- return '';
33
- }
34
- return SimplePrompt(systemPrompt, prompt, getOpenAi());
34
+ function prompt(options, systemPrompt, prompt) {
35
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
36
+ if (options.offline) {
37
+ return '';
38
+ }
39
+ return (0, simple_prompt_1.SimplePrompt)(systemPrompt, prompt, getOpenAi());
40
+ });
35
41
  }
36
42
  function cleanupJsDoc(jsDoc) {
37
43
  const cleanJsDocArray = jsDoc
@@ -51,62 +57,70 @@ function addJsDoc(options, node, jsDoc) {
51
57
  }
52
58
  node.addJsDoc(cleanupJsDoc(jsDoc));
53
59
  }
54
- async function processMethod(options, project, sourceFile, methodDeclaration) {
55
- console.log(`====== Process method: \x1b[36m${methodDeclaration.getName()}\x1b[0m`);
56
- if (hasJsDoc(methodDeclaration)) {
57
- console.log(`\x1b[33mMethod has already a documentation\x1b[0m`);
58
- return false;
59
- }
60
- const methodText = methodDeclaration.getText();
61
- console.log('Method text:');
62
- console.log(methodText);
63
- const jsDoc = await prompt(options, METHOD_SYSTEM_PROMPT, methodText);
64
- console.log('Method documentation:');
65
- console.log(jsDoc);
66
- addJsDoc(options, methodDeclaration, jsDoc);
67
- return true;
60
+ function processMethod(options, project, sourceFile, methodDeclaration) {
61
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
+ console.log(`====== Process method: \x1b[36m${methodDeclaration.getName()}\x1b[0m`);
63
+ if (hasJsDoc(methodDeclaration)) {
64
+ console.log(`\x1b[33mMethod has already a documentation\x1b[0m`);
65
+ return false;
66
+ }
67
+ const methodText = methodDeclaration.getText();
68
+ console.log('Method text:');
69
+ console.log(methodText);
70
+ const jsDoc = yield prompt(options, METHOD_SYSTEM_PROMPT, methodText);
71
+ console.log('Method documentation:');
72
+ console.log(jsDoc);
73
+ addJsDoc(options, methodDeclaration, jsDoc);
74
+ return true;
75
+ });
68
76
  }
69
- async function processClass(options, project, sourceFile, classDeclaration) {
70
- console.log(`====== Process class: \x1b[36m${classDeclaration.getName()}\x1b[0m`);
71
- let changed = false;
72
- for (const md of classDeclaration.getMethods()) {
73
- const scope = md.getScope();
74
- if (scope === 'public' || scope === undefined) {
75
- const hasChanged = await processMethod(options, project, sourceFile, md);
76
- changed = changed || hasChanged;
77
+ function processClass(options, project, sourceFile, classDeclaration) {
78
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
79
+ console.log(`====== Process class: \x1b[36m${classDeclaration.getName()}\x1b[0m`);
80
+ let changed = false;
81
+ for (const md of classDeclaration.getMethods()) {
82
+ const scope = md.getScope();
83
+ if (scope === 'public' || scope === undefined) {
84
+ const hasChanged = yield processMethod(options, project, sourceFile, md);
85
+ changed = changed || hasChanged;
86
+ }
77
87
  }
78
- }
79
- return changed;
88
+ return changed;
89
+ });
80
90
  }
81
- async function processFunction(options, project, sourceFile, functionDeclaration) {
82
- console.log(`====== Process function: \x1b[36m${functionDeclaration.getName()}\x1b[0m`);
83
- if (hasJsDoc(functionDeclaration)) {
84
- console.log(`\x1b[33mFunction has already a documentation\x1b[0m`);
85
- return false;
86
- }
87
- const functionText = functionDeclaration.getText();
88
- console.log('Function text:');
89
- console.log(functionText);
90
- const jsDoc = await prompt(options, FUNCTION_SYSTEM_PROMPT, functionText);
91
- console.log('Function documentation:');
92
- console.log(jsDoc);
93
- addJsDoc(options, functionDeclaration, jsDoc);
94
- return true;
91
+ function processFunction(options, project, sourceFile, functionDeclaration) {
92
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
93
+ console.log(`====== Process function: \x1b[36m${functionDeclaration.getName()}\x1b[0m`);
94
+ if (hasJsDoc(functionDeclaration)) {
95
+ console.log(`\x1b[33mFunction has already a documentation\x1b[0m`);
96
+ return false;
97
+ }
98
+ const functionText = functionDeclaration.getText();
99
+ console.log('Function text:');
100
+ console.log(functionText);
101
+ const jsDoc = yield prompt(options, FUNCTION_SYSTEM_PROMPT, functionText);
102
+ console.log('Function documentation:');
103
+ console.log(jsDoc);
104
+ addJsDoc(options, functionDeclaration, jsDoc);
105
+ return true;
106
+ });
95
107
  }
96
- async function processSourceFile(options, project, sourceFile) {
97
- console.log(`====== Process source file: \x1b[35m${sourceFile.getFilePath()}\x1b[0m`);
98
- let changed = false;
99
- for (const fd of sourceFile.getFunctions()) {
100
- const hasChanged = await processFunction(options, project, sourceFile, fd);
101
- changed = changed || hasChanged;
102
- }
103
- for (const cd of sourceFile.getClasses()) {
104
- const hasChanged = await processClass(options, project, sourceFile, cd);
105
- changed = changed || hasChanged;
106
- }
107
- return changed;
108
+ function processSourceFile(options, project, sourceFile) {
109
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
110
+ console.log(`====== Process source file: \x1b[35m${sourceFile.getFilePath()}\x1b[0m`);
111
+ let changed = false;
112
+ for (const fd of sourceFile.getFunctions()) {
113
+ const hasChanged = yield processFunction(options, project, sourceFile, fd);
114
+ changed = changed || hasChanged;
115
+ }
116
+ for (const cd of sourceFile.getClasses()) {
117
+ const hasChanged = yield processClass(options, project, sourceFile, cd);
118
+ changed = changed || hasChanged;
119
+ }
120
+ return changed;
121
+ });
108
122
  }
109
- function skipSourceFile(sourceFile) {
123
+ function skipSourceFile(sourceFile, filter) {
110
124
  if (sourceFile.getBaseName() === 'index.ts') {
111
125
  // console.log(`\x1b[33mSkip index file: \x1b[0m${ sourceFile.getFilePath() }`);
112
126
  return true;
@@ -123,55 +137,74 @@ function skipSourceFile(sourceFile) {
123
137
  // console.log(`\x1b[33mSkip cypress file: \x1b[0m${ sourceFile.getFilePath() }`);
124
138
  return true;
125
139
  }
140
+ if (filter) {
141
+ if (!sourceFile.getFilePath().includes(filter)) {
142
+ // console.log(`\x1b[33mSkip file: \x1b[0m${ sourceFile.getFilePath() }`);
143
+ return true;
144
+ }
145
+ }
126
146
  return false;
127
147
  }
128
- async function processProject(options, projectName, tree) {
129
- const projectSourceRoot = GetProjectSourceRoot(tree, projectName);
130
- const project = new Project({
131
- manipulationSettings: {
132
- indentationText: IndentationText.TwoSpaces,
133
- quoteKind: QuoteKind.Single,
134
- },
135
- useInMemoryFileSystem: true,
136
- });
137
- AddDir(tree, projectSourceRoot, project);
138
- const start = Date.now();
139
- for (const sourceFile of project.getSourceFiles()) {
140
- if (skipSourceFile(sourceFile)) {
141
- continue;
142
- }
143
- try {
144
- const changed = await processSourceFile(options, project, sourceFile);
145
- if (changed) {
146
- tree.write(sourceFile.getFilePath(), sourceFile.getFullText());
148
+ function processProject(options, projectName, tree) {
149
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
150
+ const projectSourceRoot = (0, generator_utilities_1.GetProjectSourceRoot)(tree, projectName);
151
+ const project = new ts_morph_1.Project({
152
+ manipulationSettings: {
153
+ indentationText: ts_morph_1.IndentationText.TwoSpaces,
154
+ quoteKind: ts_morph_1.QuoteKind.Single,
155
+ },
156
+ useInMemoryFileSystem: true,
157
+ });
158
+ (0, generator_ts_morph_1.AddDir)(tree, projectSourceRoot, project);
159
+ const start = Date.now();
160
+ for (const sourceFile of project.getSourceFiles()) {
161
+ if (skipSourceFile(sourceFile, options.filter)) {
162
+ continue;
163
+ }
164
+ try {
165
+ const changed = yield processSourceFile(options, project, sourceFile);
166
+ if (changed) {
167
+ tree.write((0, path_1.join)(projectSourceRoot, sourceFile.getFilePath()), sourceFile.getFullText());
168
+ }
169
+ }
170
+ catch (e) {
171
+ console.error(`\x1b[31mError processing file: \x1b[0m${sourceFile.getFilePath()}`);
172
+ console.error(e.message);
173
+ console.error(e.stack);
174
+ break;
175
+ }
176
+ if (Date.now() - start > MAX_TIME) {
177
+ console.log(`\x1b[33mMax time reached: \x1b[0m${MAX_TIME}`);
178
+ break;
147
179
  }
148
180
  }
149
- catch (e) {
150
- console.error(`\x1b[31mError processing file: \x1b[0m${sourceFile.getFilePath()}`);
151
- console.error(e.message);
152
- console.error(e.stack);
153
- break;
154
- }
155
- if (Date.now() - start > MAX_TIME) {
156
- console.log(`\x1b[33mMax time reached: \x1b[0m${MAX_TIME}`);
157
- break;
158
- }
159
- }
181
+ });
160
182
  }
161
183
  function skipProject(project, projectName, options) {
162
- if (options.projects?.length) {
184
+ var _a;
185
+ if ((_a = options.projects) === null || _a === void 0 ? void 0 : _a.length) {
163
186
  return !options.projects.includes(projectName);
164
187
  }
165
188
  return false;
166
189
  }
167
190
  const MAX_TIME = 1000 * 60 * 60 * 0.5;
168
- export async function documentationGenerator(tree, options) {
169
- for (const [projectName, project] of getProjects(tree).entries()) {
170
- if (skipProject(project, projectName, options)) {
171
- continue;
191
+ function documentationGenerator(tree, options) {
192
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
193
+ if (options.openaiApiKey) {
194
+ process.env.OPENAI_API_KEY = options.openaiApiKey;
172
195
  }
173
- await processProject(options, projectName, tree);
174
- }
196
+ if (!process.env.OPENAI_API_KEY) {
197
+ throw new Error('Can not find OPENAI_API_KEY environment variable');
198
+ }
199
+ console.log(`\x1b[33mOpenAI API key: \x1b[0m${process.env.OPENAI_API_KEY}`);
200
+ for (const [projectName, project] of (0, devkit_1.getProjects)(tree).entries()) {
201
+ if (skipProject(project, projectName, options)) {
202
+ continue;
203
+ }
204
+ yield processProject(options, projectName, tree);
205
+ }
206
+ });
175
207
  }
176
- export default documentationGenerator;
208
+ exports.documentationGenerator = documentationGenerator;
209
+ exports.default = documentationGenerator;
177
210
  //# sourceMappingURL=generator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GAGZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EAGL,eAAe,EAGf,OAAO,EACP,SAAS,GAEV,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EACL,aAAa,EAEb,SAAS,GACV,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EACL,UAAU,EACV,YAAY,GACb,MAAM,IAAI,CAAC;AAEZ,SAAS,SAAS,CAAC,QAAiD,EAAE;IAGpE,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC;QACtC,GAAG,KAAK;QACR,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;KACnC,CAAC,CAAC;IACH,OAAO,IAAI,SAAS,CAAC,aAAa,CAAC,CAAC;AAEtC,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY;IACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,gBAAgB,EAAE,GAAI,IAAK,MAAM,CAAC,CAAC;IACpE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QACzB,MAAM,IAAI,KAAK,CAAC,oCAAqC,QAAS,GAAG,CAAC,CAAC;KACpE;IACD,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC3C,CAAC;AAED,MAAM,sBAAsB,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;AAC5D,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,QAAQ,CAAC,C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AAC,CAAC;aAChE;SACF;QAAC,OAAO,CAAM,EAAE;YACf,OAAO,CAAC,KAAK,CAAC,yCAA0C,UAAU,CAAC,WAAW,EAAG,EAAE,CAAC,CAAC;YACrF,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YACzB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACvB,MAAM;SACP;QACD,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,QAAQ,EAAE;YACjC,OAAO,CAAC,GAAG,CAAC,oCAAqC,QAAS,EAAE,CAAC,CAAC;YAC9D,MAAM;SACP;KACF;AAEH,CAAC;AAED,SAAS,WAAW,CAAC,OAA6B,EAAE,WAAmB,EAAE,OAAqC;IAE5G,IAAI,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE;QAC5B,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;KAChD;IAED,OAAO,KAAK,CAAC;AAEf,CAAC;AAED,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;AAEtC,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,IAAU,EACV,OAAqC;IAGrC,KAAK,MAAM,CAAE,WAAW,EAAE,OAAO,CAAE,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;QAElE,IAAI,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE;YAC9C,SAAS;SACV;QAED,MAAM,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;KAElD;AAEH,CAAC;AAED,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAIoB;AACpB,iEAAkD;AAClD,mEAAiE;AACjE,2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,CAAC;SAElD;IAEH,CAAC;CAAA;AAzBD,wDAyBC;AAED,kBAAe,sBAAsB,CAAC"}
@@ -1,5 +1,7 @@
1
- import { convertNxGenerator } from '@nx/devkit';
2
- import generator from './generator';
3
- const schematic = convertNxGenerator(generator);
4
- export default schematic;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const generator_1 = require("./generator");
5
+ const schematic = (0, devkit_1.convertNxGenerator)(generator_1.default);
6
+ exports.default = schematic;
5
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,SAAS,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAChD,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/index.ts"],"names":[],"mappings":";;AAAA,uCAAgD;AAChD,2CAAoC;AAEpC,MAAM,SAAS,GAAG,IAAA,2BAAkB,EAAC,mBAAS,CAAC,CAAC;AAChD,kBAAe,SAAS,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export interface DocumentationGeneratorSchema {
2
+ openaiApiKey?: string;
2
3
  projects: string[];
3
4
  offline: boolean;
5
+ filter: string;
4
6
  }
@@ -15,6 +15,14 @@
15
15
  "offline": {
16
16
  "type": "boolean",
17
17
  "description": "If true, the openai api is not used"
18
+ },
19
+ "filter": {
20
+ "type": "string",
21
+ "description": "A filter to select the files to be processed"
22
+ },
23
+ "openaiApiKey": {
24
+ "type": "string",
25
+ "description": "The openai api key"
18
26
  }
19
27
  }
20
28
  }
@@ -1,61 +1,62 @@
1
- import { encode } from 'gpt-3-encoder';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SimplePrompt = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const gpt_3_encoder_1 = require("gpt-3-encoder");
2
6
  const tokenLimits = {
3
7
  'gpt-4': 8192,
4
8
  'gpt-3.5-turbo': 4096,
5
9
  'gpt-3.5-turbo-16k': 16384,
6
10
  };
7
- export async function SimplePrompt(systemPrompt, prompt, openai, options = {
11
+ function SimplePrompt(systemPrompt, prompt, openai, options = {
8
12
  max_tokens: 1024,
9
13
  model: 'gpt-4',
10
14
  }) {
11
- const systemPromptLength = encode(systemPrompt).length;
12
- const promptLength = encode(prompt).length;
13
- const inputLength = Math.floor((systemPromptLength + promptLength) * 1.1);
14
- options.model ??= 'gpt-4';
15
- options.max_tokens ??= 1024;
16
- if (!tokenLimits[options.model]) {
17
- throw new Error(`\x1b[31mModel '${options.model}' is not supported.\x1b[0m`);
18
- }
19
- const tokenLimit = tokenLimits[options.model];
20
- if (inputLength > tokenLimit * 0.8) {
21
- throw new Error(`\x1b[31mInput length (${inputLength}) is too large. It should be at most ${tokenLimit *
22
- 0.8}\x1b[0m`);
23
- }
24
- if (options.max_tokens) {
25
- if (options.max_tokens > tokenLimit - inputLength) {
26
- console.log(`\x1b[33mWarning: max_tokens (${options.max_tokens}) is too large. It should be at most ${tokenLimit -
27
- inputLength}\x1b[0m`);
28
- options.max_tokens = tokenLimit - inputLength;
15
+ var _a, _b, _c, _d;
16
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
17
+ const systemPromptLength = (0, gpt_3_encoder_1.encode)(systemPrompt).length;
18
+ const promptLength = (0, gpt_3_encoder_1.encode)(prompt).length;
19
+ const inputLength = Math.floor((systemPromptLength + promptLength) * 1.1);
20
+ (_a = options.model) !== null && _a !== void 0 ? _a : (options.model = 'gpt-4');
21
+ (_b = options.max_tokens) !== null && _b !== void 0 ? _b : (options.max_tokens = 1024);
22
+ if (!tokenLimits[options.model]) {
23
+ throw new Error(`\x1b[31mModel '${options.model}' is not supported.\x1b[0m`);
29
24
  }
30
- }
31
- let content;
32
- try {
33
- const response = await openai.createChatCompletion({
34
- ...options,
35
- messages: [
36
- {
37
- 'role': 'system',
38
- 'content': systemPrompt,
39
- },
40
- {
41
- 'role': 'user',
42
- 'content': prompt,
43
- },
44
- ],
45
- temperature: 0,
46
- top_p: 1,
47
- frequency_penalty: 0,
48
- presence_penalty: 0,
49
- });
50
- content = response.data.choices[0].message?.content;
51
- }
52
- catch (e) {
53
- console.log(e.response?.data);
54
- throw new Error('OpenAI API error: ' + e.message);
55
- }
56
- if (!content) {
57
- throw new Error(`\x1b[31mNo content in response for paper\x1b[0m`);
58
- }
59
- return content;
25
+ const tokenLimit = tokenLimits[options.model];
26
+ if (inputLength > tokenLimit * 0.8) {
27
+ throw new Error(`\x1b[31mInput length (${inputLength}) is too large. It should be at most ${tokenLimit *
28
+ 0.8}\x1b[0m`);
29
+ }
30
+ if (options.max_tokens) {
31
+ if (options.max_tokens > tokenLimit - inputLength) {
32
+ console.log(`\x1b[33mWarning: max_tokens (${options.max_tokens}) is too large. It should be at most ${tokenLimit -
33
+ inputLength}\x1b[0m`);
34
+ options.max_tokens = tokenLimit - inputLength;
35
+ }
36
+ }
37
+ let content;
38
+ try {
39
+ const response = yield openai.createChatCompletion(Object.assign(Object.assign({}, options), { messages: [
40
+ {
41
+ 'role': 'system',
42
+ 'content': systemPrompt,
43
+ },
44
+ {
45
+ 'role': 'user',
46
+ 'content': prompt,
47
+ },
48
+ ], temperature: 0, top_p: 1, frequency_penalty: 0, presence_penalty: 0 }));
49
+ content = (_c = response.data.choices[0].message) === null || _c === void 0 ? void 0 : _c.content;
50
+ }
51
+ catch (e) {
52
+ console.log((_d = e.response) === null || _d === void 0 ? void 0 : _d.data);
53
+ throw new Error('OpenAI API error: ' + e.message);
54
+ }
55
+ if (!content) {
56
+ throw new Error(`\x1b[31mNo content in response for paper\x1b[0m`);
57
+ }
58
+ return content;
59
+ });
60
60
  }
61
+ exports.SimplePrompt = SimplePrompt;
61
62
  //# sourceMappingURL=simple-prompt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"simple-prompt.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/simple-prompt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,MAAM,WAAW,GAAG;IAClB,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,IAAI;IACrB,mBAAmB,EAAE,KAAK;CAC3B,CAAC;AAOF,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,YAAoB,EACpB,MAAc,EACd,MAAiB,EACjB,UAA8B;IAC5B,UAAU,EAAE,IAAI;IAChB,KAAK,EAAE,OAAO;CACf;IAID,MAAM,kBAAkB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC;IACvD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;IAE3C,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,kBAAkB,GAAG,YAAY,CAAC,GAAG,GAAG,CAAC,CAAC;IAE1E,OAAO,CAAC,KAAK,KAAK,OAAO,CAAC;IAC1B,OAAO,CAAC,UAAU,KAAK,IAAI,CAAC;IAE5B,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,kBAAmB,OAAO,CAAC,KAAM,4BAA4B,CAAC,CAAC;KAChF;IAED,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAE9C,IAAI,WAAW,GAAG,UAAU,GAAG,GAAG,EAAE;QAClC,MAAM,IAAI,KAAK,CAAC,yBAA0B,WAAY,wCAAyC,UAAU;YACzG,GAAI,SAAS,CAAC,CAAC;KAChB;IAED,IAAI,OAAO,CAAC,UAAU,EAAE;QACtB,IAAI,OAAO,CAAC,UAAU,GAAG,UAAU,GAAG,WAAW,EAAE;YACjD,OAAO,CAAC,GAAG,CAAC,gCAAiC,OAAO,CAAC,UAAW,wCAAyC,UAAU;gBACnH,WAAY,SAAS,CAAC,CAAC;YACvB,OAAO,CAAC,UAAU,GAAG,UAAU,GAAG,WAAW,CAAC;SAC/C;KACF;IAED,IAAI,OAA2B,CAAC;IAEhC,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC;YACjD,GAAI,OAAe;YACnB,QAAQ,EAAE;gBACR;oBACE,MAAM,EAAE,QAAQ;oBAChB,SAAS,EAAE,YAAY;iBACxB;gBACD;oBACE,MAAM,EAAE,MAAM;oBACd,SAAS,EAAE,MAAM;iBAClB;aACF;YACD,WAAW,EAAE,CAAC;YACd,KAAK,EAAE,CAAC;YACR,iBAAiB,EAAE,CAAC;YACpB,gBAAgB,EAAE,CAAC;SACpB,CAAC,CAAC;QAEH,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC;KAErD;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;KACnD;IAED,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;KACpE;IAED,OAAO,OAAO,CAAC;AAEjB,CAAC"}
1
+ {"version":3,"file":"simple-prompt.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/simple-prompt.ts"],"names":[],"mappings":";;;;AACA,iDAAuC;AAEvC,MAAM,WAAW,GAAG;IAClB,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,IAAI;IACrB,mBAAmB,EAAE,KAAK;CAC3B,CAAC;AAOF,SAAsB,YAAY,CAChC,YAAoB,EACpB,MAAc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