@things-factory/codelingua 10.0.0-beta.6 → 10.0.0-beta.64

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 +30 -0
  2. package/dist-client/tsconfig.tsbuildinfo +1 -1
  3. package/dist-server/controllers/ai-client.d.ts +4 -0
  4. package/dist-server/controllers/ai-client.js +46 -0
  5. package/dist-server/controllers/ai-client.js.map +1 -0
  6. package/dist-server/controllers/decipher-error-code.js +30 -22
  7. package/dist-server/controllers/decipher-error-code.js.map +1 -1
  8. package/dist-server/controllers/i18n-completion.d.ts +3 -1
  9. package/dist-server/controllers/i18n-completion.js +27 -22
  10. package/dist-server/controllers/i18n-completion.js.map +1 -1
  11. package/dist-server/controllers/index.d.ts +2 -7
  12. package/dist-server/controllers/index.js +2 -7
  13. package/dist-server/controllers/index.js.map +1 -1
  14. package/dist-server/routes.js +5 -46
  15. package/dist-server/routes.js.map +1 -1
  16. package/dist-server/service/code-decipher/code-decipher-resolver.d.ts +0 -1
  17. package/dist-server/service/code-decipher/code-decipher-resolver.js +4 -20
  18. package/dist-server/service/code-decipher/code-decipher-resolver.js.map +1 -1
  19. package/dist-server/service/code-decipher/code-decipher-type.d.ts +3 -0
  20. package/dist-server/service/code-decipher/code-decipher-type.js.map +1 -1
  21. package/dist-server/service/code-decipher/index.d.ts +0 -2
  22. package/dist-server/service/code-decipher/index.js +1 -3
  23. package/dist-server/service/code-decipher/index.js.map +1 -1
  24. package/dist-server/service/i18n-completion/i18n-completion-resolver.js +5 -3
  25. package/dist-server/service/i18n-completion/i18n-completion-resolver.js.map +1 -1
  26. package/dist-server/service/i18n-completion/i18n-completion-type.d.ts +11 -0
  27. package/dist-server/service/i18n-completion/i18n-completion-type.js +8 -0
  28. package/dist-server/service/i18n-completion/i18n-completion-type.js.map +1 -1
  29. package/dist-server/service/index.d.ts +1 -1
  30. package/dist-server/service/index.js +1 -7
  31. package/dist-server/service/index.js.map +1 -1
  32. package/dist-server/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +6 -6
  34. package/dist-server/controllers/api-doc-completion.d.ts +0 -4
  35. package/dist-server/controllers/api-doc-completion.js +0 -32
  36. package/dist-server/controllers/api-doc-completion.js.map +0 -1
  37. package/dist-server/controllers/chat-completion.d.ts +0 -3
  38. package/dist-server/controllers/chat-completion.js +0 -31
  39. package/dist-server/controllers/chat-completion.js.map +0 -1
  40. package/dist-server/controllers/codereview-completion.d.ts +0 -1
  41. package/dist-server/controllers/codereview-completion.js +0 -40
  42. package/dist-server/controllers/codereview-completion.js.map +0 -1
  43. package/dist-server/controllers/decipher-code.d.ts +0 -5
  44. package/dist-server/controllers/decipher-code.js +0 -33
  45. package/dist-server/controllers/decipher-code.js.map +0 -1
  46. package/dist-server/controllers/image-completion.d.ts +0 -5
  47. package/dist-server/controllers/image-completion.js +0 -29
  48. package/dist-server/controllers/image-completion.js.map +0 -1
  49. package/dist-server/controllers/openai-connection.d.ts +0 -2
  50. package/dist-server/controllers/openai-connection.js +0 -16
  51. package/dist-server/controllers/openai-connection.js.map +0 -1
  52. package/dist-server/service/api-doc-completion/api-doc-completion-resolver.d.ts +0 -5
  53. package/dist-server/service/api-doc-completion/api-doc-completion-resolver.js +0 -31
  54. package/dist-server/service/api-doc-completion/api-doc-completion-resolver.js.map +0 -1
  55. package/dist-server/service/api-doc-completion/api-doc-completion-type.d.ts +0 -7
  56. package/dist-server/service/api-doc-completion/api-doc-completion-type.js +0 -30
  57. package/dist-server/service/api-doc-completion/api-doc-completion-type.js.map +0 -1
  58. package/dist-server/service/api-doc-completion/index.d.ts +0 -4
  59. package/dist-server/service/api-doc-completion/index.js +0 -8
  60. package/dist-server/service/api-doc-completion/index.js.map +0 -1
  61. package/dist-server/service/chat-completion/chat-completion-resolver.d.ts +0 -5
  62. package/dist-server/service/chat-completion/chat-completion-resolver.js +0 -30
  63. package/dist-server/service/chat-completion/chat-completion-resolver.js.map +0 -1
  64. package/dist-server/service/chat-completion/chat-completion-type.d.ts +0 -6
  65. package/dist-server/service/chat-completion/chat-completion-type.js +0 -26
  66. package/dist-server/service/chat-completion/chat-completion-type.js.map +0 -1
  67. package/dist-server/service/chat-completion/index.d.ts +0 -4
  68. package/dist-server/service/chat-completion/index.js +0 -8
  69. package/dist-server/service/chat-completion/index.js.map +0 -1
  70. package/dist-server/service/image-completion/image-completion-resolver.d.ts +0 -5
  71. package/dist-server/service/image-completion/image-completion-resolver.js +0 -30
  72. package/dist-server/service/image-completion/image-completion-resolver.js.map +0 -1
  73. package/dist-server/service/image-completion/image-completion-type.d.ts +0 -8
  74. package/dist-server/service/image-completion/image-completion-type.js +0 -34
  75. package/dist-server/service/image-completion/image-completion-type.js.map +0 -1
  76. package/dist-server/service/image-completion/index.d.ts +0 -4
  77. package/dist-server/service/image-completion/index.js +0 -8
  78. package/dist-server/service/image-completion/index.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/codelingua",
