ide-assi 0.171.0 → 0.172.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,18 +193327,9 @@ class IdeUtils
193327
193327
 
193328
193328
  static extractResponse = (response, gptServer) => {
193329
193329
 
193330
- const extractJsonSnippet = (text) => {
193331
-
193332
- console.log(text);
193333
-
193334
- //return text.replace(/```[\s\S]*?```/g, '').trim();
193335
- //const match = text.match(/```json([\s\S]*?)```/);
193336
- //return match ? match[1].trim() : text;
193337
- let match = text.match(/```json([\s\S]*?)```/);
193338
- if (!match) match = text.match(/```jsx([\s\S]*?)```/);
193339
- if (!match) match = text.match(/```xml([\s\S]*?)```/);
193340
- if (!match) match = text.match(/```java([\s\S]*?)```/);
193341
-
193330
+ const extractCodeSnippet = (text) => {
193331
+ const pattern = /```(?:json|jsx|xml|java)([\s\S]*?)```/;
193332
+ const match = text.match(pattern);
193342
193333
  return match ? match[1].trim() : text;
193343
193334
  };
193344
193335
 
@@ -193346,13 +193337,13 @@ class IdeUtils
193346
193337
  let r;
193347
193338
  switch (gptServer) {
193348
193339
  case "openai":
193349
- r = extractJsonSnippet(response.content.trim());
193340
+ r = extractCodeSnippet(response.content.trim());
193350
193341
  break;
193351
193342
  case "gemini":
193352
- r = extractJsonSnippet(response.content.trim());
193343
+ r = extractCodeSnippet(response.content.trim());
193353
193344
  break;
193354
193345
  case "ollama":
193355
- r = extractJsonSnippet(response);
193346
+ r = extractCodeSnippet(response);
193356
193347
  break;
193357
193348
  }
193358
193349
 
@@ -193323,18 +193323,9 @@ class IdeUtils
193323
193323
 
193324
193324
  static extractResponse = (response, gptServer) => {
193325
193325
 
193326
- const extractJsonSnippet = (text) => {
193327
-
193328
- console.log(text);
193329
-
193330
- //return text.replace(/```[\s\S]*?```/g, '').trim();
193331
- //const match = text.match(/```json([\s\S]*?)```/);
193332
- //return match ? match[1].trim() : text;
193333
- let match = text.match(/```json([\s\S]*?)```/);
193334
- if (!match) match = text.match(/```jsx([\s\S]*?)```/);
193335
- if (!match) match = text.match(/```xml([\s\S]*?)```/);
193336
- if (!match) match = text.match(/```java([\s\S]*?)```/);
193337
-
193326
+ const extractCodeSnippet = (text) => {
193327
+ const pattern = /```(?:json|jsx|xml|java)([\s\S]*?)```/;
193328
+ const match = text.match(pattern);
193338
193329
  return match ? match[1].trim() : text;
193339
193330
  };
193340
193331
 
@@ -193342,13 +193333,13 @@ class IdeUtils
193342
193333
  let r;
193343
193334
  switch (gptServer) {
193344
193335
  case "openai":
193345
- r = extractJsonSnippet(response.content.trim());
193336
+ r = extractCodeSnippet(response.content.trim());
193346
193337
  break;
193347
193338
  case "gemini":
193348
- r = extractJsonSnippet(response.content.trim());
193339
+ r = extractCodeSnippet(response.content.trim());
193349
193340
  break;
193350
193341
  case "ollama":
193351
- r = extractJsonSnippet(response);
193342
+ r = extractCodeSnippet(response);
193352
193343
  break;
193353
193344
  }
193354
193345
 
@@ -17,9 +17,7 @@ export class IdeUtils
17
17
 
18
18
  static extractResponse = (response, gptServer) => {
19
19
 
20
- const extractJsonSnippet = (text) => {
21
-
22
- console.log(text);
20
+ const extractJsonSnippet1 = (text) => {
23
21
 
24
22
  //return text.replace(/```[\s\S]*?```/g, '').trim();
25
23
  //const match = text.match(/```json([\s\S]*?)```/);
@@ -32,6 +30,13 @@ export class IdeUtils
32
30
  return match ? match[1].trim() : text;
33
31
  };
34
32
 
33
+ const extractCodeSnippet = (text) => {
34
+ const pattern = /```(?:json|jsx|xml|java)([\s\S]*?)```/;
35
+ const match = text.match(pattern);
36
+ return match ? match[1].trim() : text;
37
+ };
38
+
39
+
35
40
  const extractSnippet = (text) => {
36
41
  // 모든 종류의 마크다운 코드 블록 (```언어명 ... ```)을 제거
37
42
  // 언어명 없는 순수 ``` 블록도 포함
@@ -49,13 +54,13 @@ export class IdeUtils
49
54
  let r;
50
55
  switch (gptServer) {
51
56
  case "openai":
52
- r = extractJsonSnippet(response.content.trim());
57
+ r = extractCodeSnippet(response.content.trim());
53
58
  break;
54
59
  case "gemini":
55
- r = extractJsonSnippet(response.content.trim());
60
+ r = extractCodeSnippet(response.content.trim());
56
61
  break;
57
62
  case "ollama":
58
- r = extractJsonSnippet(response);
63
+ r = extractCodeSnippet(response);
59
64
  break;
60
65
  default:
61
66
  break;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ide-assi",
3
3
  "type": "module",
4
- "version": "0.171.0",
4
+ "version": "0.172.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -17,9 +17,7 @@ export class IdeUtils
17
17
 
18
18
  static extractResponse = (response, gptServer) => {
19
19
 
20
- const extractJsonSnippet = (text) => {
21
-
22
- console.log(text);
20
+ const extractJsonSnippet1 = (text) => {
23
21
 
24
22
  //return text.replace(/```[\s\S]*?```/g, '').trim();
25
23
  //const match = text.match(/```json([\s\S]*?)```/);
@@ -32,6 +30,13 @@ export class IdeUtils
32
30
  return match ? match[1].trim() : text;
33
31
  };
34
32
 
33
+ const extractCodeSnippet = (text) => {
34
+ const pattern = /```(?:json|jsx|xml|java)([\s\S]*?)```/;
35
+ const match = text.match(pattern);
36
+ return match ? match[1].trim() : text;
37
+ };
38
+
39
+
35
40
  const extractSnippet = (text) => {
36
41
  // 모든 종류의 마크다운 코드 블록 (```언어명 ... ```)을 제거
37
42
  // 언어명 없는 순수 ``` 블록도 포함
@@ -49,13 +54,13 @@ export class IdeUtils
49
54
  let r;
50
55
  switch (gptServer) {
51
56
  case "openai":
52
- r = extractJsonSnippet(response.content.trim());
57
+ r = extractCodeSnippet(response.content.trim());
53
58
  break;
54
59
  case "gemini":
55
- r = extractJsonSnippet(response.content.trim());
60
+ r = extractCodeSnippet(response.content.trim());
56
61
  break;
57
62
  case "ollama":
58
- r = extractJsonSnippet(response);
63
+ r = extractCodeSnippet(response);
59
64
  break;
60
65
  default:
61
66
  break;