@intlayer/backend 5.5.2 → 5.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/cjs/controllers/ai.controller.cjs.map +1 -1
  2. package/dist/cjs/controllers/search.controller.cjs +54 -0
  3. package/dist/cjs/controllers/search.controller.cjs.map +1 -0
  4. package/dist/cjs/export.cjs.map +1 -1
  5. package/dist/cjs/index.cjs +6 -4
  6. package/dist/cjs/index.cjs.map +1 -1
  7. package/dist/cjs/routes/search.routes.cjs +42 -0
  8. package/dist/cjs/routes/search.routes.cjs.map +1 -0
  9. package/dist/cjs/utils/AI/aiSdk.cjs.map +1 -1
  10. package/dist/cjs/utils/AI/askDocQuestion/askDocQuestion.cjs +2 -2
  11. package/dist/cjs/utils/AI/askDocQuestion/askDocQuestion.cjs.map +1 -1
  12. package/dist/cjs/utils/AI/askDocQuestion/embeddings.json +4104 -0
  13. package/dist/cjs/utils/AI/translateJSON/PROMPT.md +1 -1
  14. package/dist/cjs/utils/AI/translateJSON/index.cjs +2 -2
  15. package/dist/cjs/utils/AI/translateJSON/index.cjs.map +1 -1
  16. package/dist/esm/controllers/ai.controller.mjs.map +1 -1
  17. package/dist/esm/controllers/search.controller.mjs +20 -0
  18. package/dist/esm/controllers/search.controller.mjs.map +1 -0
  19. package/dist/esm/export.mjs.map +1 -1
  20. package/dist/esm/index.mjs +8 -6
  21. package/dist/esm/index.mjs.map +1 -1
  22. package/dist/esm/routes/search.routes.mjs +17 -0
  23. package/dist/esm/routes/search.routes.mjs.map +1 -0
  24. package/dist/esm/utils/AI/aiSdk.mjs.map +1 -1
  25. package/dist/esm/utils/AI/askDocQuestion/askDocQuestion.mjs +6 -3
  26. package/dist/esm/utils/AI/askDocQuestion/askDocQuestion.mjs.map +1 -1
  27. package/dist/esm/utils/AI/askDocQuestion/embeddings.json +4104 -0
  28. package/dist/esm/utils/AI/translateJSON/PROMPT.md +1 -1
  29. package/dist/esm/utils/AI/translateJSON/index.mjs +2 -2
  30. package/dist/esm/utils/AI/translateJSON/index.mjs.map +1 -1
  31. package/dist/types/controllers/ai.controller.d.ts +2 -2
  32. package/dist/types/controllers/ai.controller.d.ts.map +1 -1
  33. package/dist/types/controllers/search.controller.d.ts +9 -0
  34. package/dist/types/controllers/search.controller.d.ts.map +1 -0
  35. package/dist/types/export.d.ts +1 -0
  36. package/dist/types/export.d.ts.map +1 -1
  37. package/dist/types/index.d.ts.map +1 -1
  38. package/dist/types/routes/search.routes.d.ts +10 -0
  39. package/dist/types/routes/search.routes.d.ts.map +1 -0
  40. package/dist/types/utils/AI/aiSdk.d.ts +5 -0
  41. package/dist/types/utils/AI/aiSdk.d.ts.map +1 -1
  42. package/dist/types/utils/AI/askDocQuestion/askDocQuestion.d.ts +2 -6
  43. package/dist/types/utils/AI/askDocQuestion/askDocQuestion.d.ts.map +1 -1
  44. package/package.json +7 -7
@@ -12,9 +12,9 @@ You are an expert in internationalization, copy writing and content management.
12
12
  3. **Modification Guidelines:**
13
13
 
14
14
  - **Do Not Alter Structure:** If the file structure is correct, do not modify it. Only add, update, or remove content declarations as necessary.
