ide-assi 0.161.0 → 0.162.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,30 +193327,23 @@ class IdeUtils
193327
193327
 
193328
193328
  static extractResponse = (response, gptServer) => {
193329
193329
 
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;
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;
193341
193334
  };
193342
193335
 
193343
193336
 
193344
193337
  let r;
193345
193338
  switch (gptServer) {
193346
193339
  case "openai":
193347
- r = extractSnippet(response.content.trim());
193340
+ r = extractJsonSnippet(response.content.trim());
193348
193341
  break;
193349
193342
  case "gemini":
193350
- r = extractSnippet(response.content.trim());
193343
+ r = extractJsonSnippet(response.content.trim());
193351
193344
  break;
193352
193345
  case "ollama":
193353
- r = extractSnippet(response);
193346
+ r = extractJsonSnippet(response);
193354
193347
  break;
193355
193348
  }
193356
193349
 
@@ -193323,30 +193323,23 @@ class IdeUtils
193323
193323
 
193324
193324
  static extractResponse = (response, gptServer) => {
193325
193325
 
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;
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;
193337
193330
  };
193338
193331
 
193339
193332
 
193340
193333
  let r;
193341
193334
  switch (gptServer) {
193342
193335
  case "openai":
193343
- r = extractSnippet(response.content.trim());
193336
+ r = extractJsonSnippet(response.content.trim());
193344
193337
  break;
193345
193338
  case "gemini":
193346
- r = extractSnippet(response.content.trim());
193339
+ r = extractJsonSnippet(response.content.trim());
193347
193340
  break;
193348
193341
  case "ollama":
193349
- r = extractSnippet(response);
193342
+ r = extractJsonSnippet(response);
193350
193343
  break;
193351
193344
  }
193352
193345
 
@@ -40,13 +40,13 @@ export class IdeUtils
40
40
  let r;
41
41
  switch (gptServer) {
42
42
  case "openai":
43
- r = extractSnippet(response.content.trim());
43
+ r = extractJsonSnippet(response.content.trim());
44
44
  break;
45
45
  case "gemini":
46
- r = extractSnippet(response.content.trim());
46
+ r = extractJsonSnippet(response.content.trim());
47
47
  break;
48
48
  case "ollama":
49
- r = extractSnippet(response);
49
+ r = extractJsonSnippet(response);
50
50
  break;
51
51
  default:
52
52
  break;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ide-assi",
3
3
  "type": "module",
4
- "version": "0.161.0",
4
+ "version": "0.162.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -40,13 +40,13 @@ export class IdeUtils
40
40
  let r;
41
41
  switch (gptServer) {
42
42
  case "openai":
43
- r = extractSnippet(response.content.trim());
43
+ r = extractJsonSnippet(response.content.trim());
44
44
  break;
45
45
  case "gemini":
46
- r = extractSnippet(response.content.trim());
46
+ r = extractJsonSnippet(response.content.trim());
47
47
  break;
48
48
  case "ollama":
49
- r = extractSnippet(response);
49
+ r = extractJsonSnippet(response);
50
50
  break;
51
51
  default:
52
52
  break;