3
- "version": "10.0.0-beta.6",
3
+ "version": "10.0.0-beta.64",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -29,10 +29,10 @@
29
29
  "dependencies": {
30
30
  "@operato/graphql": "^10.0.0-beta.1",
31
31
  "@operato/shell": "^10.0.0-beta.1",
32
- "@things-factory/auth-base": "^10.0.0-beta.6",
33
- "@things-factory/env": "^10.0.0-beta.5",
34
- "@things-factory/shell": "^10.0.0-beta.6",
35
- "openai": "^4.0.0"
32
+ "@things-factory/ai-client-base": "^10.0.0-beta.64",
33
+ "@things-factory/auth-base": "^10.0.0-beta.57",
34
+ "@things-factory/env": "^10.0.0-beta.19",
35
+ "@things-factory/shell": "^10.0.0-beta.53"
36
36
  },
37
- "gitHead": "f8ec36e3a3ba4c0a1ebf6def7a9f379de1a49111"
37
+ "gitHead": "8a2729cb8c838ed8fc3c7921fa67f7279c2d13b1"
38
38
  }
@@ -1,4 +0,0 @@
1
- export declare function apiDocCompletion({ code, language }: {
2
- code: string;
3
- language?: string;
4
- }): Promise<string>;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.apiDocCompletion = apiDocCompletion;
4
- const openai_connection_1 = require("./openai-connection");
5
- async function apiDocCompletion({ code, language = 'en-US' }) {
6
- try {
7
- const completion = await openai_connection_1.client.chat.completions.create({
8
- model: 'gpt-3.5-turbo',
9
- messages: [
10
- {
11
- role: 'system',
12
- content: `You are an assistant that takes in JavaScript or TypeScript code and generates detailed developer documentation in markdown format.
13
- And you provides pure and direct data in response to user requests. The responses should contain no additional explanations or details.`
14
- },
15
- {
16
- role: 'user',
17
- content: `Here is some code: [${code}]. Can you help generate a detailed explanation and markdown documentation for this code?`
18
- },
19
- {
20
- role: 'assistant',
21
- content: `Please generate the documentation according to this locale code "${language}".`
22
- }
23
- ]
24
- });
25
- return completion.choices[0].message.content;
26
- }
27
- catch (error) {
28
- console.error(error);
29
- return 'The Code Lingua service is currently unavailable. Please contact your system administrator.';
30
- }
31
- }
32
- //# sourceMappingURL=api-doc-completion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-doc-completion.js","sourceRoot":"","sources":["../../server/controllers/api-doc-completion.ts"],"names":[],"mappings":";;AAEA,4CAgCC;AAlCD,2DAA4C;AAErC,KAAK,UAAU,gBAAgB,CAAC,EACrC,IAAI,EACJ,QAAQ,GAAG,OAAO,EAInB;IACC,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,0BAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;YACtD,KAAK,EAAE,eAAe;YACtB,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE;oJACiI;iBAC3I;gBACD;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE,uBAAuB,IAAI,2FAA2F;iBAChI;gBACD;oBACE,IAAI,EAAE,WAAW;oBACjB,OAAO,EAAE,oEAAoE,QAAQ,IAAI;iBAC1F;aACF;SACF,CAAC,CAAA;QAEF,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAA;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACpB,OAAO,6FAA6F,CAAA;IACtG,CAAC;AACH,CAAC","sourcesContent":["import { client } from './openai-connection'\n\nexport async function apiDocCompletion({\n code,\n language = 'en-US'\n}: {\n code: string\n language?: string\n}): Promise<string> {\n try {\n const completion = await client.chat.completions.create({\n model: 'gpt-3.5-turbo',\n messages: [\n {\n role: 'system',\n content: `You are an assistant that takes in JavaScript or TypeScript code and generates detailed developer documentation in markdown format.\n And you provides pure and direct data in response to user requests. The responses should contain no additional explanations or details.`\n },\n {\n role: 'user',\n content: `Here is some code: [${code}]. Can you help generate a detailed explanation and markdown documentation for this code?`\n },\n {\n role: 'assistant',\n content: `Please generate the documentation according to this locale code \"${language}\".`\n }\n ]\n })\n\n return completion.choices[0].message.content\n } catch (error) {\n console.error(error)\n return 'The Code Lingua service is currently unavailable. Please contact your system administrator.'\n }\n}\n"]}
@@ -1,3 +0,0 @@
1
- export declare function chatCompletion({ content }: {
2
- content: string;
3
- }): Promise<string>;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.chatCompletion = chatCompletion;
4
- const openai_connection_1 = require("./openai-connection");
5
- async function chatCompletion({ content }) {
6
- try {
7
- const completion = await openai_connection_1.client.chat.completions.create({
8
- model: 'gpt-3.5-turbo',
9
- messages: [
10
- {
11
- role: 'system',
12
- content: `You are an assistant that generates detailed information in response to user requests. And you provides pure and direct data in response to user requests. The responses should contain no additional explanations or details.`
13
- },
14
- {
15
- role: 'user',
16
- content
17
- },
18
- {
19
- role: 'assistant',
20
- content: 'Sure, please fetch the information in JSON format.'
21
- }
22
- ]
23
- });
24
- return completion.choices[0].message.content;
25
- }
26
- catch (error) {
27
- console.error(error);
28
- return 'The Code Lingua service is currently unavailable. Please contact your system administrator.';
29
- }
30
- }
31
- //# sourceMappingURL=chat-completion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chat-completion.js","sourceRoot":"","sources":["../../server/controllers/chat-completion.ts"],"names":[],"mappings":";;AAEA,wCAyBC;AA3BD,2DAA4C;AAErC,KAAK,UAAU,cAAc,CAAC,EAAE,OAAO,EAAuB;IACnE,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,0BAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;YACtD,KAAK,EAAE,eAAe;YACtB,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,gOAAgO;iBAC1O;gBACD;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO;iBACR;gBACD;oBACE,IAAI,EAAE,WAAW;oBACjB,OAAO,EAAE,oDAAoD;iBAC9D;aACF;SACF,CAAC,CAAA;QAEF,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAA;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACpB,OAAO,6FAA6F,CAAA;IACtG,CAAC;AACH,CAAC","sourcesContent":["import { client } from './openai-connection'\n\nexport async function chatCompletion({ content }: { content: string }): Promise<string> {\n try {\n const completion = await client.chat.completions.create({\n model: 'gpt-3.5-turbo',\n messages: [\n {\n role: 'system',\n content: `You are an assistant that generates detailed information in response to user requests. And you provides pure and direct data in response to user requests. The responses should contain no additional explanations or details.`\n },\n {\n role: 'user',\n content\n },\n {\n role: 'assistant',\n content: 'Sure, please fetch the information in JSON format.'\n }\n ]\n })\n\n return completion.choices[0].message.content\n } catch (error) {\n console.error(error)\n return 'The Code Lingua service is currently unavailable. Please contact your system administrator.'\n }\n}\n"]}
@@ -1 +0,0 @@
1
- export declare const codereviewCompletion: (codeDiff: string) => Promise<string>;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.codereviewCompletion = void 0;
4
- const openai_connection_1 = require("./openai-connection");
5
- const SYSTEM_MESSAGE = `You are an expert software engineer with a deep understanding of multiple programming languages, including Python, JavaScript, Java, and C++. Your role is to analyze, review, and provide insights on code snippets, highlighting potential issues, suggesting improvements, and explaining complex parts of the code. Respond in a clear, concise, and professional manner.
6
-
7
- Here's the code for analysis:
8
-
9
- <code snippet>
10
-
11
- Please provide:
12
- 1. An overall assessment of the code quality.
13
- 2. Identification of any potential bugs or issues.
14
- 3. Suggestions for improving the code.
15
- 4. An explanation of any complex or non-obvious parts of the code.
16
- `;
17
- const codereviewCompletion = async (codeDiff) => {
18
- try {
19
- const completion = await openai_connection_1.client.chat.completions.create({
20
- model: 'gpt-3.5-turbo',
21
- messages: [
22
- {
23
- role: 'system',
24
- content: SYSTEM_MESSAGE
25
- },
26
- {
27
- role: 'user',
28
- content: `Review the following code:\n\n${codeDiff}`
29
- }
30
- ]
31
- });
32
- return completion.choices[0].message.content;
33
- }
34
- catch (error) {
35
- console.error('Error fetching OpenAI review:', error);
36
- return 'The Code Lingua service is currently unavailable. Please contact your system administrator.';
37
- }
38
- };
39
- exports.codereviewCompletion = codereviewCompletion;
40
- //# sourceMappingURL=codereview-completion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codereview-completion.js","sourceRoot":"","sources":["../../server/controllers/codereview-completion.ts"],"names":[],"mappings":";;;AAAA,2DAA4C;AAE5C,MAAM,cAAc,GAAG;;;;;;;;;;;CAWtB,CAAA;AAEM,MAAM,oBAAoB,GAAG,KAAK,EAAE,QAAgB,EAAmB,EAAE;IAC9E,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,0BAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;YACtD,KAAK,EAAE,eAAe;YACtB,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,cAAc;iBACxB;gBACD;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE,iCAAiC,QAAQ,EAAE;iBACrD;aACF;SACF,CAAC,CAAA;QACF,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAA;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAA;QACrD,OAAO,6FAA6F,CAAA;IACtG,CAAC;AACH,CAAC,CAAA;AApBY,QAAA,oBAAoB,wBAoBhC","sourcesContent":["import { client } from './openai-connection'\n\nconst SYSTEM_MESSAGE = `You are an expert software engineer with a deep understanding of multiple programming languages, including Python, JavaScript, Java, and C++. Your role is to analyze, review, and provide insights on code snippets, highlighting potential issues, suggesting improvements, and explaining complex parts of the code. Respond in a clear, concise, and professional manner.\n\nHere's the code for analysis:\n\n<code snippet>\n\nPlease provide:\n1. An overall assessment of the code quality.\n2. Identification of any potential bugs or issues.\n3. Suggestions for improving the code.\n4. An explanation of any complex or non-obvious parts of the code.\n`\n\nexport const codereviewCompletion = async (codeDiff: string): Promise<string> => {\n try {\n const completion = await client.chat.completions.create({\n model: 'gpt-3.5-turbo',\n messages: [\n {\n role: 'system',\n content: SYSTEM_MESSAGE\n },\n {\n role: 'user',\n content: `Review the following code:\\n\\n${codeDiff}`\n }\n ]\n })\n return completion.choices[0].message.content\n } catch (error) {\n console.error('Error fetching OpenAI review:', error)\n return 'The Code Lingua service is currently unavailable. Please contact your system administrator.'\n }\n}\n"]}
@@ -1,5 +0,0 @@
1
- export declare function decipherCode({ code, system, language }: {
2
- code: string;
3
- system?: string;
4
- language?: string;
5
- }): Promise<string>;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decipherCode = decipherCode;
4
- const openai_connection_1 = require("./openai-connection");
5
- async function decipherCode({ code, system, language = 'en-US' }) {
6
- try {
7
- const completion = await openai_connection_1.client.chat.completions.create({
8
- model: 'gpt-3.5-turbo',
9
- messages: [
10
- {
11
- role: 'system',
12
- content: 'You are a helpful assistant that translates system messages into user-friendly explanations.'
13
- },
14
- {
15
- role: 'user',
16
- content: system
17
- ? `We received an message from the ${system} system. The message is: ${code}.`
18
- : `The message is: ${code}.`
19
- },
20
- {
21
- role: 'system',
22
- content: `Translate the explanation according to this locale code "${language}".`
23
- }
24
- ]
25
- });
26
- return completion.choices[0].message.content;
27
- }
28
- catch (error) {
29
- console.error(error);
30
- return 'The Code Lingua service is currently unavailable. Please contact your system administrator.';
31
- }
32
- }
33
- //# sourceMappingURL=decipher-code.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decipher-code.js","sourceRoot":"","sources":["../../server/controllers/decipher-code.ts"],"names":[],"mappings":";;AAEA,oCAmCC;AArCD,2DAA4C;AAErC,KAAK,UAAU,YAAY,CAAC,EACjC,IAAI,EACJ,MAAM,EACN,QAAQ,GAAG,OAAO,EAKnB;IACC,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,0BAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;YACtD,KAAK,EAAE,eAAe;YACtB,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,8FAA8F;iBACxG;gBACD;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE,MAAM;wBACb,CAAC,CAAC,mCAAmC,MAAM,4BAA4B,IAAI,GAAG;wBAC9E,CAAC,CAAC,mBAAmB,IAAI,GAAG;iBAC/B;gBACD;oBACE,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,4DAA4D,QAAQ,IAAI;iBAClF;aACF;SACF,CAAC,CAAA;QAEF,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAA;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACpB,OAAO,6FAA6F,CAAA;IACtG,CAAC;AACH,CAAC","sourcesContent":["import { client } from './openai-connection'\n\nexport async function decipherCode({\n code,\n system,\n language = 'en-US'\n}: {\n code: string\n system?: string\n language?: string\n}): Promise<string> {\n try {\n const completion = await client.chat.completions.create({\n model: 'gpt-3.5-turbo',\n messages: [\n {\n role: 'system',\n content: 'You are a helpful assistant that translates system messages into user-friendly explanations.'\n },\n {\n role: 'user',\n content: system\n ? `We received an message from the ${system} system. The message is: ${code}.`\n : `The message is: ${code}.`\n },\n {\n role: 'system',\n content: `Translate the explanation according to this locale code \"${language}\".`\n }\n ]\n })\n\n return completion.choices[0].message.content\n } catch (error) {\n console.error(error)\n return 'The Code Lingua service is currently unavailable. Please contact your system administrator.'\n }\n}\n"]}
@@ -1,5 +0,0 @@
1
- export declare function imageCompletion({ description, size, count }: {
2
- description: string;
3
- size: string;
4
- count: number;
5
- }): Promise<string>;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.imageCompletion = imageCompletion;
4
- const openai_connection_1 = require("./openai-connection");
5
- async function imageCompletion({ description, size = '1600x900', count }) {
6
- try {
7
- const todo = `[INFO: you can add images to reply by Markdown. Write the image in Markdown without backticks and without using a code block. Use the Unsplash API (https://source.unsplash.com/${size}/?<PUT YOUR QUERY HERE>). The query is just some tags that describes the image] ## DO NOT REPOND TO INFO BLOCK ##nnmy Next prompt is [INSERT]`;
8
- const content = `Give me ${count} pictures describing ${description}`;
9
- const completion = await openai_connection_1.client.chat.completions.create({
10
- model: 'gpt-3.5-turbo',
11
- messages: [
12
- {
13
- role: 'system',
14
- content: todo
15
- },
16
- {
17
- role: 'user',
18
- content /* like "Give me 5 pictures about airplane" */
19
- }
20
- ]
21
- });
22
- return completion.choices[0].message.content;
23
- }
24
- catch (error) {
25
- console.error(error);
26
- return 'The Code Lingua service is currently unavailable. Please contact your system administrator.';
27
- }
28
- }
29
- //# sourceMappingURL=image-completion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"image-completion.js","sourceRoot":"","sources":["../../server/controllers/image-completion.ts"],"names":[],"mappings":";;AAEA,0CAgCC;AAlCD,2DAA4C;AAErC,KAAK,UAAU,eAAe,CAAC,EACpC,WAAW,EACX,IAAI,GAAG,UAAU,EACjB,KAAK,EAKN;IACC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,mLAAmL,IAAI,+IAA+I,CAAA;QACnV,MAAM,OAAO,GAAG,WAAW,KAAK,wBAAwB,WAAW,EAAE,CAAA;QAErE,MAAM,UAAU,GAAG,MAAM,0BAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;YACtD,KAAK,EAAE,eAAe;YACtB,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,IAAI;iBACd;gBACD;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,CAAC,8CAA8C;iBACvD;aACF;SACF,CAAC,CAAA;QAEF,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAA;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACpB,OAAO,6FAA6F,CAAA;IACtG,CAAC;AACH,CAAC","sourcesContent":["import { client } from './openai-connection'\n\nexport async function imageCompletion({\n description,\n size = '1600x900',\n count\n}: {\n description: string\n size: string\n count: number\n}): Promise<string> {\n try {\n const todo = `[INFO: you can add images to reply by Markdown. Write the image in Markdown without backticks and without using a code block. Use the Unsplash API (https://source.unsplash.com/${size}/?<PUT YOUR QUERY HERE>). The query is just some tags that describes the image] ## DO NOT REPOND TO INFO BLOCK ##nnmy Next prompt is [INSERT]`\n const content = `Give me ${count} pictures describing ${description}`\n\n const completion = await client.chat.completions.create({\n model: 'gpt-3.5-turbo',\n messages: [\n {\n role: 'system',\n content: todo\n },\n {\n role: 'user',\n content /* like \"Give me 5 pictures about airplane\" */\n }\n ]\n })\n\n return completion.choices[0].message.content\n } catch (error) {\n console.error(error)\n return 'The Code Lingua service is currently unavailable. Please contact your system administrator.'\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
- import OpenAI from 'openai';
2
- export declare const client: OpenAI;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.client = void 0;
4
- const tslib_1 = require("tslib");
5
- const openai_1 = tslib_1.__importDefault(require("openai"));
6
- const env_1 = require("@things-factory/env");
7
- const OPENAI = env_1.config.get('openai', {});
8
- const { organization, apiKey } = OPENAI;
9
- if (!organization || !apiKey) {
10
- console.error("[ openai-connection@codelingua ] 'OPENAI_API_KEY' is not configured");
11
- }
12
- exports.client = new openai_1.default({
13
- organization,
14
- apiKey
15
- });
16
- //# sourceMappingURL=openai-connection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openai-connection.js","sourceRoot":"","sources":["../../server/controllers/openai-connection.ts"],"names":[],"mappings":";;;;AAAA,4DAA2B;AAC3B,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,CAAC;IAC7B,OAAO,CAAC,KAAK,CAAC,qEAAqE,CAAC,CAAA;AACtF,CAAC;AAEY,QAAA,MAAM,GAAG,IAAI,gBAAM,CAAC;IAC/B,YAAY;IACZ,MAAM;CACP,CAAC,CAAA","sourcesContent":["import OpenAI 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-connection@codelingua ] 'OPENAI_API_KEY' is not configured\")\n}\n\nexport const client = new OpenAI({\n organization,\n apiKey\n})\n"]}
@@ -1,5 +0,0 @@
1
- import '@things-factory/auth-base';
2
- import { APIDocCompletionInput, APIDocCompletionOutput } from './api-doc-completion-type';
3
- export declare class APIDocCompletionResolver {
4
- APIDocCompletion(input: APIDocCompletionInput, context: ResolverContext): Promise<APIDocCompletionOutput>;
5
- }
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.APIDocCompletionResolver = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- require("@things-factory/auth-base"); // for ResolverContext
7
- const api_doc_completion_type_1 = require("./api-doc-completion-type");
8
- const controllers_1 = require("../../controllers");
9
- let APIDocCompletionResolver = class APIDocCompletionResolver {
10
- async APIDocCompletion(input, context) {
11
- const { code, language: requestedLanguage } = input;
12
- const language = requestedLanguage || context.language;
13
- const message = await (0, controllers_1.apiDocCompletion)({ code, language });
14
- return {
15
- message
16
- };
17
- }
18
- };
19
- exports.APIDocCompletionResolver = APIDocCompletionResolver;
20
- tslib_1.__decorate([
21
- (0, type_graphql_1.Query)(() => api_doc_completion_type_1.APIDocCompletionOutput),
22
- tslib_1.__param(0, (0, type_graphql_1.Arg)('input')),
23
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
24
- tslib_1.__metadata("design:type", Function),
25
- tslib_1.__metadata("design:paramtypes", [api_doc_completion_type_1.APIDocCompletionInput, Object]),
26
- tslib_1.__metadata("design:returntype", Promise)
27
- ], APIDocCompletionResolver.prototype, "APIDocCompletion", null);
28
- exports.APIDocCompletionResolver = APIDocCompletionResolver = tslib_1.__decorate([
29
- (0, type_graphql_1.Resolver)()
30
- ], APIDocCompletionResolver);
31
- //# sourceMappingURL=api-doc-completion-resolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-doc-completion-resolver.js","sourceRoot":"","sources":["../../../server/service/api-doc-completion/api-doc-completion-resolver.ts"],"names":[],"mappings":";;;;AAAA,+CAAwD;AACxD,qCAAkC,CAAC,sBAAsB;AACzD,uEAAyF;AACzF,mDAAoD;AAG7C,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAE7B,AAAN,KAAK,CAAC,gBAAgB,CACN,KAA4B,EACnC,OAAwB;QAE/B,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAA;QACnD,MAAM,QAAQ,GAAG,iBAAiB,IAAI,OAAO,CAAC,QAAQ,CAAA;QAEtD,MAAM,OAAO,GAAG,MAAM,IAAA,8BAAgB,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;QAE1D,OAAO;YACL,OAAO;SACR,CAAA;IACH,CAAC;CACF,CAAA;AAfY,4DAAwB;AAE7B;IADL,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,gDAAsB,CAAC;IAEjC,mBAAA,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAA;IACZ,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CADe,+CAAqB;;gEAW3C;mCAdU,wBAAwB;IADpC,IAAA,uBAAQ,GAAE;GACE,wBAAwB,CAepC","sourcesContent":["import { Resolver, Query, Arg, Ctx } from 'type-graphql'\nimport '@things-factory/auth-base' // for ResolverContext\nimport { APIDocCompletionInput, APIDocCompletionOutput } from './api-doc-completion-type'\nimport { apiDocCompletion } from '../../controllers'\n\n@Resolver()\nexport class APIDocCompletionResolver {\n @Query(() => APIDocCompletionOutput)\n async APIDocCompletion(\n @Arg('input') input: APIDocCompletionInput,\n @Ctx() context: ResolverContext\n ): Promise<APIDocCompletionOutput> {\n const { code, language: requestedLanguage } = input\n const language = requestedLanguage || context.language\n\n const message = await apiDocCompletion({ code, language })\n\n return {\n message\n }\n }\n}\n"]}
@@ -1,7 +0,0 @@
1
- export declare class APIDocCompletionInput {
2
- code: string;
3
- language?: string;
4
- }
5
- export declare class APIDocCompletionOutput {
6
- message?: string;
7
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.APIDocCompletionOutput = exports.APIDocCompletionInput = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- let APIDocCompletionInput = class APIDocCompletionInput {
7
- };
8
- exports.APIDocCompletionInput = APIDocCompletionInput;
9
- tslib_1.__decorate([
10
- (0, type_graphql_1.Field)(),
11
- tslib_1.__metadata("design:type", String)
12
- ], APIDocCompletionInput.prototype, "code", void 0);
13
- tslib_1.__decorate([
14
- (0, type_graphql_1.Field)({ nullable: true }),
15
- tslib_1.__metadata("design:type", String)
16
- ], APIDocCompletionInput.prototype, "language", void 0);
17
- exports.APIDocCompletionInput = APIDocCompletionInput = tslib_1.__decorate([
18
- (0, type_graphql_1.InputType)()
19
- ], APIDocCompletionInput);
20
- let APIDocCompletionOutput = class APIDocCompletionOutput {
21
- };
22
- exports.APIDocCompletionOutput = APIDocCompletionOutput;
23
- tslib_1.__decorate([
24
- (0, type_graphql_1.Field)({ nullable: true }),
25
- tslib_1.__metadata("design:type", String)
26
- ], APIDocCompletionOutput.prototype, "message", void 0);
27
- exports.APIDocCompletionOutput = APIDocCompletionOutput = tslib_1.__decorate([
28
- (0, type_graphql_1.ObjectType)()
29
- ], APIDocCompletionOutput);
30
- //# sourceMappingURL=api-doc-completion-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-doc-completion-type.js","sourceRoot":"","sources":["../../../server/service/api-doc-completion/api-doc-completion-type.ts"],"names":[],"mappings":";;;;AAAA,+CAA2D;AAGpD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;CAMjC,CAAA;AANY,sDAAqB;AAEhC;IADC,IAAA,oBAAK,GAAE;;mDACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACT;gCALN,qBAAqB;IADjC,IAAA,wBAAS,GAAE;GACC,qBAAqB,CAMjC;AAGM,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;CAGlC,CAAA;AAHY,wDAAsB;AAEjC;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACV;iCAFL,sBAAsB;IADlC,IAAA,yBAAU,GAAE;GACA,sBAAsB,CAGlC","sourcesContent":["import { ObjectType, Field, InputType } from 'type-graphql'\n\n@InputType()\nexport class APIDocCompletionInput {\n @Field()\n code: string\n\n @Field({ nullable: true })\n language?: string\n}\n\n@ObjectType()\nexport class APIDocCompletionOutput {\n @Field({ nullable: true })\n message?: string\n}\n"]}
@@ -1,4 +0,0 @@
1
- import { APIDocCompletionResolver } from './api-doc-completion-resolver';
2
- export declare const entities: any[];
3
- export declare const resolvers: (typeof APIDocCompletionResolver)[];
4
- export declare const subscribers: any[];
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.subscribers = exports.resolvers = exports.entities = void 0;
4
- const api_doc_completion_resolver_1 = require("./api-doc-completion-resolver");
5
- exports.entities = [];
6
- exports.resolvers = [api_doc_completion_resolver_1.APIDocCompletionResolver];
7
- exports.subscribers = [];
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/api-doc-completion/index.ts"],"names":[],"mappings":";;;AAAA,+EAAwE;AAE3D,QAAA,QAAQ,GAAG,EAAE,CAAA;AACb,QAAA,SAAS,GAAG,CAAC,sDAAwB,CAAC,CAAA;AACtC,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { APIDocCompletionResolver } from './api-doc-completion-resolver'\n\nexport const entities = []\nexport const resolvers = [APIDocCompletionResolver]\nexport const subscribers = []\n"]}
@@ -1,5 +0,0 @@
1
- import '@things-factory/auth-base';
2
- import { ChatCompletionInput, ChatCompletionOutput } from './chat-completion-type';
3
- export declare class ChatCompletionResolver {
4
- chatCompletion(input: ChatCompletionInput, context: ResolverContext): Promise<ChatCompletionOutput>;
5
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChatCompletionResolver = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- require("@things-factory/auth-base"); // for ResolverContext
7
- const chat_completion_type_1 = require("./chat-completion-type");
8
- const controllers_1 = require("../../controllers");
9
- let ChatCompletionResolver = class ChatCompletionResolver {
10
- async chatCompletion(input, context) {
11
- const { content } = input;
12
- const message = await (0, controllers_1.chatCompletion)({ content });
13
- return {
14
- message
15
- };
16
- }
17
- };
18
- exports.ChatCompletionResolver = ChatCompletionResolver;
19
- tslib_1.__decorate([
20
- (0, type_graphql_1.Query)(() => chat_completion_type_1.ChatCompletionOutput),
21
- tslib_1.__param(0, (0, type_graphql_1.Arg)('input')),
22
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
23
- tslib_1.__metadata("design:type", Function),
24
- tslib_1.__metadata("design:paramtypes", [chat_completion_type_1.ChatCompletionInput, Object]),
25
- tslib_1.__metadata("design:returntype", Promise)
26
- ], ChatCompletionResolver.prototype, "chatCompletion", null);
27
- exports.ChatCompletionResolver = ChatCompletionResolver = tslib_1.__decorate([
28
- (0, type_graphql_1.Resolver)()
29
- ], ChatCompletionResolver);
30
- //# sourceMappingURL=chat-completion-resolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chat-completion-resolver.js","sourceRoot":"","sources":["../../../server/service/chat-completion/chat-completion-resolver.ts"],"names":[],"mappings":";;;;AAAA,+CAAwD;AACxD,qCAAkC,CAAC,sBAAsB;AACzD,iEAAkF;AAClF,mDAAkD;AAG3C,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAE3B,AAAN,KAAK,CAAC,cAAc,CACJ,KAA0B,EACjC,OAAwB;QAE/B,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAA;QAEzB,MAAM,OAAO,GAAG,MAAM,IAAA,4BAAc,EAAC,EAAE,OAAO,EAAE,CAAC,CAAA;QAEjD,OAAO;YACL,OAAO;SACR,CAAA;IACH,CAAC;CACF,CAAA;AAdY,wDAAsB;AAE3B;IADL,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,2CAAoB,CAAC;IAE/B,mBAAA,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAA;IACZ,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CADe,0CAAmB;;4DAUzC;iCAbU,sBAAsB;IADlC,IAAA,uBAAQ,GAAE;GACE,sBAAsB,CAclC","sourcesContent":["import { Resolver, Query, Arg, Ctx } from 'type-graphql'\nimport '@things-factory/auth-base' // for ResolverContext\nimport { ChatCompletionInput, ChatCompletionOutput } from './chat-completion-type'\nimport { chatCompletion } from '../../controllers'\n\n@Resolver()\nexport class ChatCompletionResolver {\n @Query(() => ChatCompletionOutput)\n async chatCompletion(\n @Arg('input') input: ChatCompletionInput,\n @Ctx() context: ResolverContext\n ): Promise<ChatCompletionOutput> {\n const { content } = input\n\n const message = await chatCompletion({ content })\n\n return {\n message\n }\n }\n}\n"]}
@@ -1,6 +0,0 @@
1
- export declare class ChatCompletionInput {
2
- content: string;
3
- }
4
- export declare class ChatCompletionOutput {
5
- message?: string;
6
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChatCompletionOutput = exports.ChatCompletionInput = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- let ChatCompletionInput = class ChatCompletionInput {
7
- };
8
- exports.ChatCompletionInput = ChatCompletionInput;
9
- tslib_1.__decorate([
10
- (0, type_graphql_1.Field)(),
11
- tslib_1.__metadata("design:type", String)
12
- ], ChatCompletionInput.prototype, "content", void 0);
13
- exports.ChatCompletionInput = ChatCompletionInput = tslib_1.__decorate([
14
- (0, type_graphql_1.InputType)()
15
- ], ChatCompletionInput);
16
- let ChatCompletionOutput = class ChatCompletionOutput {
17
- };
18
- exports.ChatCompletionOutput = ChatCompletionOutput;
19
- tslib_1.__decorate([
20
- (0, type_graphql_1.Field)({ nullable: true }),
21
- tslib_1.__metadata("design:type", String)
22
- ], ChatCompletionOutput.prototype, "message", void 0);
23
- exports.ChatCompletionOutput = ChatCompletionOutput = tslib_1.__decorate([
24
- (0, type_graphql_1.ObjectType)()
25
- ], ChatCompletionOutput);
26
- //# sourceMappingURL=chat-completion-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chat-completion-type.js","sourceRoot":"","sources":["../../../server/service/chat-completion/chat-completion-type.ts"],"names":[],"mappings":";;;;AAAA,+CAA2D;AAGpD,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;CAG/B,CAAA;AAHY,kDAAmB;AAE9B;IADC,IAAA,oBAAK,GAAE;;oDACO;8BAFJ,mBAAmB;IAD/B,IAAA,wBAAS,GAAE;GACC,mBAAmB,CAG/B;AAGM,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAGhC,CAAA;AAHY,oDAAoB;AAE/B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACV;+BAFL,oBAAoB;IADhC,IAAA,yBAAU,GAAE;GACA,oBAAoB,CAGhC","sourcesContent":["import { ObjectType, Field, InputType } from 'type-graphql'\n\n@InputType()\nexport class ChatCompletionInput {\n @Field()\n content: string\n}\n\n@ObjectType()\nexport class ChatCompletionOutput {\n @Field({ nullable: true })\n message?: string\n}\n"]}
@@ -1,4 +0,0 @@
1
- import { ChatCompletionResolver } from './chat-completion-resolver';
2
- export declare const entities: any[];
3
- export declare const resolvers: (typeof ChatCompletionResolver)[];
4
- export declare const subscribers: any[];
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.subscribers = exports.resolvers = exports.entities = void 0;
4
- const chat_completion_resolver_1 = require("./chat-completion-resolver");
5
- exports.entities = [];
6
- exports.resolvers = [chat_completion_resolver_1.ChatCompletionResolver];
7
- exports.subscribers = [];
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/chat-completion/index.ts"],"names":[],"mappings":";;;AAAA,yEAAmE;AAEtD,QAAA,QAAQ,GAAG,EAAE,CAAA;AACb,QAAA,SAAS,GAAG,CAAC,iDAAsB,CAAC,CAAA;AACpC,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { ChatCompletionResolver } from './chat-completion-resolver'\n\nexport const entities = []\nexport const resolvers = [ChatCompletionResolver]\nexport const subscribers = []\n"]}
@@ -1,5 +0,0 @@
1
- import '@things-factory/auth-base';
2
- import { ImageCompletionInput, ImageCompletionOutput } from './image-completion-type';
3
- export declare class ImageCompletionResolver {
4
- imageCompletion(input: ImageCompletionInput, context: ResolverContext): Promise<ImageCompletionOutput>;
5
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ImageCompletionResolver = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- require("@things-factory/auth-base"); // for ResolverContext
7
- const image_completion_type_1 = require("./image-completion-type");
8
- const controllers_1 = require("../../controllers");
9
- let ImageCompletionResolver = class ImageCompletionResolver {
10
- async imageCompletion(input, context) {
11
- const { description, count, size } = input;
12
- const images = await (0, controllers_1.imageCompletion)({ description, count, size });
13
- return {
14
- images
15
- };
16
- }
17
- };
18
- exports.ImageCompletionResolver = ImageCompletionResolver;
19
- tslib_1.__decorate([
20
- (0, type_graphql_1.Query)(() => image_completion_type_1.ImageCompletionOutput),
21
- tslib_1.__param(0, (0, type_graphql_1.Arg)('input')),
22
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
23
- tslib_1.__metadata("design:type", Function),
24
- tslib_1.__metadata("design:paramtypes", [image_completion_type_1.ImageCompletionInput, Object]),
25
- tslib_1.__metadata("design:returntype", Promise)
26
- ], ImageCompletionResolver.prototype, "imageCompletion", null);
27
- exports.ImageCompletionResolver = ImageCompletionResolver = tslib_1.__decorate([
28
- (0, type_graphql_1.Resolver)()
29
- ], ImageCompletionResolver);
30
- //# sourceMappingURL=image-completion-resolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"image-completion-resolver.js","sourceRoot":"","sources":["../../../server/service/image-completion/image-completion-resolver.ts"],"names":[],"mappings":";;;;AAAA,+CAAwD;AACxD,qCAAkC,CAAC,sBAAsB;AACzD,mEAAqF;AACrF,mDAAmD;AAG5C,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAE5B,AAAN,KAAK,CAAC,eAAe,CACL,KAA2B,EAClC,OAAwB;QAE/B,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,6BAAe,EAAC,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QAElE,OAAO;YACL,MAAM;SACP,CAAA;IACH,CAAC;CACF,CAAA;AAdY,0DAAuB;AAE5B;IADL,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,6CAAqB,CAAC;IAEhC,mBAAA,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAA;IACZ,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CADe,4CAAoB;;8DAU1C;kCAbU,uBAAuB;IADnC,IAAA,uBAAQ,GAAE;GACE,uBAAuB,CAcnC","sourcesContent":["import { Resolver, Query, Arg, Ctx } from 'type-graphql'\nimport '@things-factory/auth-base' // for ResolverContext\nimport { ImageCompletionInput, ImageCompletionOutput } from './image-completion-type'\nimport { imageCompletion } from '../../controllers'\n\n@Resolver()\nexport class ImageCompletionResolver {\n @Query(() => ImageCompletionOutput)\n async imageCompletion(\n @Arg('input') input: ImageCompletionInput,\n @Ctx() context: ResolverContext\n ): Promise<ImageCompletionOutput> {\n const { description, count, size } = input\n\n const images = await imageCompletion({ description, count, size })\n\n return {\n images\n }\n }\n}\n"]}
@@ -1,8 +0,0 @@
1
- export declare class ImageCompletionInput {
2
- description: string;
3
- size: string;
4
- count: number;
5
- }
6
- export declare class ImageCompletionOutput {
7
- images?: string;
8
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ImageCompletionOutput = exports.ImageCompletionInput = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- let ImageCompletionInput = class ImageCompletionInput {
7
- };
8
- exports.ImageCompletionInput = ImageCompletionInput;
9
- tslib_1.__decorate([
10
- (0, type_graphql_1.Field)(),
11
- tslib_1.__metadata("design:type", String)
12
- ], ImageCompletionInput.prototype, "description", void 0);
13
- tslib_1.__decorate([
14
- (0, type_graphql_1.Field)(),
15
- tslib_1.__metadata("design:type", String)
16
- ], ImageCompletionInput.prototype, "size", void 0);
17
- tslib_1.__decorate([
18
- (0, type_graphql_1.Field)(),
19
- tslib_1.__metadata("design:type", Number)
20
- ], ImageCompletionInput.prototype, "count", void 0);
21
- exports.ImageCompletionInput = ImageCompletionInput = tslib_1.__decorate([
22
- (0, type_graphql_1.InputType)()
23
- ], ImageCompletionInput);
24
- let ImageCompletionOutput = class ImageCompletionOutput {
25
- };
26
- exports.ImageCompletionOutput = ImageCompletionOutput;
27
- tslib_1.__decorate([
28
- (0, type_graphql_1.Field)({ nullable: true }),
29
- tslib_1.__metadata("design:type", String)
30
- ], ImageCompletionOutput.prototype, "images", void 0);
31
- exports.ImageCompletionOutput = ImageCompletionOutput = tslib_1.__decorate([
32
- (0, type_graphql_1.ObjectType)()
33
- ], ImageCompletionOutput);
34
- //# sourceMappingURL=image-completion-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"image-completion-type.js","sourceRoot":"","sources":["../../../server/service/image-completion/image-completion-type.ts"],"names":[],"mappings":";;;;AAAA,+CAA2D;AAGpD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAShC,CAAA;AATY,oDAAoB;AAE/B;IADC,IAAA,oBAAK,GAAE;;yDACW;AAGnB;IADC,IAAA,oBAAK,GAAE;;kDACI;AAGZ;IADC,IAAA,oBAAK,GAAE;;mDACK;+BARF,oBAAoB;IADhC,IAAA,wBAAS,GAAE;GACC,oBAAoB,CAShC;AAGM,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;CAGjC,CAAA;AAHY,sDAAqB;AAEhC;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACX;gCAFJ,qBAAqB;IADjC,IAAA,yBAAU,GAAE;GACA,qBAAqB,CAGjC","sourcesContent":["import { ObjectType, Field, InputType } from 'type-graphql'\n\n@InputType()\nexport class ImageCompletionInput {\n @Field()\n description: string\n\n @Field()\n size: string /* like \"800x600\" */\n\n @Field()\n count: number\n}\n\n@ObjectType()\nexport class ImageCompletionOutput {\n @Field({ nullable: true })\n images?: string\n}\n"]}
@@ -1,4 +0,0 @@
1
- import { ImageCompletionResolver } from './image-completion-resolver';
2
- export declare const entities: any[];
3
- export declare const resolvers: (typeof ImageCompletionResolver)[];
4
- export declare const subscribers: any[];
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.subscribers = exports.resolvers = exports.entities = void 0;
4
- const image_completion_resolver_1 = require("./image-completion-resolver");
5
- exports.entities = [];
6
- exports.resolvers = [image_completion_resolver_1.ImageCompletionResolver];
7
- exports.subscribers = [];
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/image-completion/index.ts"],"names":[],"mappings":";;;AAAA,2EAAqE;AAExD,QAAA,QAAQ,GAAG,EAAE,CAAA;AACb,QAAA,SAAS,GAAG,CAAC,mDAAuB,CAAC,CAAA;AACrC,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { ImageCompletionResolver } from './image-completion-resolver'\n\nexport const entities = []\nexport const resolvers = [ImageCompletionResolver]\nexport const subscribers = []\n"]}