15
+ - **Missing Content:** If one key is missing from the Preset Output Content, or if the Preset Output Content is empty, the output content should be completed by translating the Entry Content to Translate into the output locale.
15
16
  - **Return Only Final File Content:** Provide the updated file content without any additional comments or explanations.
16
17
  - **Manage Localizations:** If the output languages targeted is a variant contains similar languages, as `en` and `en-GB`, consider `en` as English US, and adapt it into `en-GB` as English UK.
17
- - **Conflict between language and content:** If you detect a conflict between the language and content, translate it if the Mode Instruction is in 'review' mode
18
18
  - **Escape Special Characters:** If the translations contain special characters, escape them using the appropriate escape sequence.
19
19
  - **Respect the tags and description instructions:** If the tags and description instructions are provided, ensure that the audited file adheres to them.
20
20
  - **Consider the Preset Output Content** If Preset Output Content is provided, and coherent with the entry, you can consider reuse it to fill the output file content.
@@ -25,9 +25,9 @@ ${tags.map(({ key, description }) => `- ${key}: ${description}`).join("\n\n")}`;
25
25
  };
26
26
  const getModeInstructions = (mode) => {
27
27
  if (mode === "complete") {
28
- return 'Mode: "Complete" - Enrich the preset content with the missing keys and values. Do not update existing keys. Everything should be returned in the output.';
28
+ return 'Mode: "Complete" - Enrich the preset content with the missing keys and values in the output locale. Do not update existing keys. Everything should be returned in the output.';
29
29
  }
30
- return 'Mode: "Review" - Fill missing content and review existing keys from the preset content. If you detect misspelled content, or content should be reformulated, correct it.';
30
+ return 'Mode: "Review" - Fill missing content and review existing keys from the preset content. If a key from the entry is missing in the output, it must be translated to the target language and added. If you detect misspelled content, or content that should be reformulated, correct it. If a translation is not coherent with the desired language, translate it.';
31
31
  };
32
32
  const translateJSON = async ({
33
33
  entryFileContent,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/utils/AI/translateJSON/index.ts"],"sourcesContent":["import type { Tag } from '@/types/tag.types';\nimport { retryManager } from '@intlayer/config';\nimport { getLocaleName } from '@intlayer/core';\nimport { logger } from '@logger';\nimport { extractJson } from '@utils/extractJSON';\nimport { generateText } from 'ai';\nimport { readFileSync } from 'fs';\nimport type { Locales } from 'intlayer';\nimport { dirname, join } from 'path';\nimport { fileURLToPath } from 'url';\nimport { AIOptions, AIProvider, getAIConfig } from '../aiSdk';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\n// Get the content of a file at the specified path\nconst getFileContent = (filePath: string) => {\n return readFileSync(join(__dirname, filePath), { encoding: 'utf-8' });\n};\n\nexport type TranslateJSONOptions = {\n entryFileContent: JSON;\n presetOutputContent: JSON;\n dictionaryDescription: string;\n entryLocale: Locales;\n outputLocale: Locales;\n tags: Tag[];\n aiOptions?: AIOptions;\n mode: 'complete' | 'review';\n};\n\nexport type TranslateJSONResultData = {\n fileContent: string;\n tokenUsed: number;\n};\n\n// The prompt template to send to the AI model\nconst CHAT_GPT_PROMPT = getFileContent('./PROMPT.md');\n\n/**\n * Format a locale with its name.\n *\n * @param locale - The locale to format.\n * @returns A string in the format \"locale: name\", e.g. \"en: English\".\n */\nconst formatLocaleWithName = (locale: Locales): string => {\n return `${locale}: ${getLocaleName(locale)}`;\n};\n\n/**\n * Formats tag instructions for the AI prompt.\n * Creates a string with all available tags and their descriptions.\n *\n * @param tags - The list of tags to format.\n * @returns A formatted string with tag instructions.\n */\nconst formatTagInstructions = (tags: Tag[]): string => {\n if (!tags || tags.length === 0) {\n return '';\n }\n\n // Prepare the tag instructions.\n return `Based on the dictionary content, identify specific tags from the list below that would be relevant:\n \n${tags.map(({ key, description }) => `- ${key}: ${description}`).join('\\n\\n')}`;\n};\n\nconst getModeInstructions = (mode: 'complete' | 'review'): string => {\n if (mode === 'complete') {\n return 'Mode: \"Complete\" - Enrich the preset content with the missing keys and values. Do not update existing keys. Everything should be returned in the output.';\n }\n\n return 'Mode: \"Review\" - Fill missing content and review existing keys from the preset content. If you detect misspelled content, or content should be reformulated, correct it.';\n};\n\n/**\n * TranslateJSONs a content declaration file by constructing a prompt for AI models.\n * The prompt includes details about the project's locales, file paths of content declarations,\n * and requests for identifying issues or inconsistencies.\n */\nexport const translateJSON = async ({\n entryFileContent,\n presetOutputContent,\n dictionaryDescription,\n aiOptions,\n entryLocale,\n outputLocale,\n tags,\n mode,\n}: TranslateJSONOptions): Promise<TranslateJSONResultData | undefined> => {\n try {\n // Get the appropriate AI model configuration\n const aiConfig = await getAIConfig({\n provider: AIProvider.OPENAI,\n model: 'gpt-4o-mini-2024-07-18',\n ...aiOptions,\n });\n\n // Prepare the prompt for AI by replacing placeholders with actual values.\n const prompt = CHAT_GPT_PROMPT.replace(\n '{{entryLocale}}',\n formatLocaleWithName(entryLocale)\n )\n .replace('{{outputLocale}}', formatLocaleWithName(outputLocale))\n .replace('{{entryFileContent}}', JSON.stringify(entryFileContent))\n .replace('{{presetOutputContent}}', JSON.stringify(presetOutputContent))\n .replace('{{dictionaryDescription}}', dictionaryDescription)\n .replace('{{applicationContext}}', aiOptions?.applicationContext ?? '')\n .replace('{{tagsInstructions}}', formatTagInstructions(tags))\n .replace('{{modeInstructions}}', getModeInstructions(mode));\n\n if (!aiConfig) {\n logger.error('Failed to configure AI model');\n return undefined;\n }\n\n const result = await retryManager(async () => {\n // Use the AI SDK to generate the completion\n const { text: newContent, usage } = await generateText({\n model: aiConfig.model,\n temperature: aiConfig.temperature,\n messages: [{ role: 'system', content: prompt }],\n });\n\n logger.info(`${usage?.totalTokens ?? 0} tokens used in the request`);\n\n return {\n fileContent: extractJson(newContent),\n tokenUsed: usage?.totalTokens ?? 0,\n };\n })();\n\n return {\n fileContent: result.fileContent,\n tokenUsed: result.tokenUsed,\n };\n } catch (error) {\n logger.error('Error translating JSON:' + error, {\n level: 'error',\n });\n }\n};\n"],"mappings":"AACA,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAE7B,SAAS,SAAS,YAAY;AAC9B,SAAS,qBAAqB;AAC9B,SAAoB,YAAY,mBAAmB;AAEnD,MAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AAGxD,MAAM,iBAAiB,CAAC,aAAqB;AAC3C,SAAO,aAAa,KAAK,WAAW,QAAQ,GAAG,EAAE,UAAU,QAAQ,CAAC;AACtE;AAmBA,MAAM,kBAAkB,eAAe,aAAa;AAQpD,MAAM,uBAAuB,CAAC,WAA4B;AACxD,SAAO,GAAG,MAAM,KAAK,cAAc,MAAM,CAAC;AAC5C;AASA,MAAM,wBAAwB,CAAC,SAAwB;AACrD,MAAI,CAAC,QAAQ,KAAK,WAAW,GAAG;AAC9B,WAAO;AAAA,EACT;AAGA,SAAO;AAAA;AAAA,EAEP,KAAK,IAAI,CAAC,EAAE,KAAK,YAAY,MAAM,KAAK,GAAG,KAAK,WAAW,EAAE,EAAE,KAAK,MAAM,CAAC;AAC7E;AAEA,MAAM,sBAAsB,CAAC,SAAwC;AACnE,MAAI,SAAS,YAAY;AACvB,WAAO;AAAA,EACT;AAEA,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,CAAC;AAAA,EACH;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/utils/AI/translateJSON/index.ts"],"sourcesContent":["import type { Tag } from '@/types/tag.types';\nimport { retryManager } from '@intlayer/config';\nimport { getLocaleName } from '@intlayer/core';\nimport { logger } from '@logger';\nimport { extractJson } from '@utils/extractJSON';\nimport { generateText } from 'ai';\nimport { readFileSync } from 'fs';\nimport type { Locales } from 'intlayer';\nimport { dirname, join } from 'path';\nimport { fileURLToPath } from 'url';\nimport { AIOptions, AIProvider, getAIConfig } from '../aiSdk';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\n// Get the content of a file at the specified path\nconst getFileContent = (filePath: string) => {\n return readFileSync(join(__dirname, filePath), { encoding: 'utf-8' });\n};\n\nexport type TranslateJSONOptions = {\n entryFileContent: JSON;\n presetOutputContent: JSON;\n dictionaryDescription: string;\n entryLocale: Locales;\n outputLocale: Locales;\n tags: Tag[];\n aiOptions?: AIOptions;\n mode: 'complete' | 'review';\n};\n\nexport type TranslateJSONResultData = {\n fileContent: string;\n tokenUsed: number;\n};\n\n// The prompt template to send to the AI model\nconst CHAT_GPT_PROMPT = getFileContent('./PROMPT.md');\n\n/**\n * Format a locale with its name.\n *\n * @param locale - The locale to format.\n * @returns A string in the format \"locale: name\", e.g. \"en: English\".\n */\nconst formatLocaleWithName = (locale: Locales): string => {\n return `${locale}: ${getLocaleName(locale)}`;\n};\n\n/**\n * Formats tag instructions for the AI prompt.\n * Creates a string with all available tags and their descriptions.\n *\n * @param tags - The list of tags to format.\n * @returns A formatted string with tag instructions.\n */\nconst formatTagInstructions = (tags: Tag[]): string => {\n if (!tags || tags.length === 0) {\n return '';\n }\n\n // Prepare the tag instructions.\n return `Based on the dictionary content, identify specific tags from the list below that would be relevant:\n \n${tags.map(({ key, description }) => `- ${key}: ${description}`).join('\\n\\n')}`;\n};\n\nconst getModeInstructions = (mode: 'complete' | 'review'): string => {\n if (mode === 'complete') {\n return 'Mode: \"Complete\" - Enrich the preset content with the missing keys and values in the output locale. Do not update existing keys. Everything should be returned in the output.';\n }\n\n return 'Mode: \"Review\" - Fill missing content and review existing keys from the preset content. If a key from the entry is missing in the output, it must be translated to the target language and added. If you detect misspelled content, or content that should be reformulated, correct it. If a translation is not coherent with the desired language, translate it.';\n};\n\n/**\n * TranslateJSONs a content declaration file by constructing a prompt for AI models.\n * The prompt includes details about the project's locales, file paths of content declarations,\n * and requests for identifying issues or inconsistencies.\n */\nexport const translateJSON = async ({\n entryFileContent,\n presetOutputContent,\n dictionaryDescription,\n aiOptions,\n entryLocale,\n outputLocale,\n tags,\n mode,\n}: TranslateJSONOptions): Promise<TranslateJSONResultData | undefined> => {\n try {\n // Get the appropriate AI model configuration\n const aiConfig = await getAIConfig({\n provider: AIProvider.OPENAI,\n model: 'gpt-4o-mini-2024-07-18',\n ...aiOptions,\n });\n\n // Prepare the prompt for AI by replacing placeholders with actual values.\n const prompt = CHAT_GPT_PROMPT.replace(\n '{{entryLocale}}',\n formatLocaleWithName(entryLocale)\n )\n .replace('{{outputLocale}}', formatLocaleWithName(outputLocale))\n .replace('{{entryFileContent}}', JSON.stringify(entryFileContent))\n .replace('{{presetOutputContent}}', JSON.stringify(presetOutputContent))\n .replace('{{dictionaryDescription}}', dictionaryDescription)\n .replace('{{applicationContext}}', aiOptions?.applicationContext ?? '')\n .replace('{{tagsInstructions}}', formatTagInstructions(tags))\n .replace('{{modeInstructions}}', getModeInstructions(mode));\n\n if (!aiConfig) {\n logger.error('Failed to configure AI model');\n return undefined;\n }\n\n const result = await retryManager(async () => {\n // Use the AI SDK to generate the completion\n const { text: newContent, usage } = await generateText({\n model: aiConfig.model,\n temperature: aiConfig.temperature,\n messages: [{ role: 'system', content: prompt }],\n });\n\n logger.info(`${usage?.totalTokens ?? 0} tokens used in the request`);\n\n return {\n fileContent: extractJson(newContent),\n tokenUsed: usage?.totalTokens ?? 0,\n };\n })();\n\n return {\n fileContent: result.fileContent,\n tokenUsed: result.tokenUsed,\n };\n } cat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Y,CAAC,EAC9D,QAAQ,wBAAwB,KAAK,UAAU,gBAAgB,CAAC,EAChE,QAAQ,2BAA2B,KAAK,UAAU,mBAAmB,CAAC,EACtE,QAAQ,6BAA6B,qBAAqB,EAC1D,QAAQ,0BAA0B,WAAW,sBAAsB,EAAE,EACrE,QAAQ,wBAAwB,sBAAsB,IAAI,CAAC,EAC3D,QAAQ,wBAAwB,oBAAoB,IAAI,CAAC;AAE5D,QAAI,CAAC,UAAU;AACb,aAAO,MAAM,8BAA8B;AAC3C,aAAO;AAAA,IACT;AAEA,UAAM,SAAS,MAAM,aAAa,YAAY;AAE5C,YAAM,EAAE,MAAM,YAAY,MAAM,IAAI,MAAM,aAAa;AAAA,QACrD,OAAO,SAAS;AAAA,QAChB,aAAa,SAAS;AAAA,QACtB,UAAU,CAAC,EAAE,MAAM,UAAU,SAAS,OAAO,CAAC;AAAA,MAChD,CAAC;AAED,aAAO,KAAK,GAAG,OAAO,eAAe,CAAC,6BAA6B;AAEnE,aAAO;AAAA,QACL,aAAa,YAAY,UAAU;AAAA,QACnC,WAAW,OAAO,eAAe;AAAA,MACnC;AAAA,IACF,CAAC,EAAE;AAEH,WAAO;AAAA,MACL,aAAa,OAAO;AAAA,MACpB,WAAW,OAAO;AAAA,IACpB;AAAA,EACF,SAAS,OAAO;AACd,WAAO,MAAM,4BAA4B,OAAO;AAAA,MAC9C,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import type { Tag } from '../types/tag.types';
2
2
  import { type KeyPath } from '@intlayer/core';
3
3
  import type { ResponseWithInformation } from '../middlewares/sessionAuth.middleware';
4
- import { AIOptions } from '../utils/AI/aiSdk';
4
+ import type { AIOptions, ChatCompletionRequestMessage } from '../utils/AI/aiSdk';
5
5
  import * as askDocQuestionUtil from '../utils/AI/askDocQuestion/askDocQuestion';
6
6
  import * as auditContentDeclarationUtil from '../utils/AI/auditDictionary';
7
7
  import * as translateJSONUtil from '../utils/AI/translateJSON';
@@ -58,7 +58,7 @@ export type AuditTagResult = ResponseData<auditContentDeclarationUtil.AuditFileR
58
58
  */
59
59
  export declare const auditTag: (req: Request<undefined, undefined, AuditTagBody>, res: ResponseWithInformation<AuditTagResult>, _next: NextFunction) => Promise<void>;
60
60
  export type AskDocQuestionBody = {
61
- messages: askDocQuestionUtil.ChatCompletionRequestMessage[];
61
+ messages: ChatCompletionRequestMessage[];
62
62
  discutionId: string;
63
63
  };
64
64
  export type AskDocQuestionResult = ResponseData<askDocQuestionUtil.AskDocQuestionResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"ai.controller.d.ts","sourceRoot":"","sources":["../../../src/controllers/ai.controller.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAInF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,kBAAkB,MAAM,yCAAyC,CAAC;AAC9E,OAAO,KAAK,2BAA2B,MAAM,2BAA2B,CAAC;AAKzE,OAAO,KAAK,iBAAiB,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,iBAAiB,CAAC,oBAAoB,EACtC,MAAM,CACP,GAAG;IACF,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAC7B,YAAY,CAAC,iBAAiB,CAAC,uBAAuB,CAAC,CAAC;AAE1D,eAAO,MAAM,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ithInformation } from '../middlewares/sessionAuth.middleware';
2
+ import { type ResponseData } from '../utils/responseData';
3
+ import type { Request } from 'express';
4
+ export type SearchDocUtilParams = {
5
+ input: string;
6
+ };
7
+ export type SearchDocUtilResult = ResponseData<string[]>;
8
+ export declare const searchDocUtil: (req: Request<unknown, unknown, unknown, SearchDocUtilParams>, res: ResponseWithInformation<SearchDocUtilResult>) => Promise<void>;
9
+ //# sourceMappingURL=search.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.controller.d.ts","sourceRoot":"","sources":["../../../src/controllers/search.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAEnF,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;AAEzD,eAAO,MAAM,aAAa,GACxB,KAAK,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,CAAC,EAC5D,KAAK,uBAAuB,CAAC,mBAAmB,CAAC,kBAkBlD,CAAC"}
@@ -10,6 +10,7 @@ export type * from './controllers/oAuth2.controller';
10
10
  export type * from './controllers/organization.controller';
11
11
  export type * from './controllers/project.controller';
12
12
  export type * from './controllers/projectAccessKey.controller';
13
+ export type * from './controllers/search.controller';
13
14
  export type * from './controllers/sessionAuth.controller';
14
15
  export type * from './controllers/stripe.controller';
15
16
  export type * from './controllers/tag.controller';
@@ -1 +1 @@
1
- {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/export.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,qBA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CAAuC,CAAC;AAC3D,mBAAmB,gCAAgC,CAAC;AACpD,mBAAmB,sCAAsC,CAAC;AAC1D,mBAAmB,iCAAiC,CAAC;AACrD,mBAAmB,0CAA0C,CAAC;AAC9D,mBAAmB,gCAAgC,CAAC;AACpD,mBAAmB,qCAAqC,CAAC;AACzD,mBAAmB,gCAAgC,CAAC;AACpD,mBAAmB,6BAA6B,CAAC;AACjD,mBAAmB,8BAA8B,CAAC;AAGlD,mBAAmB,0BAA0B,CAAC;AAC9C,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,oBAAoB,CAAC;AAGxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,OAAgB,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AA+ChD,QAAA,MAAM,GAAG,EAAE,OAAmB,CAAC;AAgJ/B,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,OAAgB,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAgDhD,QAAA,MAAM,GAAG,EAAE,OAAmB,CAAC;AAiJ/B,eAAe,GAAG,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Router } from 'express';
2
+ export declare const searchRouter: Router;
3
+ export declare const getSearchRoutes: () => {
4
+ doc: {
5
+ urlModel: string;
6
+ url: string;
7
+ method: "GET";
8
+ };
9
+ };
10
+ //# sourceMappingURL=search.routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.routes.d.ts","sourceRoot":"","sources":["../../../src/routes/search.routes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,eAAO,MAAM,YAAY,EAAE,MAAiB,CAAC;AAI7C,eAAO,MAAM,eAAe;;;;;;CAOP,CAAC"}
@@ -30,6 +30,11 @@ export type AIModelConfig = {
30
30
  model: any;
31
31
  temperature?: number;
32
32
  };
33
+ export type ChatCompletionRequestMessage = {
34
+ role: 'system' | 'user' | 'assistant';
35
+ content: string;
36
+ timestamp?: Date;
37
+ };
33
38
  /**
34
39
  * Get AI model configuration based on the selected provider and options
35
40
  * This function handles the configuration for different AI providers
@@ -1 +1 @@
1
- {"version":3,"file":"aiSdk.d.ts","sourceRoot":"","sources":["../../../../src/utils/AI/aiSdk.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,MAAM,KAAK,GAEb,aAAa,GACb,QAAQ,GACR,SAAS,GACT,cAAc,GACd,cAAc,GACd,SAAS,GACT,eAAe,GACf,qBAAqB,GACrB,sBAAsB,GACtB,sBAAsB,GACtB,2BAA2B,GAC3B,SAAS,GACT,IAAI,GACJ,QAAQ,GACR,SAAS,GACT,cAAc,GACd,IAAI,GACJ,SAAS,GACT,cAAc,GAEd,yBAAyB,GACzB,0BAA0B,GAC1B,wBAAwB,GAExB,cAAc,GACd,eAAe,GACf,mBAAmB,GACnB,gBAAgB,GAChB,kBAAkB,GAClB,eAAe,GACf,iBAAiB,GACjB,sBAAsB,GACtB,WAAW,GACX,iBAAiB,GACjB,cAAc,GACd,eAAe,GACf,cAAc,GACd,eAAe,GAEf,gBAAgB,GAChB,eAAe,GACf,aAAa,GAEb,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB;;GAEG;AACH,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,GAAG,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GACtB,UAAU,SAAS,KAClB,OAAO,CAAC,aAAa,GAAG,SAAS,CA2GnC,CAAC"}
1
+ {"version":3,"file":"aiSdk.d.ts","sourceRoot":"","sources":["../../../../src/utils/AI/aiSdk.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,MAAM,KAAK,GAEb,aAAa,GACb,QAAQ,GACR,SAAS,GACT,cAAc,GACd,cAAc,GACd,SAAS,GACT,eAAe,GACf,qBAAqB,GACrB,sBAAsB,GACtB,sBAAsB,GACtB,2BAA2B,GAC3B,SAAS,GACT,IAAI,GACJ,QAAQ,GACR,SAAS,GACT,cAAc,GACd,IAAI,GACJ,SAAS,GACT,cAAc,GAEd,yBAAyB,GACzB,0BAA0B,GAC1B,wBAAwB,GAExB,cAAc,GACd,eAAe,GACf,mBAAmB,GACnB,gBAAgB,GAChB,kBAAkB,GAClB,eAAe,GACf,iBAAiB,GACjB,sBAAsB,GACtB,WAAW,GACX,iBAAiB,GACjB,cAAc,GACd,eAAe,GACf,cAAc,GACd,eAAe,GAEf,gBAAgB,GAChB,eAAe,GACf,aAAa,GAEb,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB;;GAEG;AACH,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,GAAG,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAGF,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GACtB,UAAU,SAAS,KAClB,OAAO,CAAC,aAAa,GAAG,SAAS,CA2GnC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { ChatCompletionRequestMessage } from '../aiSdk';
1
2
  type VectorStoreEl = {
2
3
  fileKey: string;
3
4
  chunkNumber: number;
@@ -16,12 +17,7 @@ export declare const indexMarkdownFiles: () => Promise<void>;
16
17
  * @param query - The search query provided by the user
17
18
  * @returns An array of the top matching document chunks' content
18
19
  */
19
- export declare const searchChunkReference: (query: string) => Promise<VectorStoreEl[]>;
20
- export type ChatCompletionRequestMessage = {
21
- role: 'system' | 'user' | 'assistant';
22
- content: string;
23
- timestamp?: Date;
24
- };
20
+ export declare const searchChunkReference: (query: string, maxResults?: number, minSimilarity?: number) => Promise<VectorStoreEl[]>;
25
21
  export declare const initPrompt: ChatCompletionRequestMessage;
26
22
  export type AskDocQuestionResult = {
27
23
  response: string;
@@ -1 +1 @@
1
- {"version":3,"file":"askDocQuestion.d.ts","sourceRoot":"","sources":["../../../../../src/utils/AI/askDocQuestion/askDocQuestion.ts"],"names":[],"mappings":"AAYA,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;AA6GF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAa,OAAO,CAAC,IAAI,CAuEvD,CAAC;AAKF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,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;IAChB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB,CAAC;AAmBF,eAAO,MAAM,UAAU,EAAE,4BAGxB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GACzB,UAAU,4BAA4B,EAAE,EACxC,UAAU,qBAAqB,KAC9B,OAAO,CAAC,oBAAoB,CA8D9B,CAAC"}
1
+ {"version":3,"file":"askDocQuestion.d.ts","sourceRoot":"","sources":["../../../../../src/utils/AI/askDocQuestion/askDocQuestion.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,4BAA4B,EAE7B,MAAM,UAAU,CAAC;AAGlB,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;AA6GF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAa,OAAO,CAAC,IAAI,CAuEvD,CAAC;AAKF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,MAAM,EACb,aAAY,MAA+B,EAC3C,gBAAe,MAAuC,KACrD,OAAO,CAAC,aAAa,EAAE,CAgBzB,CAAC;AAmBF,eAAO,MAAM,UAAU,EAAE,4BAGxB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GACzB,UAAU,4BAA4B,EAAE,EACxC,UAAU,qBAAqB,KAC9B,OAAO,CAAC,oBAAoB,CA8D9B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/backend",
3
- "version": "5.5.2",
3
+ "version": "5.5.4",
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": [
@@ -79,7 +79,7 @@
79
79
  "uuid": "^11.1.0",
80
80
  "validator": "^13.12.0",
81
81
  "winston": "^3.17.0",
82
- "express-intlayer": "5.5.2"
82
+ "express-intlayer": "5.5.4"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@types/body-parser": "^1.19.5",
@@ -103,15 +103,15 @@
103
103
  "tsup": "^8.4.0",
104
104
  "tsx": "^4.19.3",
105
105
  "typescript": "^5.8.2",
106
- "@intlayer/core": "5.5.2",
107
- "@intlayer/config": "5.5.2",
106
+ "@intlayer/config": "5.5.4",
107
+ "@intlayer/core": "5.5.4",
108
108
  "@utils/eslint-config": "1.0.4",
109
109
  "@utils/ts-config": "1.0.4",
110
110
  "@utils/ts-config-types": "1.0.4",
111
111
  "@utils/tsup-config": "1.0.4",
112
- "intlayer": "5.5.2",
113
- "@intlayer/blog": "^5.5.2",
114
- "@intlayer/docs": "5.5.2"
112
+ "intlayer": "5.5.4",
113
+ "@intlayer/blog": "^5.5.4",
114
+ "@intlayer/docs": "5.5.4"
115
115
  },
116
116
  "scripts": {
117
117
  "build": "pnpm build:package & pnpm build:types",