@intlayer/backend 3.5.6 → 3.5.7

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 (48) hide show
  1. package/dist/cjs/controllers/ai.controller.cjs +16 -0
  2. package/dist/cjs/controllers/ai.controller.cjs.map +1 -1
  3. package/dist/cjs/routes/ai.routes.cjs +6 -0
  4. package/dist/cjs/routes/ai.routes.cjs.map +1 -1
  5. package/dist/cjs/services/dictionary.service.cjs +0 -1
  6. package/dist/cjs/services/dictionary.service.cjs.map +1 -1
  7. package/dist/cjs/services/project.service.cjs +0 -1
  8. package/dist/cjs/services/project.service.cjs.map +1 -1
  9. package/dist/cjs/utils/AI/askDocQuestion.cjs +185 -0
  10. package/dist/cjs/utils/AI/askDocQuestion.cjs.map +1 -0
  11. package/dist/cjs/utils/AI/embeddings.json +150583 -0
  12. package/dist/cjs/utils/auditDictionaryField/index.cjs +0 -1
  13. package/dist/cjs/utils/auditDictionaryField/index.cjs.map +1 -1
  14. package/dist/cjs/utils/auditDictionaryMetadata/index.cjs +0 -2
  15. package/dist/cjs/utils/auditDictionaryMetadata/index.cjs.map +1 -1
  16. package/dist/cjs/utils/auditTag/index.cjs +0 -2
  17. package/dist/cjs/utils/auditTag/index.cjs.map +1 -1
  18. package/dist/esm/controllers/ai.controller.mjs +15 -0
  19. package/dist/esm/controllers/ai.controller.mjs.map +1 -1
  20. package/dist/esm/routes/ai.routes.mjs +7 -0
  21. package/dist/esm/routes/ai.routes.mjs.map +1 -1
  22. package/dist/esm/services/dictionary.service.mjs +0 -1
  23. package/dist/esm/services/dictionary.service.mjs.map +1 -1
  24. package/dist/esm/services/project.service.mjs +0 -1
  25. package/dist/esm/services/project.service.mjs.map +1 -1
  26. package/dist/esm/utils/AI/askDocQuestion.mjs +148 -0
  27. package/dist/esm/utils/AI/askDocQuestion.mjs.map +1 -0
  28. package/dist/esm/utils/AI/embeddings.json +150583 -0
  29. package/dist/esm/utils/auditDictionaryField/index.mjs +0 -1
  30. package/dist/esm/utils/auditDictionaryField/index.mjs.map +1 -1
  31. package/dist/esm/utils/auditDictionaryMetadata/index.mjs +0 -2
  32. package/dist/esm/utils/auditDictionaryMetadata/index.mjs.map +1 -1
  33. package/dist/esm/utils/auditTag/index.mjs +0 -2
  34. package/dist/esm/utils/auditTag/index.mjs.map +1 -1
  35. package/dist/types/controllers/ai.controller.d.ts +6 -0
  36. package/dist/types/controllers/ai.controller.d.ts.map +1 -1
  37. package/dist/types/routes/ai.routes.d.ts +5 -0
  38. package/dist/types/routes/ai.routes.d.ts.map +1 -1
  39. package/dist/types/services/dictionary.service.d.ts.map +1 -1
  40. package/dist/types/services/project.service.d.ts.map +1 -1
  41. package/dist/types/utils/AI/askDocQuestion.d.ts +38 -0
  42. package/dist/types/utils/AI/askDocQuestion.d.ts.map +1 -0
  43. package/dist/types/utils/auditDictionaryField/index.d.ts.map +1 -1
  44. package/dist/types/utils/auditDictionaryMetadata/index.d.ts.map +1 -1
  45. package/dist/types/utils/auditTag/index.d.ts.map +1 -1
  46. package/package.json +11 -9
  47. package/dist/types/utils/audit/index.d.ts +0 -28
  48. package/dist/types/utils/audit/index.d.ts.map +0 -1
