@nine-lab/nine-ai 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{few_shot-VTXaPiuI.js → few_shot-CsdUyb-S.js} +2 -2
- package/dist/{few_shot-VTXaPiuI.js.map → few_shot-CsdUyb-S.js.map} +1 -1
- package/dist/{index-BIpA0ust.js → index-bkxU1yQC.js} +181 -31
- package/dist/index-bkxU1yQC.js.map +1 -0
- package/dist/nine-ai.js +1 -1
- package/dist/nine-ai.umd.cjs +1 -1
- package/dist/nine-ai.umd.cjs.map +1 -1
- package/package.json +2 -1
- package/dist/index-BIpA0ust.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BaseStringPromptTemplate, c as checkValidTemplate, r as renderTemplate, P as PromptTemplate } from "./index-
|
|
1
|
+
import { B as BaseStringPromptTemplate, c as checkValidTemplate, r as renderTemplate, P as PromptTemplate } from "./index-bkxU1yQC.js";
|
|
2
2
|
class FewShotPromptTemplate extends BaseStringPromptTemplate {
|
|
3
3
|
constructor(input) {
|
|
4
4
|
super(input);
|
|
@@ -155,4 +155,4 @@ class FewShotPromptTemplate extends BaseStringPromptTemplate {
|
|
|
155
155
|
export {
|
|
156
156
|
FewShotPromptTemplate
|
|
157
157
|
};
|
|
158
|
-
//# sourceMappingURL=few_shot-
|
|
158
|
+
//# sourceMappingURL=few_shot-CsdUyb-S.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"few_shot-VTXaPiuI.js","sources":["../node_modules/@langchain/core/dist/prompts/few_shot.js"],"sourcesContent":["import { BaseStringPromptTemplate } from \"./string.js\";\nimport { checkValidTemplate, renderTemplate, } from \"./template.js\";\nimport { PromptTemplate } from \"./prompt.js\";\nimport { BaseChatPromptTemplate, } from \"./chat.js\";\n/**\n * Prompt template that contains few-shot examples.\n * @augments BasePromptTemplate\n * @augments FewShotPromptTemplateInput\n * @example\n * ```typescript\n * const examplePrompt = PromptTemplate.fromTemplate(\n * \"Input: {input}\\nOutput: {output}\",\n * );\n *\n * const exampleSelector = await SemanticSimilarityExampleSelector.fromExamples(\n * [\n * { input: \"happy\", output: \"sad\" },\n * { input: \"tall\", output: \"short\" },\n * { input: \"energetic\", output: \"lethargic\" },\n * { input: \"sunny\", output: \"gloomy\" },\n * { input: \"windy\", output: \"calm\" },\n * ],\n * new OpenAIEmbeddings(),\n * HNSWLib,\n * { k: 1 },\n * );\n *\n * const dynamicPrompt = new FewShotPromptTemplate({\n * exampleSelector,\n * examplePrompt,\n * prefix: \"Give the antonym of every input\",\n * suffix: \"Input: {adjective}\\nOutput:\",\n * inputVariables: [\"adjective\"],\n * });\n *\n * // Format the dynamic prompt with the input 'rainy'\n * console.log(await dynamicPrompt.format({ adjective: \"rainy\" }));\n *\n * ```\n */\nexport class FewShotPromptTemplate extends BaseStringPromptTemplate {\n constructor(input) {\n super(input);\n Object.defineProperty(this, \"lc_serializable\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(this, \"examples\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"exampleSelector\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"examplePrompt\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"suffix\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"\"\n });\n Object.defineProperty(this, \"exampleSeparator\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"\\n\\n\"\n });\n Object.defineProperty(this, \"prefix\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"\"\n });\n Object.defineProperty(this, \"templateFormat\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"f-string\"\n });\n Object.defineProperty(this, \"validateTemplate\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n Object.assign(this, input);\n if (this.examples !== undefined && this.exampleSelector !== undefined) {\n throw new Error(\"Only one of 'examples' and 'example_selector' should be provided\");\n }\n if (this.examples === undefined && this.exampleSelector === undefined) {\n throw new Error(\"One of 'examples' and 'example_selector' should be provided\");\n }\n if (this.validateTemplate) {\n let totalInputVariables = this.inputVariables;\n if (this.partialVariables) {\n totalInputVariables = totalInputVariables.concat(Object.keys(this.partialVariables));\n }\n checkValidTemplate(this.prefix + this.suffix, this.templateFormat, totalInputVariables);\n }\n }\n _getPromptType() {\n return \"few_shot\";\n }\n static lc_name() {\n return \"FewShotPromptTemplate\";\n }\n async getExamples(inputVariables) {\n if (this.examples !== undefined) {\n return this.examples;\n }\n if (this.exampleSelector !== undefined) {\n return this.exampleSelector.selectExamples(inputVariables);\n }\n throw new Error(\"One of 'examples' and 'example_selector' should be provided\");\n }\n async partial(values) {\n const newInputVariables = this.inputVariables.filter((iv) => !(iv in values));\n const newPartialVariables = {\n ...(this.partialVariables ?? {}),\n ...values,\n };\n const promptDict = {\n ...this,\n inputVariables: newInputVariables,\n partialVariables: newPartialVariables,\n };\n return new FewShotPromptTemplate(promptDict);\n }\n /**\n * Formats the prompt with the given values.\n * @param values The values to format the prompt with.\n * @returns A promise that resolves to a string representing the formatted prompt.\n */\n async format(values) {\n const allValues = await this.mergePartialAndUserVariables(values);\n const examples = await this.getExamples(allValues);\n const exampleStrings = await Promise.all(examples.map((example) => this.examplePrompt.format(example)));\n const template = [this.prefix, ...exampleStrings, this.suffix].join(this.exampleSeparator);\n return renderTemplate(template, this.templateFormat, allValues);\n }\n serialize() {\n if (this.exampleSelector || !this.examples) {\n throw new Error(\"Serializing an example selector is not currently supported\");\n }\n if (this.outputParser !== undefined) {\n throw new Error(\"Serializing an output parser is not currently supported\");\n }\n return {\n _type: this._getPromptType(),\n input_variables: this.inputVariables,\n example_prompt: this.examplePrompt.serialize(),\n example_separator: this.exampleSeparator,\n suffix: this.suffix,\n prefix: this.prefix,\n template_format: this.templateFormat,\n examples: this.examples,\n };\n }\n static async deserialize(data) {\n const { example_prompt } = data;\n if (!example_prompt) {\n throw new Error(\"Missing example prompt\");\n }\n const examplePrompt = await PromptTemplate.deserialize(example_prompt);\n let examples;\n if (Array.isArray(data.examples)) {\n examples = data.examples;\n }\n else {\n throw new Error(\"Invalid examples format. Only list or string are supported.\");\n }\n return new FewShotPromptTemplate({\n inputVariables: data.input_variables,\n examplePrompt,\n examples,\n exampleSeparator: data.example_separator,\n prefix: data.prefix,\n suffix: data.suffix,\n templateFormat: data.template_format,\n });\n }\n}\n/**\n * Chat prompt template that contains few-shot examples.\n * @augments BasePromptTemplateInput\n * @augments FewShotChatMessagePromptTemplateInput\n */\nexport class FewShotChatMessagePromptTemplate extends BaseChatPromptTemplate {\n _getPromptType() {\n return \"few_shot_chat\";\n }\n static lc_name() {\n return \"FewShotChatMessagePromptTemplate\";\n }\n constructor(fields) {\n super(fields);\n Object.defineProperty(this, \"lc_serializable\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n Object.defineProperty(this, \"examples\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"exampleSelector\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"examplePrompt\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"suffix\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"\"\n });\n Object.defineProperty(this, \"exampleSeparator\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"\\n\\n\"\n });\n Object.defineProperty(this, \"prefix\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"\"\n });\n Object.defineProperty(this, \"templateFormat\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"f-string\"\n });\n Object.defineProperty(this, \"validateTemplate\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n this.examples = fields.examples;\n this.examplePrompt = fields.examplePrompt;\n this.exampleSeparator = fields.exampleSeparator ?? \"\\n\\n\";\n this.exampleSelector = fields.exampleSelector;\n this.prefix = fields.prefix ?? \"\";\n this.suffix = fields.suffix ?? \"\";\n this.templateFormat = fields.templateFormat ?? \"f-string\";\n this.validateTemplate = fields.validateTemplate ?? true;\n if (this.examples !== undefined && this.exampleSelector !== undefined) {\n throw new Error(\"Only one of 'examples' and 'example_selector' should be provided\");\n }\n if (this.examples === undefined && this.exampleSelector === undefined) {\n throw new Error(\"One of 'examples' and 'example_selector' should be provided\");\n }\n if (this.validateTemplate) {\n let totalInputVariables = this.inputVariables;\n if (this.partialVariables) {\n totalInputVariables = totalInputVariables.concat(Object.keys(this.partialVariables));\n }\n checkValidTemplate(this.prefix + this.suffix, this.templateFormat, totalInputVariables);\n }\n }\n async getExamples(inputVariables) {\n if (this.examples !== undefined) {\n return this.examples;\n }\n if (this.exampleSelector !== undefined) {\n return this.exampleSelector.selectExamples(inputVariables);\n }\n throw new Error(\"One of 'examples' and 'example_selector' should be provided\");\n }\n /**\n * Formats the list of values and returns a list of formatted messages.\n * @param values The values to format the prompt with.\n * @returns A promise that resolves to a string representing the formatted prompt.\n */\n async formatMessages(values) {\n const allValues = await this.mergePartialAndUserVariables(values);\n let examples = await this.getExamples(allValues);\n examples = examples.map((example) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result = {};\n this.examplePrompt.inputVariables.forEach((inputVariable) => {\n result[inputVariable] = example[inputVariable];\n });\n return result;\n });\n const messages = [];\n for (const example of examples) {\n const exampleMessages = await this.examplePrompt.formatMessages(example);\n messages.push(...exampleMessages);\n }\n return messages;\n }\n /**\n * Formats the prompt with the given values.\n * @param values The values to format the prompt with.\n * @returns A promise that resolves to a string representing the formatted prompt.\n */\n async format(values) {\n const allValues = await this.mergePartialAndUserVariables(values);\n const examples = await this.getExamples(allValues);\n const exampleMessages = await Promise.all(examples.map((example) => this.examplePrompt.formatMessages(example)));\n const exampleStrings = exampleMessages\n .flat()\n .map((message) => message.content);\n const template = [this.prefix, ...exampleStrings, this.suffix].join(this.exampleSeparator);\n return renderTemplate(template, this.templateFormat, allValues);\n }\n /**\n * Partially formats the prompt with the given values.\n * @param values The values to partially format the prompt with.\n * @returns A promise that resolves to an instance of `FewShotChatMessagePromptTemplate` with the given values partially formatted.\n */\n async partial(values) {\n const newInputVariables = this.inputVariables.filter((variable) => !(variable in values));\n const newPartialVariables = {\n ...(this.partialVariables ?? {}),\n ...values,\n };\n const promptDict = {\n ...this,\n inputVariables: newInputVariables,\n partialVariables: newPartialVariables,\n };\n return new FewShotChatMessagePromptTemplate(promptDict);\n }\n}\n"],"names":[],"mappings":";AAwCO,MAAM,8BAA8B,yBAAyB;AAAA,EAChE,YAAY,OAAO;AACf,UAAM,KAAK;AACX,WAAO,eAAe,MAAM,mBAAmB;AAAA,MAC3C,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,UAAU;AAAA,MACV,OAAO;AAAA,IACnB,CAAS;AACD,WAAO,eAAe,MAAM,YAAY;AAAA,MACpC,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,UAAU;AAAA,MACV,OAAO;AAAA,IACnB,CAAS;AACD,WAAO,eAAe,MAAM,mBAAmB;AAAA,MAC3C,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,UAAU;AAAA,MACV,OAAO;AAAA,IACnB,CAAS;AACD,WAAO,eAAe,MAAM,iBAAiB;AAAA,MACzC,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,UAAU;AAAA,MACV,OAAO;AAAA,IACnB,CAAS;AACD,WAAO,eAAe,MAAM,UAAU;AAAA,MAClC,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,UAAU;AAAA,MACV,OAAO;AAAA,IACnB,CAAS;AACD,WAAO,eAAe,MAAM,oBAAoB;AAAA,MAC5C,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,UAAU;AAAA,MACV,OAAO;AAAA,IACnB,CAAS;AACD,WAAO,eAAe,MAAM,UAAU;AAAA,MAClC,YAAY;AAAA,MACZ,cAAc;A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5B,OACa;AACD,YAAM,IAAI,MAAM,6DAA6D;AAAA,IACzF;AACQ,WAAO,IAAI,sBAAsB;AAAA,MAC7B,gBAAgB,KAAK;AAAA,MACrB;AAAA,MACA;AAAA,MACA,kBAAkB,KAAK;AAAA,MACvB,QAAQ,KAAK;AAAA,MACb,QAAQ,KAAK;AAAA,MACb,gBAAgB,KAAK;AAAA,IACjC,CAAS;AAAA,EACT;AACA;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"few_shot-CsdUyb-S.js","sources":["../node_modules/@langchain/core/dist/prompts/few_shot.js"],"sourcesContent":["import { BaseStringPromptTemplate } from \"./string.js\";\nimport { checkValidTemplate, renderTemplate, } from \"./template.js\";\nimport { PromptTemplate } from \"./prompt.js\";\nimport { BaseChatPromptTemplate, } from \"./chat.js\";\n/**\n * Prompt template that contains few-shot examples.\n * @augments BasePromptTemplate\n * @augments FewShotPromptTemplateInput\n * @example\n * ```typescript\n * const examplePrompt = PromptTemplate.fromTemplate(\n * \"Input: {input}\\nOutput: {output}\",\n * );\n *\n * const exampleSelector = await SemanticSimilarityExampleSelector.fromExamples(\n * [\n * { input: \"happy\", output: \"sad\" },\n * { input: \"tall\", output: \"short\" },\n * { input: \"energetic\", output: \"lethargic\" },\n * { input: \"sunny\", output: \"gloomy\" },\n * { input: \"windy\", output: \"calm\" },\n * ],\n * new OpenAIEmbeddings(),\n * HNSWLib,\n * { k: 1 },\n * );\n *\n * const dynamicPrompt = new FewShotPromptTemplate({\n * exampleSelector,\n * examplePrompt,\n * prefix: \"Give the antonym of every input\",\n * suffix: \"Input: {adjective}\\nOutput:\",\n * inputVariables: [\"adjective\"],\n * });\n *\n * // Format the dynamic prompt with the input 'rainy'\n * console.log(await dynamicPrompt.format({ adjective: \"rainy\" }));\n *\n * ```\n */\nexport class FewShotPromptTemplate extends BaseStringPromptTemplate {\n constructor(input) {\n super(input);\n Object.defineProperty(this, \"lc_serializable\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(this, \"examples\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"exampleSelector\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"examplePrompt\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"suffix\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"\"\n });\n Object.defineProperty(this, \"exampleSeparator\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"\\n\\n\"\n });\n Object.defineProperty(this, \"prefix\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"\"\n });\n Object.defineProperty(this, \"templateFormat\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"f-string\"\n });\n Object.defineProperty(this, \"validateTemplate\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n Object.assign(this, input);\n if (this.examples !== undefined && this.exampleSelector !== undefined) {\n throw new Error(\"Only one of 'examples' and 'example_selector' should be provided\");\n }\n if (this.examples === undefined && this.exampleSelector === undefined) {\n throw new Error(\"One of 'examples' and 'example_selector' should be provided\");\n }\n if (this.validateTemplate) {\n let totalInputVariables = this.inputVariables;\n if (this.partialVariables) {\n totalInputVariables = totalInputVariables.concat(Object.keys(this.partialVariables));\n }\n checkValidTemplate(this.prefix + this.suffix, this.templateFormat, totalInputVariables);\n }\n }\n _getPromptType() {\n return \"few_shot\";\n }\n static lc_name() {\n return \"FewShotPromptTemplate\";\n }\n async getExamples(inputVariables) {\n if (this.examples !== undefined) {\n return this.examples;\n }\n if (this.exampleSelector !== undefined) {\n return this.exampleSelector.selectExamples(inputVariables);\n }\n throw new Error(\"One of 'examples' and 'example_selector' should be provided\");\n }\n async partial(values) {\n const newInputVariables = this.inputVariables.filter((iv) => !(iv in values));\n const newPartialVariables = {\n ...(this.partialVariables ?? {}),\n ...values,\n };\n const promptDict = {\n ...this,\n inputVariables: newInputVariables,\n partialVariables: newPartialVariables,\n };\n return new FewShotPromptTemplate(promptDict);\n }\n /**\n * Formats the prompt with the given values.\n * @param values The values to format the prompt with.\n * @returns A promise that resolves to a string representing the formatted prompt.\n */\n async format(values) {\n const allValues = await this.mergePartialAndUserVariables(values);\n const examples = await this.getExamples(allValues);\n const exampleStrings = await Promise.all(examples.map((example) => this.examplePrompt.format(example)));\n const template = [this.prefix, ...exampleStrings, this.suffix].join(this.exampleSeparator);\n return renderTemplate(template, this.templateFormat, allValues);\n }\n serialize() {\n if (this.exampleSelector || !this.examples) {\n throw new Error(\"Serializing an example selector is not currently supported\");\n }\n if (this.outputParser !== undefined) {\n throw new Error(\"Serializing an output parser is not currently supported\");\n }\n return {\n _type: this._getPromptType(),\n input_variables: this.inputVariables,\n example_prompt: this.examplePrompt.serialize(),\n example_separator: this.exampleSeparator,\n suffix: this.suffix,\n prefix: this.prefix,\n template_format: this.templateFormat,\n examples: this.examples,\n };\n }\n static async deserialize(data) {\n const { example_prompt } = data;\n if (!example_prompt) {\n throw new Error(\"Missing example prompt\");\n }\n const examplePrompt = await PromptTemplate.deserialize(example_prompt);\n let examples;\n if (Array.isArray(data.examples)) {\n examples = data.examples;\n }\n else {\n throw new Error(\"Invalid examples format. Only list or string are supported.\");\n }\n return new FewShotPromptTemplate({\n inputVariables: data.input_variables,\n examplePrompt,\n examples,\n exampleSeparator: data.example_separator,\n prefix: data.prefix,\n suffix: data.suffix,\n templateFormat: data.template_format,\n });\n }\n}\n/**\n * Chat prompt template that contains few-shot examples.\n * @augments BasePromptTemplateInput\n * @augments FewShotChatMessagePromptTemplateInput\n */\nexport class FewShotChatMessagePromptTemplate extends BaseChatPromptTemplate {\n _getPromptType() {\n return \"few_shot_chat\";\n }\n static lc_name() {\n return \"FewShotChatMessagePromptTemplate\";\n }\n constructor(fields) {\n super(fields);\n Object.defineProperty(this, \"lc_serializable\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n Object.defineProperty(this, \"examples\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"exampleSelector\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"examplePrompt\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"suffix\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"\"\n });\n Object.defineProperty(this, \"exampleSeparator\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"\\n\\n\"\n });\n Object.defineProperty(this, \"prefix\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"\"\n });\n Object.defineProperty(this, \"templateFormat\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"f-string\"\n });\n Object.defineProperty(this, \"validateTemplate\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n });\n this.examples = fields.examples;\n this.examplePrompt = fields.examplePrompt;\n this.exampleSeparator = fields.exampleSeparator ?? \"\\n\\n\";\n this.exampleSelector = fields.exampleSelector;\n this.prefix = fields.prefix ?? \"\";\n this.suffix = fields.suffix ?? \"\";\n this.templateFormat = fields.templateFormat ?? \"f-string\";\n this.validateTemplate = fields.validateTemplate ?? true;\n if (this.examples !== undefined && this.exampleSelector !== undefined) {\n throw new Error(\"Only one of 'examples' and 'example_selector' should be provided\");\n }\n if (this.examples === undefined && this.exampleSelector === undefined) {\n throw new Error(\"One of 'examples' and 'example_selector' should be provided\");\n }\n if (this.validateTemplate) {\n let totalInputVariables = this.inputVariables;\n if (this.partialVariables) {\n totalInputVariables = totalInputVariables.concat(Object.keys(this.partialVariables));\n }\n checkValidTemplate(this.prefix + this.suffix, this.templateFormat, totalInputVariables);\n }\n }\n async getExamples(inputVariables) {\n if (this.examples !== undefined) {\n return this.examples;\n }\n if (this.exampleSelector !== undefined) {\n return this.exampleSelector.selectExamples(inputVariables);\n }\n throw new Error(\"One of 'examples' and 'example_selector' should be provided\");\n }\n /**\n * Formats the list of values and returns a list of formatted messages.\n * @param values The values to format the prompt with.\n * @returns A promise that resolves to a string representing the formatted prompt.\n */\n async formatMessages(values) {\n const allValues = await this.mergePartialAndUserVariables(values);\n let examples = await this.getExamples(allValues);\n examples = examples.map((example) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result = {};\n this.examplePrompt.inputVariables.forEach((inputVariable) => {\n result[inputVariable] = example[inputVariable];\n });\n return result;\n });\n const messages = [];\n for (const example of examples) {\n const exampleMessages = await this.examplePrompt.formatMessages(example);\n messages.push(...exampleMessages);\n }\n return messages;\n }\n /**\n * Formats the prompt with the given values.\n * @param values The values to format the prompt with.\n * @returns A promise that resolves to a string representing the formatted prompt.\n */\n async format(values) {\n const allValues = await this.mergePartialAndUserVariables(values);\n const examples = await this.getExamples(allValues);\n const exampleMessages = await Promise.all(examples.map((example) => this.examplePrompt.formatMessages(example)));\n const exampleStrings = exampleMessages\n .flat()\n .map((message) => message.content);\n const template = [this.prefix, ...exampleStrings, this.suffix].join(this.exampleSeparator);\n return renderTemplate(template, this.templateFormat, allValues);\n }\n /**\n * Partially formats the prompt with the given values.\n * @param values The values to partially format the prompt with.\n * @returns A promise that resolves to an instance of `FewShotChatMessagePromptTemplate` with the given values partially formatted.\n */\n async partial(values) {\n const newInputVariables = this.inputVariables.filter((variable) => !(variable in values));\n const newPartialVariables = {\n ...(this.partialVariables ?? {}),\n ...values,\n };\n const promptDict = {\n ...this,\n inputVariables: newInputVariables,\n partialVariables: newPartialVariables,\n };\n return new FewShotChatMessagePromptTemplate(promptDict);\n }\n}\n"],"names":[],"mappings":";AAwCO,MAAM,8BAA8B,yBAAyB;AAAA,EAChE,YAAY,OAAO;AACf,UAAM,KAAK;AACX,WAAO,eAAe,MAAM,mBAAmB;AAAA,MAC3C,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,UAAU;AAAA,MACV,OAAO;AAAA,IACnB,CAAS;AACD,WAAO,eAAe,MAAM,YAAY;AAAA,MACpC,YAAY;AAAA,MACZ,cAAc;AAAA,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I,KAAK,iBAAiB,QAAW;AACjC,YAAM,IAAI,MAAM,yDAAyD;AAAA,IACrF;AACQ,WAAO;AAAA,MACH,OAAO,KAAK,eAAc;AAAA,MAC1B,iBAAiB,KAAK;AAAA,MACtB,gBAAgB,KAAK,cAAc,UAAS;AAAA,MAC5C,mBAAmB,KAAK;AAAA,MACxB,QAAQ,KAAK;AAAA,MACb,QAAQ,KAAK;AAAA,MACb,iBAAiB,KAAK;AAAA,MACtB,UAAU,KAAK;AAAA,IAC3B;AAAA,EACA;AAAA,EACI,aAAa,YAAY,MAAM;AAC3B,UAAM,EAAE,eAAc,IAAK;AAC3B,QAAI,CAAC,gBAAgB;AACjB,YAAM,IAAI,MAAM,wBAAwB;AAAA,IACpD;AACQ,UAAM,gBAAgB,MAAM,eAAe,YAAY,cAAc;AACrE,QAAI;AACJ,QAAI,MAAM,QAAQ,KAAK,QAAQ,GAAG;AAC9B,iBAAW,KAAK;AAAA,IAC5B,OACa;AACD,YAAM,IAAI,MAAM,6DAA6D;AAAA,IACzF;AACQ,WAAO,IAAI,sBAAsB;AAAA,MAC7B,gBAAgB,KAAK;AAAA,MACrB;AAAA,MACA;AAAA,MACA,kBAAkB,KAAK;AAAA,MACvB,QAAQ,KAAK;AAAA,MACb,QAAQ,KAAK;AAAA,MACb,gBAAgB,KAAK;AAAA,IACjC,CAAS;AAAA,EACT;AACA;","x_google_ignoreList":[0]}
|
|
@@ -8,7 +8,7 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
|
|
|
8
8
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
|
-
var _BASE_URL,
|
|
11
|
+
var _BASE_URL, _request2, _API_URL, _SCHEMA, _model, _parent, _createModel, _getMenuInfo, _getTableList, _getColumnInfo, _invoke, _what, _where, _generateTmplFile, _findFirstEmptyDetailWrapper, _findActiveDetailWrapperIndex, _getSourcePath, _generateSource, _generateDetailSource, _modifyDetailSource, _ing, _ai, _config, _loadLocalSettings, _saveLocalSettings, _init, _keydownHandler, _toggleCollapseHandler, _menuClickHandler, _init2, _tips, _currentTipIndex, _currentImageIndex, _tipIntervalId, _imageIntervalId, _tipDisplayDuration, _imageDisplayDuration, _ideLoadingTipsInstance, _tipsUrl, _tipCategory, _init3, _changedSource, _init4, _apply, _asisEditorView, _tobeEditorView, _asisEditorEl, _tobeEditorEl, _languageCompartment, _isScrollSyncActive, _initCodeMirror, _setupScrollSync, _applyDiffDecorations, _apiKey, _xmlPath, _queryId, _selectFunc, _target, _keyDownHandler, _init5;
|
|
12
12
|
import ninegrid from "ninegrid2";
|
|
13
13
|
var util;
|
|
14
14
|
(function(util2) {
|
|
@@ -4913,7 +4913,7 @@ class MockTracer {
|
|
|
4913
4913
|
value: false
|
|
4914
4914
|
});
|
|
4915
4915
|
}
|
|
4916
|
-
startActiveSpan(
|
|
4916
|
+
startActiveSpan(_name2, ...args) {
|
|
4917
4917
|
if (!this.hasWarned && getOtelEnabled()) {
|
|
4918
4918
|
console.warn('You have enabled OTEL export via the `OTEL_ENABLED` or `LANGSMITH_OTEL_ENABLED` environment variable, but have not initialized the required OTEL instances. Please add:\n```\nimport { initializeOTEL } from "langsmith/experimental/otel/setup";\ninitializeOTEL();\n```\nat the beginning of your code.');
|
|
4919
4919
|
this.hasWarned = true;
|
|
@@ -4941,7 +4941,7 @@ class MockOTELTrace {
|
|
|
4941
4941
|
value: new MockTracer()
|
|
4942
4942
|
});
|
|
4943
4943
|
}
|
|
4944
|
-
getTracer(
|
|
4944
|
+
getTracer(_name2, _version) {
|
|
4945
4945
|
return this.mockTracer;
|
|
4946
4946
|
}
|
|
4947
4947
|
getActiveSpan() {
|
|
@@ -9935,7 +9935,7 @@ Context: ${context}`);
|
|
|
9935
9935
|
}
|
|
9936
9936
|
}
|
|
9937
9937
|
}
|
|
9938
|
-
async getRunStats({ id: id2, trace, parentRun, runType, projectNames, projectIds, referenceExampleIds, startTime, endTime, error, query, filter, traceFilter, treeFilter, isRoot, dataSourceType }) {
|
|
9938
|
+
async getRunStats({ id: id2, trace: trace2, parentRun, runType, projectNames, projectIds, referenceExampleIds, startTime, endTime, error, query, filter, traceFilter, treeFilter, isRoot, dataSourceType }) {
|
|
9939
9939
|
let projectIds_ = projectIds || [];
|
|
9940
9940
|
if (projectNames) {
|
|
9941
9941
|
projectIds_ = [
|
|
@@ -9945,7 +9945,7 @@ Context: ${context}`);
|
|
|
9945
9945
|
}
|
|
9946
9946
|
const payload = {
|
|
9947
9947
|
id: id2,
|
|
9948
|
-
trace,
|
|
9948
|
+
trace: trace2,
|
|
9949
9949
|
parent_run: parentRun,
|
|
9950
9950
|
run_type: runType,
|
|
9951
9951
|
session: projectIds_,
|
|
@@ -23105,7 +23105,7 @@ class BasePromptTemplate extends Runnable {
|
|
|
23105
23105
|
return PromptTemplate2.deserialize({ ...data, _type: "prompt" });
|
|
23106
23106
|
}
|
|
23107
23107
|
case "few_shot": {
|
|
23108
|
-
const { FewShotPromptTemplate } = await import("./few_shot-
|
|
23108
|
+
const { FewShotPromptTemplate } = await import("./few_shot-CsdUyb-S.js");
|
|
23109
23109
|
return FewShotPromptTemplate.deserialize(data);
|
|
23110
23110
|
}
|
|
23111
23111
|
default:
|
|
@@ -23926,9 +23926,9 @@ const prompt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
23926
23926
|
const _IdeFetch = class _IdeFetch {
|
|
23927
23927
|
};
|
|
23928
23928
|
_BASE_URL = new WeakMap();
|
|
23929
|
-
|
|
23929
|
+
_request2 = new WeakMap();
|
|
23930
23930
|
__privateAdd(_IdeFetch, _BASE_URL, window.__API_BASE_URL__ || "");
|
|
23931
|
-
__privateAdd(_IdeFetch,
|
|
23931
|
+
__privateAdd(_IdeFetch, _request2, (method, url, data = {}) => {
|
|
23932
23932
|
url = `${__privateGet(_IdeFetch, _BASE_URL)}${url}`;
|
|
23933
23933
|
ninegrid.loading.show();
|
|
23934
23934
|
console.log(method, url, data);
|
|
@@ -23956,14 +23956,14 @@ __privateAdd(_IdeFetch, _request, (method, url, data = {}) => {
|
|
|
23956
23956
|
});
|
|
23957
23957
|
__publicField(_IdeFetch, "get", (url, data = {}) => {
|
|
23958
23958
|
var _a2;
|
|
23959
|
-
return __privateGet(_a2 = _IdeFetch,
|
|
23959
|
+
return __privateGet(_a2 = _IdeFetch, _request2).call(_a2, "GET", url, data);
|
|
23960
23960
|
});
|
|
23961
23961
|
__publicField(_IdeFetch, "post", (url, data = {}) => {
|
|
23962
23962
|
var _a2;
|
|
23963
|
-
return __privateGet(_a2 = _IdeFetch,
|
|
23963
|
+
return __privateGet(_a2 = _IdeFetch, _request2).call(_a2, "POST", url, data);
|
|
23964
23964
|
});
|
|
23965
23965
|
let IdeFetch = _IdeFetch;
|
|
23966
|
-
const api = IdeFetch;
|
|
23966
|
+
const api$1 = IdeFetch;
|
|
23967
23967
|
class IdeUtils {
|
|
23968
23968
|
constructor() {
|
|
23969
23969
|
}
|
|
@@ -25668,10 +25668,10 @@ function requireBase64Js() {
|
|
|
25668
25668
|
}
|
|
25669
25669
|
var base64JsExports = requireBase64Js();
|
|
25670
25670
|
const base64 = /* @__PURE__ */ getDefaultExportFromCjs(base64JsExports);
|
|
25671
|
-
var __defProp$
|
|
25672
|
-
var __defNormalProp$
|
|
25673
|
-
var __publicField$
|
|
25674
|
-
__defNormalProp$
|
|
25671
|
+
var __defProp$3 = Object.defineProperty;
|
|
25672
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
25673
|
+
var __publicField$3 = (obj, key, value) => {
|
|
25674
|
+
__defNormalProp$3(obj, key + "", value);
|
|
25675
25675
|
return value;
|
|
25676
25676
|
};
|
|
25677
25677
|
function bytePairMerge(piece, ranks) {
|
|
@@ -25817,7 +25817,7 @@ var _Tiktoken = class {
|
|
|
25817
25817
|
}
|
|
25818
25818
|
};
|
|
25819
25819
|
var Tiktoken = _Tiktoken;
|
|
25820
|
-
__publicField$
|
|
25820
|
+
__publicField$3(Tiktoken, "specialTokenRegex", (tokens) => {
|
|
25821
25821
|
return new RegExp(tokens.map((i) => escapeRegex(i)).join("|"), "g");
|
|
25822
25822
|
});
|
|
25823
25823
|
function getEncodingNameForModel(model) {
|
|
@@ -28973,17 +28973,17 @@ const formatHost = (host) => {
|
|
|
28973
28973
|
}
|
|
28974
28974
|
return formattedHost;
|
|
28975
28975
|
};
|
|
28976
|
-
var
|
|
28977
|
-
var
|
|
28978
|
-
var
|
|
28979
|
-
|
|
28976
|
+
var __defProp$2 = Object.defineProperty;
|
|
28977
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
28978
|
+
var __publicField$2 = (obj, key, value) => {
|
|
28979
|
+
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
28980
28980
|
return value;
|
|
28981
28981
|
};
|
|
28982
28982
|
let Ollama$1 = class Ollama {
|
|
28983
28983
|
constructor(config2) {
|
|
28984
|
-
|
|
28985
|
-
|
|
28986
|
-
|
|
28984
|
+
__publicField$2(this, "config");
|
|
28985
|
+
__publicField$2(this, "fetch");
|
|
28986
|
+
__publicField$2(this, "ongoingStreamedRequests", []);
|
|
28987
28987
|
this.config = {
|
|
28988
28988
|
host: "",
|
|
28989
28989
|
headers: config2 == null ? void 0 : config2.headers
|
|
@@ -39818,7 +39818,7 @@ class IdeAi {
|
|
|
39818
39818
|
if (src.endsWith("```")) {
|
|
39819
39819
|
src = src.slice(0, -3);
|
|
39820
39820
|
}
|
|
39821
|
-
await api.post(`/api/source/generateTmplFile`, {
|
|
39821
|
+
await api$1.post(`/api/source/generateTmplFile`, {
|
|
39822
39822
|
basePath: `${__privateGet(this, _parent).settings.beProjectName}/tmpl`,
|
|
39823
39823
|
fileNm: generateFileName,
|
|
39824
39824
|
contents: src
|
|
@@ -39905,7 +39905,7 @@ class IdeAi {
|
|
|
39905
39905
|
}
|
|
39906
39906
|
const srcPath = __privateGet(this, _getSourcePath).call(this, href);
|
|
39907
39907
|
console.log(where, srcPath);
|
|
39908
|
-
const src = await api.post("/api/source/read", srcPath);
|
|
39908
|
+
const src = await api$1.post("/api/source/read", srcPath);
|
|
39909
39909
|
console.log(src);
|
|
39910
39910
|
progressMessageInstance.updateProgress("prepare2", "completed");
|
|
39911
39911
|
const columnInfo = await __privateGet(this, _getColumnInfo).call(this, where.table);
|
|
@@ -40074,7 +40074,7 @@ class IdeAi {
|
|
|
40074
40074
|
const title = el.getAttribute("title");
|
|
40075
40075
|
const srcPath = __privateGet(this, _getSourcePath).call(this, href);
|
|
40076
40076
|
console.log(srcPath);
|
|
40077
|
-
const src = await api.post("/api/source/read", srcPath);
|
|
40077
|
+
const src = await api$1.post("/api/source/read", srcPath);
|
|
40078
40078
|
const where = await __privateGet(this, _where).call(this, `${title}에서 ${userPrompt}`, [{ url: href, title }], await __privateGet(this, _getTableList).call(this));
|
|
40079
40079
|
progressMessageInstance.updateProgress("prepare2", "completed");
|
|
40080
40080
|
console.log(where);
|
|
@@ -40209,7 +40209,7 @@ class IdeAi {
|
|
|
40209
40209
|
const title = el.getAttribute("title");
|
|
40210
40210
|
const srcPath = __privateGet(this, _getSourcePath).call(this, href);
|
|
40211
40211
|
console.log(srcPath);
|
|
40212
|
-
const src = await api.post("/api/source/read", srcPath);
|
|
40212
|
+
const src = await api$1.post("/api/source/read", srcPath);
|
|
40213
40213
|
const where = await __privateGet(this, _where).call(this, `${title}에서 ${userPrompt}`, [{ url: href, title }], await __privateGet(this, _getTableList).call(this));
|
|
40214
40214
|
progressMessageInstance.updateProgress("prepare2", "completed");
|
|
40215
40215
|
console.log(where);
|
|
@@ -40387,7 +40387,7 @@ __publicField(IdeAi, "generateWhereCause", async (xmlPath, queryId, userPrompt,
|
|
|
40387
40387
|
throw error;
|
|
40388
40388
|
}
|
|
40389
40389
|
};
|
|
40390
|
-
const res = await api.post("/api/source/query", {
|
|
40390
|
+
const res = await api$1.post("/api/source/query", {
|
|
40391
40391
|
xmlPath,
|
|
40392
40392
|
queryId
|
|
40393
40393
|
});
|
|
@@ -40399,6 +40399,156 @@ __publicField(IdeAi, "generateWhereCause", async (xmlPath, queryId, userPrompt,
|
|
|
40399
40399
|
return o;
|
|
40400
40400
|
}
|
|
40401
40401
|
});
|
|
40402
|
+
var __defProp2 = Object.defineProperty;
|
|
40403
|
+
var __typeError2 = (msg) => {
|
|
40404
|
+
throw TypeError(msg);
|
|
40405
|
+
};
|
|
40406
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
40407
|
+
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
40408
|
+
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
40409
|
+
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), member.get(obj));
|
|
40410
|
+
var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
40411
|
+
var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), member.set(obj, value), value);
|
|
40412
|
+
var __privateMethod = (obj, member, method) => (__accessCheck2(obj, member, "access private method"), method);
|
|
40413
|
+
var _name, _color, _enabled, _Trace_instances, autoConfig_fn, _request;
|
|
40414
|
+
class Trace {
|
|
40415
|
+
// 👈 이 상태값이 기준이 됩니다.
|
|
40416
|
+
constructor(name2 = null, color2 = "green") {
|
|
40417
|
+
__privateAdd2(this, _Trace_instances);
|
|
40418
|
+
__privateAdd2(this, _name);
|
|
40419
|
+
__privateAdd2(this, _color);
|
|
40420
|
+
__privateAdd2(this, _enabled, true);
|
|
40421
|
+
__privateSet2(this, _name, name2);
|
|
40422
|
+
__privateSet2(this, _color, color2);
|
|
40423
|
+
__privateMethod(this, _Trace_instances, autoConfig_fn).call(this);
|
|
40424
|
+
}
|
|
40425
|
+
init(name2, color2 = "green") {
|
|
40426
|
+
__privateSet2(this, _name, name2);
|
|
40427
|
+
__privateSet2(this, _color, color2);
|
|
40428
|
+
}
|
|
40429
|
+
// 🔴 핵심: 함수를 갈아끼우지 않고, 호출될 때마다 상태를 체크합니다.
|
|
40430
|
+
log(...args) {
|
|
40431
|
+
if (!__privateGet2(this, _enabled)) return;
|
|
40432
|
+
const style = `color: ${__privateGet2(this, _color)}; font-weight: bold;`;
|
|
40433
|
+
__privateGet2(this, _name) ? console.log(`%c[${__privateGet2(this, _name)}]`, style, ...args) : console.log(...args);
|
|
40434
|
+
}
|
|
40435
|
+
warn(...args) {
|
|
40436
|
+
if (!__privateGet2(this, _enabled)) return;
|
|
40437
|
+
__privateGet2(this, _name) ? console.warn(`%c[${__privateGet2(this, _name)}]`, "color: cyan; font-weight: bold;", ...args) : console.warn(...args);
|
|
40438
|
+
}
|
|
40439
|
+
error(...args) {
|
|
40440
|
+
__privateGet2(this, _name) ? console.error(`%c[${__privateGet2(this, _name)}]`, "color: red; font-weight: bold;", ...args) : console.error(...args);
|
|
40441
|
+
}
|
|
40442
|
+
enable() {
|
|
40443
|
+
__privateSet2(this, _enabled, true);
|
|
40444
|
+
}
|
|
40445
|
+
disable() {
|
|
40446
|
+
__privateSet2(this, _enabled, false);
|
|
40447
|
+
}
|
|
40448
|
+
}
|
|
40449
|
+
_name = /* @__PURE__ */ new WeakMap();
|
|
40450
|
+
_color = /* @__PURE__ */ new WeakMap();
|
|
40451
|
+
_enabled = /* @__PURE__ */ new WeakMap();
|
|
40452
|
+
_Trace_instances = /* @__PURE__ */ new WeakSet();
|
|
40453
|
+
autoConfig_fn = function() {
|
|
40454
|
+
if (typeof window === "undefined") return;
|
|
40455
|
+
const isLocal = window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.startsWith("192.168.");
|
|
40456
|
+
if (isLocal) {
|
|
40457
|
+
this.enable();
|
|
40458
|
+
} else {
|
|
40459
|
+
this.disable();
|
|
40460
|
+
console.log(
|
|
40461
|
+
`%c[${__privateGet2(this, _name)}]%c 운영 모드: 로그가 비활성화되었습니다. %ctrace.enable()%c 로 켤 수 있습니다.`,
|
|
40462
|
+
"color: #4CAF50; font-weight: bold;",
|
|
40463
|
+
"",
|
|
40464
|
+
"background: #333; color: yellow; padding: 2px 5px;",
|
|
40465
|
+
""
|
|
40466
|
+
);
|
|
40467
|
+
}
|
|
40468
|
+
};
|
|
40469
|
+
const trace = new Trace();
|
|
40470
|
+
if (typeof window !== "undefined") {
|
|
40471
|
+
window.trace = trace;
|
|
40472
|
+
}
|
|
40473
|
+
class Loading {
|
|
40474
|
+
static show() {
|
|
40475
|
+
let overlay = document.getElementById("global-loading-overlay");
|
|
40476
|
+
if (!overlay) {
|
|
40477
|
+
overlay = document.createElement("div");
|
|
40478
|
+
overlay.id = "global-loading-overlay";
|
|
40479
|
+
overlay.style.cssText = `
|
|
40480
|
+
position: fixed; inset: 0; z-index: 9999;
|
|
40481
|
+
background: rgba(0, 0, 0, 0.4); display: flex;
|
|
40482
|
+
justify-content: center; align-items: center;
|
|
40483
|
+
backdrop-filter: blur(2px);
|
|
40484
|
+
`;
|
|
40485
|
+
overlay.innerHTML = `<div class="loading-spinner"></div>`;
|
|
40486
|
+
document.body.appendChild(overlay);
|
|
40487
|
+
if (!document.getElementById("nine-util-style")) {
|
|
40488
|
+
const style = document.createElement("style");
|
|
40489
|
+
style.id = "nine-util-style";
|
|
40490
|
+
style.innerHTML = `
|
|
40491
|
+
.loading-spinner {
|
|
40492
|
+
width: 48px; height: 48px;
|
|
40493
|
+
border: 5px solid rgba(255, 255, 255, 0.3);
|
|
40494
|
+
border-top-color: white; border-radius: 50%;
|
|
40495
|
+
animation: nine-spin 1s linear infinite;
|
|
40496
|
+
}
|
|
40497
|
+
@keyframes nine-spin { to { transform: rotate(360deg); } }
|
|
40498
|
+
`;
|
|
40499
|
+
document.head.appendChild(style);
|
|
40500
|
+
}
|
|
40501
|
+
}
|
|
40502
|
+
overlay.style.display = "flex";
|
|
40503
|
+
}
|
|
40504
|
+
static hide() {
|
|
40505
|
+
const overlay = document.getElementById("global-loading-overlay");
|
|
40506
|
+
if (overlay) overlay.style.display = "none";
|
|
40507
|
+
}
|
|
40508
|
+
}
|
|
40509
|
+
const _Fetch = class _Fetch2 {
|
|
40510
|
+
};
|
|
40511
|
+
_request = /* @__PURE__ */ new WeakMap();
|
|
40512
|
+
__publicField2(_Fetch, "BASE_URL", window.__API_BASE_URL__ || "");
|
|
40513
|
+
__privateAdd2(_Fetch, _request, (method, url, data = {}) => {
|
|
40514
|
+
const finalUrl = url.startsWith("http") ? url : `${_Fetch.BASE_URL}${url}`;
|
|
40515
|
+
Loading.show();
|
|
40516
|
+
console.log(`[IdeFetch] ${method}`, finalUrl, data);
|
|
40517
|
+
const options = {
|
|
40518
|
+
method,
|
|
40519
|
+
headers: { "Content-Type": "application/json" }
|
|
40520
|
+
};
|
|
40521
|
+
let targetUrl = finalUrl;
|
|
40522
|
+
if (method === "GET") {
|
|
40523
|
+
targetUrl += `?${new URLSearchParams(data)}`;
|
|
40524
|
+
} else {
|
|
40525
|
+
options.body = JSON.stringify(data);
|
|
40526
|
+
}
|
|
40527
|
+
return fetch(targetUrl, options).then(async (res) => {
|
|
40528
|
+
if (!url.includes("/api/source/query")) {
|
|
40529
|
+
Loading.hide();
|
|
40530
|
+
}
|
|
40531
|
+
if (!res.ok) {
|
|
40532
|
+
const text = await res.text();
|
|
40533
|
+
throw new Error(`API 오류 (${res.status}): ${text}`);
|
|
40534
|
+
}
|
|
40535
|
+
return res.json();
|
|
40536
|
+
}).catch((err) => {
|
|
40537
|
+
Loading.hide();
|
|
40538
|
+
console.error(`[IdeFetch.${method.toLowerCase()}] ${finalUrl} 실패:`, err);
|
|
40539
|
+
throw err;
|
|
40540
|
+
});
|
|
40541
|
+
});
|
|
40542
|
+
__publicField2(_Fetch, "get", (url, data = {}) => {
|
|
40543
|
+
var _a2;
|
|
40544
|
+
return __privateGet2(_a2 = _Fetch, _request).call(_a2, "GET", url, data);
|
|
40545
|
+
});
|
|
40546
|
+
__publicField2(_Fetch, "post", (url, data = {}) => {
|
|
40547
|
+
var _a2;
|
|
40548
|
+
return __privateGet2(_a2 = _Fetch, _request).call(_a2, "POST", url, data);
|
|
40549
|
+
});
|
|
40550
|
+
let Fetch = _Fetch;
|
|
40551
|
+
const api = Fetch;
|
|
40402
40552
|
class IdeAssi extends HTMLElement {
|
|
40403
40553
|
constructor() {
|
|
40404
40554
|
super();
|
|
@@ -40407,7 +40557,7 @@ class IdeAssi extends HTMLElement {
|
|
|
40407
40557
|
__publicField(this, "settings");
|
|
40408
40558
|
__publicField(this, "config");
|
|
40409
40559
|
__privateAdd(this, _config, async () => {
|
|
40410
|
-
this.config = await api.post("/
|
|
40560
|
+
this.config = await api.post("/nine-ai/config/get");
|
|
40411
40561
|
});
|
|
40412
40562
|
__privateAdd(this, _loadLocalSettings, () => {
|
|
40413
40563
|
const keys = ["mybatis", "service", "controller", "javascript"];
|
|
@@ -40989,7 +41139,7 @@ class IdeDiffPopup extends HTMLElement {
|
|
|
40989
41139
|
contents: diff.getContents()
|
|
40990
41140
|
});
|
|
40991
41141
|
}
|
|
40992
|
-
api.post(`/api/source/generateRealFile`, { list: params }).then((res) => {
|
|
41142
|
+
api$1.post(`/api/source/generateRealFile`, { list: params }).then((res) => {
|
|
40993
41143
|
ninegrid.alert("소스를 변경하였습니다.");
|
|
40994
41144
|
});
|
|
40995
41145
|
});
|
|
@@ -67308,4 +67458,4 @@ export {
|
|
|
67308
67458
|
defineCustomElements as d,
|
|
67309
67459
|
renderTemplate as r
|
|
67310
67460
|
};
|
|
67311
|
-
//# sourceMappingURL=index-
|
|
67461
|
+
//# sourceMappingURL=index-bkxU1yQC.js.map
|