ide-assi 0.154.0 → 0.156.0

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.
@@ -193327,22 +193327,30 @@ class IdeUtils
193327
193327
 
193328
193328
  static extractResponse = (response, gptServer) => {
193329
193329
 
193330
- const extractJsonSnippet = (text) => {
193331
- //return text.replace(/```[\s\S]*?```/g, '').trim();
193332
- const match = text.match(/```json([\s\S]*?)```/);
193333
- return match ? match[1].trim() : text;
193330
+ const extractSnippet = (text) => {
193331
+ // 모든 종류의 마크다운 코드 블록 (```언어명 ... ```)을 제거
193332
+ // 언어명 없는 순수 ``` 블록도 포함
193333
+ const cleanedText = text.replace(/```(?:json|jsx|[\s\S]*?)?\s*([\s\S]*?)```/g, '').trim();
193334
+
193335
+ // 혹시라도 마크다운 코드 블록 외에 순수 JSON 문자열만 남았다면 그 부분을 반환
193336
+ // (이전 로직에서 JSON 블록만 추출하는 부분은 이제 필요 없을 가능성이 높습니다,
193337
+ // `replace`에서 이미 다 제거되었기 때문입니다.)
193338
+ // 하지만, 안전을 위해 만약 JSON이 아닌 다른 텍스트가 남았을 때도 처리할 수 있도록
193339
+ // 원본 텍스트에서 ```으로 감싸진 부분을 모두 제거하는 방식으로 변경합니다.
193340
+ return cleanedText;
193334
193341
  };
193335
193342
 
193343
+
193336
193344
  let r;
193337
193345
  switch (gptServer) {
193338
193346
  case "openai":
193339
- r = extractJsonSnippet(response.content.trim());
193347
+ r = extractSnippet(response.content.trim());
193340
193348
  break;
193341
193349
  case "gemini":
193342
- r = extractJsonSnippet(response.content.trim());
193350
+ r = extractSnippet(response.content.trim());
193343
193351
  break;
193344
193352
  case "ollama":
193345
- r = extractJsonSnippet(response);
193353
+ r = extractSnippet(response);
193346
193354
  break;
193347
193355
  }
193348
193356
 
@@ -193646,6 +193654,7 @@ class IdeAi
193646
193654
  await this.#generateTmplFile("/prompts/meta/BuildReactJsx.txt", "react.jsx", {
193647
193655
  userPrompt: userPrompt,
193648
193656
  menuUrl: where.menu.url,
193657
+ menuName: where.menu.name,
193649
193658
  controllerSource: controllerSrc,
193650
193659
  tableDefinitions: columnInfo,
193651
193660
  });
@@ -193323,22 +193323,30 @@ class IdeUtils
193323
193323
 
193324
193324
  static extractResponse = (response, gptServer) => {
193325
193325
 
193326
- const extractJsonSnippet = (text) => {
193327
- //return text.replace(/```[\s\S]*?```/g, '').trim();
193328
- const match = text.match(/```json([\s\S]*?)```/);
193329
- return match ? match[1].trim() : text;
193326
+ const extractSnippet = (text) => {
193327
+ // 모든 종류의 마크다운 코드 블록 (```언어명 ... ```)을 제거
193328
+ // 언어명 없는 순수 ``` 블록도 포함
193329
+ const cleanedText = text.replace(/```(?:json|jsx|[\s\S]*?)?\s*([\s\S]*?)```/g, '').trim();
193330
+
193331
+ // 혹시라도 마크다운 코드 블록 외에 순수 JSON 문자열만 남았다면 그 부분을 반환
193332
+ // (이전 로직에서 JSON 블록만 추출하는 부분은 이제 필요 없을 가능성이 높습니다,
193333
+ // `replace`에서 이미 다 제거되었기 때문입니다.)
193334
+ // 하지만, 안전을 위해 만약 JSON이 아닌 다른 텍스트가 남았을 때도 처리할 수 있도록
193335
+ // 원본 텍스트에서 ```으로 감싸진 부분을 모두 제거하는 방식으로 변경합니다.
193336
+ return cleanedText;
193330
193337
  };
193331
193338
 
193339
+
193332
193340
  let r;
193333
193341
  switch (gptServer) {
193334
193342
  case "openai":
193335
- r = extractJsonSnippet(response.content.trim());
193343
+ r = extractSnippet(response.content.trim());
193336
193344
  break;
193337
193345
  case "gemini":
193338
- r = extractJsonSnippet(response.content.trim());
193346
+ r = extractSnippet(response.content.trim());
193339
193347
  break;
193340
193348
  case "ollama":
193341
- r = extractJsonSnippet(response);
193349
+ r = extractSnippet(response);
193342
193350
  break;
193343
193351
  }
193344
193352
 
@@ -193642,6 +193650,7 @@ class IdeAi
193642
193650
  await this.#generateTmplFile("/prompts/meta/BuildReactJsx.txt", "react.jsx", {
193643
193651
  userPrompt: userPrompt,
193644
193652
  menuUrl: where.menu.url,
193653
+ menuName: where.menu.name,
193645
193654
  controllerSource: controllerSrc,
193646
193655
  tableDefinitions: columnInfo,
193647
193656
  });