@@ -41,7 +41,6 @@ const auditDictionaryField = async ({
41
41
  logger.info(
42
42
  `${chatCompletion.usage?.total_tokens} tokens used in the request`
43
43
  );
44
- console.log("newContent", newContent);
45
44
  return {
46
45
  fileContent: newContent ?? "",
47
46
  tokenUsed: chatCompletion.usage?.total_tokens ?? 0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/utils/auditDictionaryField/index.ts"],"sourcesContent":["import { readFileSync } from 'fs';\nimport { dirname, join } from 'path';\nimport { fileURLToPath } from 'url';\nimport { getLocaleName, type KeyPath } from '@intlayer/core';\nimport { logger } from '@logger';\nimport { Locales } from 'intlayer';\nimport { OpenAI } from 'openai';\nimport { Tag } from '@/types/tag.types';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport type AuditDictionaryFieldOptions = {\n locales: Locales[];\n fileContent: string;\n model?: string;\n openAiApiKey: string;\n customPrompt?: string;\n keyPath: KeyPath[];\n tags?: Tag[];\n};\nexport type AuditDictionaryFieldResultData = {\n fileContent: string;\n tokenUsed: number;\n};\n\n/**\n * Reads the content of a file synchronously.\n *\n * @function\n * @param relativeFilePath - The relative or absolute path to the target file.\n * @returns The entire contents of the specified file as a UTF-8 encoded string.\n */\nconst getFileContent = (relativeFilePath: string): string => {\n const absolutePath = join(__dirname, relativeFilePath);\n const fileContent = readFileSync(absolutePath, 'utf-8');\n return fileContent;\n};\n\n// The prompt template to send to ChatGPT, requesting an audit of content declaration files.\nconst CHAT_GPT_PROMPT = getFileContent('./PROMPT.md');\n\n/**\n * Formats a locale with its full name and returns a string representation.\n *\n * @function\n * @param locale - A locale from the project's configuration (e.g., 'en-US', 'fr-FR').\n * @returns A formatted string combining the locale's name and code. Example: \"English (US): en-US\".\n */\nconst formatLocaleWithName = (locale: Locales): string => {\n // getLocaleName returns a human-readable name for the locale.\n const localeName = getLocaleName(locale);\n\n // Concatenate both the readable name and the locale code.\n return `${locale}: ${localeName}`;\n};\n\n/**\n * Formats an array of tags with their keys and instructions.\n *\n * @function\n * @param tags - An array of tags from the project's configuration.\n * @returns A string representation of the tags, with their keys and instructions.\n */\nconst formatTagInstructions = (tags: Tag[] = []) =>\n tags.map((tag) => `- ${tag.key}: ${tag.instructions}`).join('\\n\\n');\n\n/**\n * Audits a content declaration file by constructing a prompt for ChatGPT.\n * The prompt includes details about the project's locales, file paths of content declarations,\n * and requests for identifying issues or inconsistencies. It prints the prompt for each file,\n * and could be adapted to send requests to the ChatGPT model.\n */\nexport const auditDictionaryField = async ({\n fileContent,\n model,\n openAiApiKey,\n customPrompt,\n locales,\n keyPath,\n tags,\n}: AuditDictionaryFieldOptions): Promise<\n AuditDictionaryFieldResultData | undefined\n> => {\n try {\n // Optionally, you could initialize and configure the OpenAI client here, if you intend to make API calls.\n // Uncomment and configure the following lines if you have `openai` installed and want to call the API:\n\n const openai = new OpenAI({\n apiKey: openAiApiKey,\n });\n\n // Prepare the prompt for ChatGPT by replacing placeholders with actual values.\n const prompt =\n customPrompt ??\n CHAT_GPT_PROMPT.replace(\n '{{otherLocales}}',\n `{${locales.map(formatLocaleWithName).join(', ')}}`\n )\n .replace('{{keyPath}}', JSON.stringify(keyPath))\n .replace('{{fileContent}}', fileContent)\n .replace('{{tagsInstructions}}', formatTagInstructions(tags));\n\n // Example of how you might request a completion from ChatGPT:\n const chatCompletion = await openai.chat.completions.create({\n model: model ?? 'gpt-4o-mini',\n messages: [{ role: 'system', content: prompt }],\n });\n\n const newContent = chatCompletion.choices[0].message?.content;\n\n logger.info(\n `${chatCompletion.usage?.total_tokens} tokens used in the request`\n );\n\n console.log('newContent', newContent);\n\n return {\n fileContent: newContent ?? '',\n tokenUsed: chatCompletion.usage?.total_tokens ?? 0,\n };\n } catch (error) {\n console.error(error);\n }\n};\n"],"mappings":"AAAA,SAAS,oBAAoB;AAC7B,SAAS,SAAS,YAAY;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,qBAAmC;AAC5C,SAAS,cAAc;AAEvB,SAAS,cAAc;AAGvB,MAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AAuBxD,MAAM,iBAAiB,CAAC,qBAAqC;AAC3D,QAAM,eAAe,KAAK,WAAW,gBAAgB;AACrD,QAAM,cAAc,aAAa,cAAc,OAAO;AACtD,SAAO;AACT;AAGA,MAAM,kBAAkB,eAAe,aAAa;AASpD,MAAM,uBAAuB,CAAC,WAA4B;AAExD,QAAM,aAAa,cAAc,MAAM;AAGvC,SAAO,GAAG,MAAM,KAAK,UAAU;AACjC;AASA,MAAM,wBAAwB,CAAC,OAAc,CAAC,MAC5C,KAAK,IAAI,CAAC,QAAQ,KAAK,IAAI,GAAG,KAAK,IAAI,YAAY,EAAE,EAAE,KAAK,MAAM;AAQ7D,MAAM,uBAAuB,OAAO;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAEK;AACH,MAAI;AAIF,UAAM,SAAS,IAAI,OAAO;AAAA,MACxB,QAAQ;AAAA,IACV,CAAC;AAGD,UAAM,SACJ,gBACA,gBAAgB;AAAA,MACd;AAAA,MACA,IAAI,QAAQ,IAAI,oBAAoB,EAAE,KAAK,IAAI,CAAC;AAAA,IAClD,EACG,QAAQ,eAAe,KAAK,UAAU,OAAO,CAAC,EAC9C,QAAQ,mBAAmB,WAAW,EACtC,QAAQ,wBAAwB,sBAAsB,IAAI,CAAC;AAGhE,UAAM,iBAAiB,MAAM,OAAO,KAAK,YAAY,OAAO;AAAA,MAC1D,OAAO,SAAS;AAAA,MAChB,UAAU,CAAC,EAAE,MAAM,UAAU,SAAS,OAAO,CAAC;AAAA,IAChD,CAAC;AAED,UAAM,aAAa,eAAe,QAAQ,CAAC,EAAE,SAAS;AAEtD,WAAO;AAAA,MACL,GAAG,eAAe,OAAO,YAAY;AAAA,IACvC;AAEA,YAAQ,IAAI,cAAc,UAAU;AAEpC,WAAO;AAAA,MACL,aAAa,cAAc;AAAA,MAC3B,WAAW,eAAe,OAAO,gBAAgB;AAAA,IACnD;AAAA,EACF,SAAS,OAAO;AACd,YAAQ,MAAM,KAAK;AAAA,EACrB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/utils/auditDictionaryField/index.ts"],"sourcesContent":["import { readFileSync } from 'fs';\nimport { dirname, join } from 'path';\nimport { fileURLToPath } from 'url';\nimport { getLocaleName, type KeyPath } from '@intlayer/core';\nimport { logger } from '@logger';\nimport { Locales } from 'intlayer';\nimport { OpenAI } from 'openai';\nimport { Tag } from '@/types/tag.types';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport type AuditDictionaryFieldOptions = {\n locales: Locales[];\n fileContent: string;\n model?: string;\n openAiApiKey: string;\n customPrompt?: string;\n keyPath: KeyPath[];\n tags?: Tag[];\n};\nexport type AuditDictionaryFieldResultData = {\n fileContent: string;\n tokenUsed: number;\n};\n\n/**\n * Reads the content of a file synchronously.\n *\n * @function\n * @param relativeFilePath - The relative or absolute path to the target file.\n * @returns The entire contents of the specified file as a UTF-8 encoded string.\n */\nconst getFileContent = (relativeFilePath: string): string => {\n const absolutePath = join(__dirname, relativeFilePath);\n const fileContent = readFileSync(absolutePath, 'utf-8');\n return fileContent;\n};\n\n// The prompt template to send to ChatGPT, requesting an audit of content declaration files.\nconst CHAT_GPT_PROMPT = getFileContent('./PROMPT.md');\n\n/**\n * Formats a locale with its full name and returns a string representation.\n *\n * @function\n * @param locale - A locale from the project's configuration (e.g., 'en-US', 'fr-FR').\n * @returns A formatted string combining the locale's name and code. Example: \"English (US): en-US\".\n */\nconst formatLocaleWithName = (locale: Locales): string => {\n // getLocaleName returns a human-readable name for the locale.\n const localeName = getLocaleName(locale);\n\n // Concatenate both the readable name and the locale code.\n return `${locale}: ${localeName}`;\n};\n\n/**\n * Formats an array of tags with their keys and instructions.\n *\n * @function\n * @param tags - An array of tags from the project's configuration.\n * @returns A string representation of the tags, with their keys and instructions.\n */\nconst formatTagInstructions = (tags: Tag[] = []) =>\n tags.map((tag) => `- ${tag.key}: ${tag.instructions}`).join('\\n\\n');\n\n/**\n * Audits a content declaration file by constructing a prompt for ChatGPT.\n * The prompt includes details about the project's locales, file paths of content declarations,\n * and requests for identifying issues or inconsistencies. It prints the prompt for each file,\n * and could be adapted to send requests to the ChatGPT model.\n */\nexport const auditDictionaryField = async ({\n fileContent,\n model,\n openAiApiKey,\n customPrompt,\n locales,\n keyPath,\n tags,\n}: AuditDictionaryFieldOptions): Promise<\n AuditDictionaryFieldResultData | undefined\n> => {\n try {\n // Optionally, you could initialize and configure the OpenAI client here, if you intend to make API calls.\n // Uncomment and configure the following lines if you have `openai` installed and want to call the API:\n\n const openai = new OpenAI({\n apiKey: openAiApiKey,\n });\n\n // Prepare the prompt for ChatGPT by replacing placeholders with actual values.\n const prompt =\n customPrompt ??\n CHAT_GPT_PROMPT.replace(\n '{{otherLocales}}',\n `{${locales.map(formatLocaleWithName).join(', ')}}`\n )\n .replace('{{keyPath}}', JSON.stringify(keyPath))\n .replace('{{fileContent}}', fileContent)\n .replace('{{tagsInstructions}}', formatTagInstructions(tags));\n\n // Example of how you might request a completion from ChatGPT:\n const chatCompletion = await openai.chat.completions.create({\n model: model ?? 'gpt-4o-mini',\n messages: [{ role: 'system', content: prompt }],\n });\n\n const newContent = chatCompletion.choices[0].message?.content;\n\n logger.info(\n `${chatCompletion.usage?.total_tokens} tokens used in the request`\n );\n\n return {\n fileContent: newContent ?? '',\n tokenUsed: chatCompletion.usage?.total_tokens ?? 0,\n };\n } catch (error) {\n console.error(error);\n }\n};\n"],"mappings":"AAAA,SAAS,oBAAoB;AAC7B,SAAS,SAAS,YAAY;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,qBAAmC;AAC5C,SAAS,cAAc;AAEvB,SAAS,cAAc;AAGvB,MAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AAuBxD,MAAM,iBAAiB,CAAC,qBAAqC;AAC3D,QAAM,eAAe,KAAK,WAAW,gBAAgB;AACrD,QAAM,cAAc,aAAa,cAAc,OAAO;AACtD,SAAO;AACT;AAGA,MAAM,kBAAkB,eAAe,aAAa;AASpD,MAAM,uBAAuB,CAAC,WAA4B;AAExD,QAAM,aAAa,cAAc,MAAM;AAGvC,SAAO,GAAG,MAAM,KAAK,UAAU;AACjC;AASA,MAAM,wBAAwB,CAAC,OAAc,CAAC,MAC5C,KAAK,IAAI,CAAC,QAAQ,KAAK,IAAI,GAAG,KAAK,IAAI,YAAY,EAAE,EAAE,KAAK,MAAM;AAQ7D,MAAM,uBAAuB,OAAO;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAEK;AACH,MAAI;AAIF,UAAM,SAAS,IAAI,OAAO;AAAA,MACxB,QAAQ;AAAA,IACV,CAAC;AAGD,UAAM,SACJ,gBACA,gBAAgB;AAAA,MACd;AAAA,MACA,IAAI,QAAQ,IAAI,oBAAoB,EAAE,KAAK,IAAI,CAAC;AAAA,IAClD,EACG,QAAQ,eAAe,KAAK,UAAU,OAAO,CAAC,EAC9C,QAAQ,mBAAmB,WAAW,EACtC,QAAQ,wBAAwB,sBAAsB,IAAI,CAAC;AAGhE,UAAM,iBAAiB,MAAM,OAAO,KAAK,YAAY,OAAO;AAAA,MAC1D,OAAO,SAAS;AAAA,MAChB,UAAU,CAAC,EAAE,MAAM,UAAU,SAAS,OAAO,CAAC;AAAA,IAChD,CAAC;AAED,UAAM,aAAa,eAAe,QAAQ,CAAC,EAAE,SAAS;AAEtD,WAAO;AAAA,MACL,GAAG,eAAe,OAAO,YAAY;AAAA,IACvC;AAEA,WAAO;AAAA,MACL,aAAa,cAAc;AAAA,MAC3B,WAAW,eAAe,OAAO,gBAAgB;AAAA,IACnD;AAAA,EACF,SAAS,OAAO;AACd,YAAQ,MAAM,KAAK;AAAA,EACrB;AACF;","names":[]}
@@ -29,13 +29,11 @@ const auditDictionaryMetadata = async ({
29
29
  2
30
30
  )}`
31
31
  ).replace("{{contentDeclaration}}", fileContent);
32
- console.log("prompt", prompt);
33
32
  const chatCompletion = await openai.chat.completions.create({
34
33
  model: model ?? "gpt-4o-mini",
35
34
  messages: [{ role: "system", content: prompt }]
36
35
  });
37
36
  const newContent = chatCompletion.choices[0].message?.content;
38
- console.log("newContent", newContent);
39
37
  logger.info(
40
38
  `${chatCompletion.usage?.total_tokens} tokens used in the request`
41
39
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/utils/auditDictionaryMetadata/index.ts"],"sourcesContent":["import { readFileSync } from 'fs';\nimport { dirname, join } from 'path';\nimport { fileURLToPath } from 'url';\nimport { logger } from '@logger';\nimport { OpenAI } from 'openai';\nimport { Tag } from '@/types/tag.types';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport type AuditOptions = {\n tags: Tag[];\n fileContent: string;\n model?: string;\n openAiApiKey: string;\n customPrompt?: string;\n};\nexport type AuditFileResultData = { fileContent: string; tokenUsed: number };\n\n/**\n * Reads the content of a file synchronously.\n *\n * @function\n * @param relativeFilePath - The relative or absolute path to the target file.\n * @returns The entire contents of the specified file as a UTF-8 encoded string.\n */\nconst getFileContent = (relativeFilePath: string): string => {\n const absolutePath = join(__dirname, relativeFilePath);\n const fileContent = readFileSync(absolutePath, 'utf-8');\n return fileContent;\n};\n\n// The prompt template to send to ChatGPT, requesting an audit of content declaration files.\nconst CHAT_GPT_PROMPT = getFileContent('./PROMPT.md');\n\n/**\n * Audits a content declaration file by constructing a prompt for ChatGPT.\n * The prompt includes details about the project's locales, file paths of content declarations,\n * and requests for identifying issues or inconsistencies. It prints the prompt for each file,\n * and could be adapted to send requests to the ChatGPT model.\n *\n */\nexport const auditDictionaryMetadata = async ({\n model,\n openAiApiKey,\n customPrompt,\n tags,\n fileContent,\n}: AuditOptions): Promise<AuditFileResultData | undefined> => {\n try {\n // Optionally, you could initialize and configure the OpenAI client here, if you intend to make API calls.\n // Uncomment and configure the following lines if you have `openai` installed and want to call the API:\n\n const openai = new OpenAI({\n apiKey: openAiApiKey,\n });\n\n // Prepare the prompt for ChatGPT by replacing placeholders with actual values.\n const prompt =\n customPrompt ??\n CHAT_GPT_PROMPT.replace(\n '{{tags}}',\n `${JSON.stringify(\n tags\n .map(({ key, description }) => `- ${key}: ${description}`)\n .join('\\n\\n'),\n null,\n 2\n )}`\n ).replace('{{contentDeclaration}}', fileContent);\n\n console.log('prompt', prompt);\n\n // Example of how you might request a completion from ChatGPT:\n const chatCompletion = await openai.chat.completions.create({\n model: model ?? 'gpt-4o-mini',\n messages: [{ role: 'system', content: prompt }],\n });\n\n const newContent = chatCompletion.choices[0].message?.content;\n\n console.log('newContent', newContent);\n\n logger.info(\n `${chatCompletion.usage?.total_tokens} tokens used in the request`\n );\n\n return {\n fileContent: newContent ?? '',\n tokenUsed: chatCompletion.usage?.total_tokens ?? 0,\n };\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AAK;AAAA,EACrB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/utils/auditDictionaryMetadata/index.ts"],"sourcesContent":["import { readFileSync } from 'fs';\nimport { dirname, join } from 'path';\nimport { fileURLToPath } from 'url';\nimport { logger } from '@logger';\nimport { OpenAI } from 'openai';\nimport { Tag } from '@/types/tag.types';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport type AuditOptions = {\n tags: Tag[];\n fileContent: string;\n model?: string;\n openAiApiKey: string;\n customPrompt?: string;\n};\nexport type AuditFileResultData = { fileContent: string; tokenUsed: number };\n\n/**\n * Reads the content of a file synchronously.\n *\n * @function\n * @param relativeFilePath - The relative or absolute path to the target file.\n * @returns The entire contents of the specified file as a UTF-8 encoded string.\n */\nconst getFileContent = (relativeFilePath: string): string => {\n const absolutePath = join(__dirname, relativeFilePath);\n const fileContent = readFileSync(absolutePath, 'utf-8');\n return fileContent;\n};\n\n// The prompt template to send to ChatGPT, requesting an audit of content declaration files.\nconst CHAT_GPT_PROMPT = getFileContent('./PROMPT.md');\n\n/**\n * Audits a content declaration file by constructing a prompt for ChatGPT.\n * The prompt includes details about the project's locales, file paths of content declarations,\n * and requests for identifying issues or inconsistencies. It prints the prompt for each file,\n * and could be adapted to send requests to the ChatGPT model.\n *\n */\nexport const auditDictionaryMetadata = async ({\n model,\n openAiApiKey,\n customPrompt,\n tags,\n fileContent,\n}: AuditOptions): Promise<AuditFileResultData | undefined> => {\n try {\n // Optionally, you could initialize and configure the OpenAI client here, if you intend to make API calls.\n // Uncomment and configure the following lines if you have `openai` installed and want to call the API:\n\n const openai = new OpenAI({\n apiKey: openAiApiKey,\n });\n\n // Prepare the prompt for ChatGPT by replacing placeholders with actual values.\n const prompt =\n customPrompt ??\n CHAT_GPT_PROMPT.replace(\n '{{tags}}',\n `${JSON.stringify(\n tags\n .map(({ key, description }) => `- ${key}: ${description}`)\n .join('\\n\\n'),\n null,\n 2\n )}`\n ).replace('{{contentDeclaration}}', fileContent);\n\n // Example of how you might request a completion from ChatGPT:\n const chatCompletion = await openai.chat.completions.create({\n model: model ?? 'gpt-4o-mini',\n messages: [{ role: 'system', content: prompt }],\n });\n\n const newContent = chatCompletion.choices[0].message?.content;\n\n logger.info(\n `${chatCompletion.usage?.total_tokens} tokens used in the request`\n );\n\n return {\n fileContent: newContent ?? '',\n tokenUsed: chatCompletion.usage?.total_tokens ?? 0,\n };\n } catch (error) {\n console.error(error);\n }\n};\n"],"mappings":"AAAA,SAAS,oBAAoB;AAC7B,SAAS,SAAS,YAAY;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AACvB,SAAS,cAAc;AAGvB,MAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AAkBxD,MAAM,iBAAiB,CAAC,qBAAqC;AAC3D,QAAM,eAAe,KAAK,WAAW,gBAAgB;AACrD,QAAM,cAAc,aAAa,cAAc,OAAO;AACtD,SAAO;AACT;AAGA,MAAM,kBAAkB,eAAe,aAAa;AAS7C,MAAM,0BAA0B,OAAO;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA8D;AAC5D,MAAI;AAIF,UAAM,SAAS,IAAI,OAAO;AAAA,MACxB,QAAQ;AAAA,IACV,CAAC;AAGD,UAAM,SACJ,gBACA,gBAAgB;AAAA,MACd;AAAA,MACA,GAAG,KAAK;AAAA,QACN,KACG,IAAI,CAAC,EAAE,KAAK,YAAY,MAAM,KAAK,GAAG,KAAK,WAAW,EAAE,EACxD,KAAK,MAAM;AAAA,QACd;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,EAAE,QAAQ,0BAA0B,WAAW;AAGjD,UAAM,iBAAiB,MAAM,OAAO,KAAK,YAAY,OAAO;AAAA,MAC1D,OAAO,SAAS;AAAA,MAChB,UAAU,CAAC,EAAE,MAAM,UAAU,SAAS,OAAO,CAAC;AAAA,IAChD,CAAC;AAED,UAAM,aAAa,eAAe,QAAQ,CAAC,EAAE,SAAS;AAEtD,WAAO;AAAA,MACL,GAAG,eAAe,OAAO,YAAY;AAAA,IACvC;AAEA,WAAO;AAAA,MACL,aAAa,cAAc;AAAA,MAC3B,WAAW,eAAe,OAAO,gBAAgB;AAAA,IACnD;AAAA,EACF,SAAS,OAAO;AACd,YAAQ,MAAM,KAAK;AAAA,EACrB;AACF;","names":[]}
@@ -25,13 +25,11 @@ const auditTag = async ({
25
25
  "{{contentDeclarations}}",
26
26
  dictionaries.map((dictionary) => `- ${JSON.stringify(dictionary)}`).join("\n\n")
27
27
  );
28
- console.log("prompt", prompt);
29
28
  const chatCompletion = await openai.chat.completions.create({
30
29
  model: model ?? "gpt-4o-mini",
31
30
  messages: [{ role: "system", content: prompt }]
32
31
  });
33
32
  const newContent = chatCompletion.choices[0].message?.content;
34
- console.log("newContent", newContent);
35
33
  logger.info(
36
34
  `${chatCompletion.usage?.total_tokens} tokens used in the request`
37
35
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/utils/auditTag/index.ts"],"sourcesContent":["import { readFileSync } from 'fs';\nimport { dirname, join } from 'path';\nimport { fileURLToPath } from 'url';\nimport { logger } from '@logger';\nimport { OpenAI } from 'openai';\nimport { Dictionary } from '@/types/dictionary.types';\nimport { Tag } from '@/types/tag.types';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport type AuditOptions = {\n tag: Tag;\n dictionaries: Dictionary[];\n model?: string;\n openAiApiKey: string;\n customPrompt?: string;\n};\nexport type AuditFileResultData = { fileContent: string; tokenUsed: number };\n\n/**\n * Reads the content of a file synchronously.\n *\n * @function\n * @param relativeFilePath - The relative or absolute path to the target file.\n * @returns The entire contents of the specified file as a UTF-8 encoded string.\n */\nconst getFileContent = (relativeFilePath: string): string => {\n const absolutePath = join(__dirname, relativeFilePath);\n const fileContent = readFileSync(absolutePath, 'utf-8');\n return fileContent;\n};\n\n// The prompt template to send to ChatGPT, requesting an audit of content declaration files.\nconst CHAT_GPT_PROMPT = getFileContent('./PROMPT.md');\n\n/**\n * Audits a content declaration file by constructing a prompt for ChatGPT.\n * The prompt includes details about the project's locales, file paths of content declarations,\n * and requests for identifying issues or inconsistencies. It prints the prompt for each file,\n * and could be adapted to send requests to the ChatGPT model.\n *\n * @async\n * @function\n * @param filePath - The relative or absolute path to the target file.\n * @param options - Optional configuration for the audit process.\n * @returns This function returns a Promise that resolves once the audit is complete.\n */\nexport const auditTag = async ({\n model,\n openAiApiKey,\n customPrompt,\n tag,\n dictionaries,\n}: AuditOptions): Promise<AuditFileResultData | undefined> => {\n try {\n // Optionally, you could initialize and configure the OpenAI client here, if you intend to make API calls.\n // Uncomment and configure the following lines if you have `openai` installed and want to call the API:\n\n const openai = new OpenAI({\n apiKey: openAiApiKey,\n });\n\n // Prepare the prompt for ChatGPT by replacing placeholders with actual values.\n const prompt =\n customPrompt ??\n CHAT_GPT_PROMPT.replace('{{tag}}', `${JSON.stringify(tag)}`).replace(\n '{{contentDeclarations}}',\n dictionaries\n .map((dictionary) => `- ${JSON.stringify(dictionary)}`)\n .join('\\n\\n')\n );\n\n console.log('prompt', prompt);\n\n // Example of how you might request a completion from ChatGPT:\n const chatCompletion = await openai.chat.completions.create({\n model: model ?? 'gpt-4o-mini',\n messages: [{ role: 'system', content: prompt }],\n });\n\n const newContent = chatCompletion.choices[0].message?.content;\n\n console.log('newContent', newContent);\n\n logger.info(\n `${chatCompletion.usage?.total_tokens} tokens used in the request`\n );\n\n return {\n fileContent: newContent ?? '',\n tokenUsed: chatCompletion.usage?.total_tokens ?? 0,\n };\n } catch (error) {\n console.error(error);\n }\n};\n"],"mappings":"AAAA,SAAS,oBAAoB;AAC7B,SAAS,SAAS,YAAY;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AACvB,SAAS,cAAc;AAIvB,MAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AAkBxD,MAAM,iBAAiB,CAAC,qBAAqC;AAC3D,QAAM,eAAe,KAAK,WAAW,gBAAgB;AACrD,QAAM,cAAc,aAAa,cAAc,OAAO;AACtD,SAAO;AACT;AAGA,MAAM,kBAAkB,eAAe,aAAa;AAc7C,MAAM,WAAW,OAAO;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA8D;AAC5D,MAAI;AAIF,UAAM,SAAS,IAAI,OAAO;AAAA,MACxB,QAAQ;AAAA,IACV,CAAC;AAGD,UAAM,SACJ,gBACA,gBAAgB,QAAQ,WAAW,GAAG,KAAK,UAAU,GAAG,CAAC,EAAE,EAAE;AAAA,MAC3D;AAAA,MACA,aACG,IAAI,CAAC,eAAe,KAAK,KAAK,UAAU,UAAU,CAAC,EAAE,EACrD,KAAK,MAAM;AAAA,IAChB;AAEF,YAAQ,IAAI,UAAU,MAAM;AAG5B,UAAM,iBAAiB,MAAM,OAAO,KAAK,YAAY,OAAO;AAAA,MAC1D,OAAO,SAAS;AAAA,MAChB,UAAU,CAAC,EAAE,MAAM,UAAU,SAAS,OAAO,CAAC;AAAA,IAChD,CAAC;AAED,UAAM,aAAa,eAAe,QAAQ,CAAC,EAAE,SAAS;AAEtD,YAAQ,IAAI,cAAc,UAAU;AAEpC,WAAO;AAAA,MACL,GAAG,eAAe,OAAO,YAAY;AAAA,IACvC;AAEA,WAAO;AAAA,MACL,aAAa,cAAc;AAAA,MAC3B,WAAW,eAAe,OAAO,gBAAgB;AAAA,IACnD;AAAA,EACF,SAAS,OAAO;AACd,YAAQ,MAAM,KAAK;AAAA,EACrB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/utils/auditTag/index.ts"],"sourcesContent":["import { readFileSync } from 'fs';\nimport { dirname, join } from 'path';\nimport { fileURLToPath } from 'url';\nimport { logger } from '@logger';\nimport { OpenAI } from 'openai';\nimport { Dictionary } from '@/types/dictionary.types';\nimport { Tag } from '@/types/tag.types';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport type AuditOptions = {\n tag: Tag;\n dictionaries: Dictionary[];\n model?: string;\n openAiApiKey: string;\n customPrompt?: string;\n};\nexport type AuditFileResultData = { fileContent: string; tokenUsed: number };\n\n/**\n * Reads the content of a file synchronously.\n *\n * @function\n * @param relativeFilePath - The relative or absolute path to the target file.\n * @returns The entire contents of the specified file as a UTF-8 encoded string.\n */\nconst getFileContent = (relativeFilePath: string): string => {\n const absolutePath = join(__dirname, relativeFilePath);\n const fileContent = readFileSync(absolutePath, 'utf-8');\n return fileContent;\n};\n\n// The prompt template to send to ChatGPT, requesting an audit of content declaration files.\nconst CHAT_GPT_PROMPT = getFileContent('./PROMPT.md');\n\n/**\n * Audits a content declaration file by constructing a prompt for ChatGPT.\n * The prompt includes details about the project's locales, file paths of content declarations,\n * and requests for identifying issues or inconsistencies. It prints the prompt for each file,\n * and could be adapted to send requests to the ChatGPT model.\n *\n * @async\n * @function\n * @param filePath - The relative or absolute path to the target file.\n * @param options - Optional configuration for the audit process.\n * @returns This function returns a Promise that resolves once the audit is complete.\n */\nexport const auditTag = async ({\n model,\n openAiApiKey,\n customPrompt,\n tag,\n dictionaries,\n}: AuditOptions): Promise<AuditFileResultData | undefined> => {\n try {\n // Optionally, you could initialize and configure the OpenAI client here, if you intend to make API calls.\n // Uncomment and configure the following lines if you have `openai` installed and want to call the API:\n\n const openai = new OpenAI({\n apiKey: openAiApiKey,\n });\n\n // Prepare the prompt for ChatGPT by replacing placeholders with actual values.\n const prompt =\n customPrompt ??\n CHAT_GPT_PROMPT.replace('{{tag}}', `${JSON.stringify(tag)}`).replace(\n '{{contentDeclarations}}',\n dictionaries\n .map((dictionary) => `- ${JSON.stringify(dictionary)}`)\n .join('\\n\\n')\n );\n\n // Example of how you might request a completion from ChatGPT:\n const chatCompletion = await openai.chat.completions.create({\n model: model ?? 'gpt-4o-mini',\n messages: [{ role: 'system', content: prompt }],\n });\n\n const newContent = chatCompletion.choices[0].message?.content;\n\n logger.info(\n `${chatCompletion.usage?.total_tokens} tokens used in the request`\n );\n\n return {\n fileContent: newContent ?? '',\n tokenUsed: chatCompletion.usage?.total_tokens ?? 0,\n };\n } catch (error) {\n console.error(error);\n }\n};\n"],"mappings":"AAAA,SAAS,oBAAoB;AAC7B,SAAS,SAAS,YAAY;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AACvB,SAAS,cAAc;AAIvB,MAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AAkBxD,MAAM,iBAAiB,CAAC,qBAAqC;AAC3D,QAAM,eAAe,KAAK,WAAW,gBAAgB;AACrD,QAAM,cAAc,aAAa,cAAc,OAAO;AACtD,SAAO;AACT;AAGA,MAAM,kBAAkB,eAAe,aAAa;AAc7C,MAAM,WAAW,OAAO;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA8D;AAC5D,MAAI;AAIF,UAAM,SAAS,IAAI,OAAO;AAAA,MACxB,QAAQ;AAAA,IACV,CAAC;AAGD,UAAM,SACJ,gBACA,gBAAgB,QAAQ,WAAW,GAAG,KAAK,UAAU,GAAG,CAAC,EAAE,EAAE;AAAA,MAC3D;AAAA,MACA,aACG,IAAI,CAAC,eAAe,KAAK,KAAK,UAAU,UAAU,CAAC,EAAE,EACrD,KAAK,MAAM;AAAA,IAChB;AAGF,UAAM,iBAAiB,MAAM,OAAO,KAAK,YAAY,OAAO;AAAA,MAC1D,OAAO,SAAS;AAAA,MAChB,UAAU,CAAC,EAAE,MAAM,UAAU,SAAS,OAAO,CAAC;AAAA,IAChD,CAAC;AAED,UAAM,aAAa,eAAe,QAAQ,CAAC,EAAE,SAAS;AAEtD,WAAO;AAAA,MACL,GAAG,eAAe,OAAO,YAAY;AAAA,IACvC;AAEA,WAAO;AAAA,MACL,aAAa,cAAc;AAAA,MAC3B,WAAW,eAAe,OAAO,gBAAgB;AAAA,IACnD;AAAA,EACF,SAAS,OAAO;AACd,YAAQ,MAAM,KAAK;AAAA,EACrB;AACF;","names":[]}
@@ -1,5 +1,6 @@
1
1
  import { type KeyPath } from '@intlayer/core';
2
2
  import type { ResponseWithInformation } from '../middlewares/sessionAuth.middleware';
3
+ import * as askDocQuestionUtil from '../utils/AI/askDocQuestion';
3
4
  import * as auditContentDeclarationUtil from '../utils/auditDictionary';
4
5
  import { type ResponseData } from '../utils/responseData';
5
6
  import type { NextFunction, Request } from 'express';
@@ -58,4 +59,9 @@ export type AuditTagResult = ResponseData<auditContentDeclarationUtil.AuditFileR
58
59
  * Retrieves a list of dictionaries based on filters and pagination.
59
60
  */
60
61
  export declare const auditTag: (req: Request<undefined, undefined, AuditTagBody>, res: ResponseWithInformation<AuditTagResult>, _next: NextFunction) => Promise<void>;
62
+ export type AskDocQuestionBody = {
63
+ messages: askDocQuestionUtil.ChatCompletionRequestMessage[];
64
+ };
65
+ export type AskDocQuestionResult = ResponseData<askDocQuestionUtil.AskDocQuestionResult>;
66
+ export declare const askDocQuestion: (req: Request<undefined, undefined, AskDocQuestionBody>, res: ResponseWithInformation<AskDocQuestionResult>) => Promise<void>;
61
67
  //# sourceMappingURL=ai.controller.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ai.controller.d.ts","sourceRoot":"","sources":["../../../src/controllers/ai.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAInF,OAAO,KAAK,2BAA2B,MAAM,wBAAwB,CAAC;AAKtE,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,MAAM,2BAA2B,GAAG;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO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,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,MAAM,MAAM,qCAAqC,GAC/C,YAAY,CAAC,2BAA2B,CAAC,mBAAmB,CAAC,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,+BAA+B,QACrC,OAAO,CAAC,mCAAmC,CAAC,OAC5C,uBAAuB,CAAC,qCAAqC,CAAC,SAC5D,YAAY,KAClB,OAAO,CAAC,IAAI,CAqDd,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AACF,MAAM,MAAM,cAAc,GACxB,YAAY,CAAC,2BAA2B,CAAC,mBAAmB,CAAC,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,QAAQ,QACd,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,OAC3C,uBAAuB,CAAC,cAAc,CAAC,SACrC,YAAY,KAClB,OAAO,CAAC,IAAI,CA6Cd,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,kBAAkB,CAAC,4BAA4B,EAAE,CAAC;CAC7D,CAAC;AACF,MAAM,MAAM,oBAAoB,GAC9B,YAAY,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;AAExD,eAAO,MAAM,cAAc,QACpB,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,kBAAkB,CAAC,OACjD,uBAAuB,CAAC,oBAAoB,CAAC,kBAgBnD,CAAC"}
@@ -21,5 +21,10 @@ export declare const aiRoutes: {
21
21
  url: string;
22
22
  method: "POST";
23
23
  };
24
+ ask: {
25
+ urlModel: string;
26
+ url: string;
27
+ method: "POST";
28
+ };
24
29
  };
25
30
  //# sourceMappingURL=ai.routes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ai.routes.d.ts","sourceRoot":"","sources":["../../../src/routes/ai.routes.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGjC,eAAO,MAAM,QAAQ,EAAE,MAAiB,CAAC;AAIzC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;CAqBH,CAAC"}
1
+ {"version":3,"file":"ai.routes.d.ts","sourceRoot":"","sources":["../../../src/routes/ai.routes.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGjC,eAAO,MAAM,QAAQ,EAAE,MAAiB,CAAC;AAIzC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.service.d.ts","sourceRoot":"","sources":["../../../src/services/dictionary.service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+DAA+D,CAAC;AAMvG,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,YAClB,iBAAiB,oCAGzB,OAAO,CAAC,kBAAkB,EAAE,CAuC9B,CAAC;AAEF;;;;GAIG;AACH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,iBACd,MAAM,GAAG,QAAQ,KAC9B,OAAO,CAAC,kBAAkB,CAwB5B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,kBACd,MAAM,aACV,MAAM,GAAG,QAAQ,KAC3B,OAAO,CAAC,kBAAkB,CAM5B,CAAC;AAEF,eAAO,MAAM,qBAAqB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AM,aAAa,YACf,WAAW,KACnB,OAAO,CAAC,eAAe,CAYzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,cACjB,MAAM,GAAG,QAAQ,WACnB,OAAO,CAAC,OAAO,CAAC,KACxB,OAAO,CAAC,eAAe,CA+BzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,cACjB,MAAM,GAAG,QAAQ,KAC3B,OAAO,CAAC,eAAe,CAQzB,CAAC"}
1
+ {"version":3,"file":"project.service.d.ts","sourceRoot":"","sources":["../../../src/services/project.service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4DAA4D,CAAC;AAMjG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAE/B;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,YACd,cAAc,oCAGtB,OAAO,CAAC,eAAe,EAAE,CAC8B,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,cAAc,cACd,MAAM,GAAG,QAAQ,KAC3B,OAAO,CAAC,eAAe,CAQzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,YACf,cAAc,KACtB,OAAO,CAAC,MAAM,CAQhB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,YACf,WAAW,KACnB,OAAO,CAAC,eAAe,CAYzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,cACjB,MAAM,GAAG,QAAQ,WACnB,OAAO,CAAC,OAAO,CAAC,KACxB,OAAO,CAAC,eAAe,CA6BzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,cACjB,MAAM,GAAG,QAAQ,KAC3B,OAAO,CAAC,eAAe,CAQzB,CAAC"}
@@ -0,0 +1,38 @@
1
+ type VectorStoreEl = {
2
+ fileKey: string;
3
+ chunkNumber: number;
4
+ content: string;
5
+ embedding: number[];
6
+ };
7
+ /**
8
+ * Indexes all Markdown documents by generating embeddings for each chunk and storing them in memory.
9
+ * Also updates the embeddings.json file if new embeddings are generated.
10
+ */
11
+ export declare const indexMarkdownFiles: () => Promise<void>;
12
+ /**
13
+ * Searches the indexed documents for the most relevant chunks based on a query.
14
+ * Utilizes cosine similarity to find the closest matching embeddings.
15
+ *
16
+ * @param query - The search query provided by the user
17
+ * @returns An array of the top matching document chunks' content
18
+ */
19
+ export declare const searchChunkReference: (query: string) => Promise<VectorStoreEl[]>;
20
+ export type ChatCompletionRequestMessage = {
21
+ role: 'system' | 'user' | 'assistant';
22
+ content: string;
23
+ };
24
+ export declare const initPrompt: ChatCompletionRequestMessage;
25
+ export type AskDocQuestionResult = {
26
+ response: string;
27
+ relatedFiles: string[];
28
+ };
29
+ /**
30
+ * Handles the "Ask a question" endpoint in an Express.js route.
31
+ * Processes user messages, retrieves relevant documents, and interacts with OpenAI's chat API to generate responses.
32
+ *
33
+ * @param messages - An array of chat messages from the user and assistant
34
+ * @returns The assistant's response as a string
35
+ */
36
+ export declare const askDocQuestion: (messages: ChatCompletionRequestMessage[]) => Promise<AskDocQuestionResult>;
37
+ export {};
38
+ //# sourceMappingURL=askDocQuestion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"askDocQuestion.d.ts","sourceRoot":"","sources":["../../../../src/utils/AI/askDocQuestion.ts"],"names":[],"mappings":"AASA,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAiGF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAa,OAAO,CAAC,IAAI,CAiEvD,CAAC;AAKF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,UACxB,MAAM,KACZ,OAAO,CAAC,aAAa,EAAE,CAgBzB,CAAC;AAGF,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAGF,eAAO,MAAM,UAAU,EAAE,4BA2BxB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,aACf,4BAA4B,EAAE,KACvC,OAAO,CAAC,oBAAoB,CAmD9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/auditDictionaryField/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAIxC,MAAM,MAAM,2BAA2B,GAAG;IACxC,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;CACd,CAAC;AACF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA2CF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,gFAQ9B,2BAA2B,KAAG,OAAO,CACtC,8BAA8B,GAAG,SAAS,CA0C3C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/auditDictionaryField/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAIxC,MAAM,MAAM,2BAA2B,GAAG;IACxC,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;CACd,CAAC;AACF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA2CF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,gFAQ9B,2BAA2B,KAAG,OAAO,CACtC,8BAA8B,GAAG,SAAS,CAwC3C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/auditDictionaryMetadata/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAIxC,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAkB7E;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,8DAMjC,YAAY,KAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CA8CxD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/auditDictionaryMetadata/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAIxC,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAkB7E;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,8DAMjC,YAAY,KAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CA0CxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/auditTag/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAIxC,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,GAAG,CAAC;IACT,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAkB7E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,8DAMlB,YAAY,KAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CA0CxD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/auditTag/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAIxC,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,GAAG,CAAC;IACT,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAkB7E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,8DAMlB,YAAY,KAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAsCxD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/backend",
3
- "version": "3.5.6",
3
+ "version": "3.5.7",
4
4
  "private": false,
5
5
  "description": "IntLayer Backend is a an application that allow you to manage your IntLayer content and interact with the intlayer editor.",
6
6
  "keywords": [
@@ -73,7 +73,7 @@
73
73
  "uuid": "^11.0.3",
74
74
  "validator": "^13.12.0",
75
75
  "winston": "^3.17.0",
76
- "express-intlayer": "^3.5.5"
76
+ "express-intlayer": "3.5.7"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@types/bcrypt": "^5.0.2",
@@ -90,19 +90,21 @@
90
90
  "@types/react": "^18.3.12",
91
91
  "@types/uuid": "^10.0.0",
92
92
  "@types/validator": "^13.12.2",
93
- "esbuild-fix-imports-plugin": "^1.0.6",
93
+ "esbuild-fix-imports-plugin": "^1.0.10",
94
94
  "eslint": "^9.16.0",
95
95
  "prettier": "^3.4.1",
96
96
  "tsc-alias": "^1.8.10",
97
97
  "tsup": "^8.3.5",
98
98
  "tsx": "^4.19.2",
99
99
  "typescript": "^5.7.2",
100
- "@intlayer/core": "^3.5.5",
101
- "@utils/eslint-config": "^1.0.4",
102
- "@utils/ts-config": "^1.0.4",
103
- "@utils/ts-config-types": "^1.0.4",
104
- "@utils/tsup-config": "^1.0.4",
105
- "intlayer": "^3.5.6"
100
+ "@intlayer/blog": "3.5.7",
101
+ "@intlayer/core": "3.5.7",
102
+ "@intlayer/docs": "3.5.7",
103
+ "@utils/eslint-config": "1.0.4",
104
+ "@utils/ts-config": "1.0.4",
105
+ "@utils/ts-config-types": "1.0.4",
106
+ "@utils/tsup-config": "1.0.4",
107
+ "intlayer": "3.5.7"
106
108
  },
107
109
  "scripts": {
108
110
  "build": "pnpm build:package & pnpm build:types",
@@ -1,28 +0,0 @@
1
- import { Locales } from 'intlayer';
2
- export type AuditOptions = {
3
- locales: Locales[];
4
- defaultLocale: Locales;
5
- fileContent: string;
6
- filePath?: string;
7
- model?: string;
8
- openAiApiKey: string;
9
- customPrompt?: string;
10
- };
11
- export type AuditFileResultData = {
12
- fileContent: string;
13
- tokenUsed: number;
14
- };
15
- /**
16
- * Audits a content declaration file by constructing a prompt for ChatGPT.
17
- * The prompt includes details about the project's locales, file paths of content declarations,
18
- * and requests for identifying issues or inconsistencies. It prints the prompt for each file,
19
- * and could be adapted to send requests to the ChatGPT model.
20
- *
21
- * @async
22
- * @function
23
- * @param filePath - The relative or absolute path to the target file.
24
- * @param options - Optional configuration for the audit process.
25
- * @returns This function returns a Promise that resolves once the audit is complete.
26
- */
27
- export declare const auditFile: ({ fileContent, filePath, model, openAiApiKey, customPrompt, locales, defaultLocale, }: AuditOptions) => Promise<AuditFileResultData | undefined>;
28
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/audit/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAKnC,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AA2C7E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,SAAS,0FAQnB,YAAY,KAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAkDxD,CAAC"}