@@ -312,6 +312,7 @@ export class IdeAi
312
312
  const jsSrc = await this.#generateTmplFile("/prompts/meta/BuildReactJsx.txt", "react.jsx", {
313
313
  userPrompt: userPrompt,
314
314
  menuUrl: where.menu.url,
315
+ menuName: where.menu.name,
315
316
  controllerSource: controllerSrc,
316
317
  tableDefinitions: columnInfo,
317
318
  });
@@ -23,16 +23,30 @@ export class IdeUtils
23
23
  return match ? match[1].trim() : text;
24
24
  };
25
25
 
26
+ const extractSnippet = (text) => {
27
+ // 모든 종류의 마크다운 코드 블록 (```언어명 ... ```)을 제거
28
+ // 언어명 없는 순수 ``` 블록도 포함
29
+ const cleanedText = text.replace(/```(?:json|jsx|[\s\S]*?)?\s*([\s\S]*?)```/g, '').trim();
30
+
31
+ // 혹시라도 마크다운 코드 블록 외에 순수 JSON 문자열만 남았다면 그 부분을 반환
32
+ // (이전 로직에서 JSON 블록만 추출하는 부분은 이제 필요 없을 가능성이 높습니다,
33
+ // `replace`에서 이미 다 제거되었기 때문입니다.)
34
+ // 하지만, 안전을 위해 만약 JSON이 아닌 다른 텍스트가 남았을 때도 처리할 수 있도록
35
+ // 원본 텍스트에서 ```으로 감싸진 부분을 모두 제거하는 방식으로 변경합니다.
36
+ return cleanedText;
37
+ };
38
+
39
+
26
40
  let r;
27
41
  switch (gptServer) {
28
42
  case "openai":
29
- r = extractJsonSnippet(response.content.trim());
43
+ r = extractSnippet(response.content.trim());
30
44
  break;
31
45
  case "gemini":
32
- r = extractJsonSnippet(response.content.trim());
46
+ r = extractSnippet(response.content.trim());
33
47
  break;
34
48
  case "ollama":
35
- r = extractJsonSnippet(response);
49
+ r = extractSnippet(response);
36
50
  break;
37
51
  default:
38
52
  break;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ide-assi",
3
3
  "type": "module",
4
- "version": "0.154.0",
4
+ "version": "0.156.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -312,6 +312,7 @@ export class IdeAi
312
312
  const jsSrc = await this.#generateTmplFile("/prompts/meta/BuildReactJsx.txt", "react.jsx", {
313
313
  userPrompt: userPrompt,
314
314
  menuUrl: where.menu.url,
315
+ menuName: where.menu.name,
315
316
  controllerSource: controllerSrc,
316
317
  tableDefinitions: columnInfo,
317
318
  });
@@ -23,16 +23,30 @@ export class IdeUtils
23
23
  return match ? match[1].trim() : text;
24
24
  };
25
25
 
26
+ const extractSnippet = (text) => {
27
+ // 모든 종류의 마크다운 코드 블록 (```언어명 ... ```)을 제거
28
+ // 언어명 없는 순수 ``` 블록도 포함
29
+ const cleanedText = text.replace(/```(?:json|jsx|[\s\S]*?)?\s*([\s\S]*?)```/g, '').trim();
30
+
31
+ // 혹시라도 마크다운 코드 블록 외에 순수 JSON 문자열만 남았다면 그 부분을 반환
32
+ // (이전 로직에서 JSON 블록만 추출하는 부분은 이제 필요 없을 가능성이 높습니다,
33
+ // `replace`에서 이미 다 제거되었기 때문입니다.)
34
+ // 하지만, 안전을 위해 만약 JSON이 아닌 다른 텍스트가 남았을 때도 처리할 수 있도록
35
+ // 원본 텍스트에서 ```으로 감싸진 부분을 모두 제거하는 방식으로 변경합니다.
36
+ return cleanedText;
37
+ };
38
+
39
+
26
40
  let r;
27
41
  switch (gptServer) {
28
42
  case "openai":
29
- r = extractJsonSnippet(response.content.trim());
43
+ r = extractSnippet(response.content.trim());
30
44
  break;
31
45
  case "gemini":
32
- r = extractJsonSnippet(response.content.trim());
46
+ r = extractSnippet(response.content.trim());
33
47
  break;
34
48
  case "ollama":
35
- r = extractJsonSnippet(response);
49
+ r = extractSnippet(response);
36
50
  break;
37
51
  default:
38
52
  break;