ide-assi 0.170.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
 
@@ -193643,8 +193634,6 @@ class IdeAi
193643
193634
  });
193644
193635
  this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
193645
193636
 
193646
- return "111";
193647
-
193648
193637
  const serviceSrc = await this.#generateTmplFile("/prompts/meta/BuildService.txt", "service.java", {
193649
193638
  userPrompt: userPrompt,
193650
193639
  menuUrl: where.menu.url,
@@ -193740,8 +193729,6 @@ class IdeAssi extends HTMLElement
193740
193729
  #init = (info) => {
193741
193730
  this.settings = this.shadowRoot.querySelector("ide-assi-settings");
193742
193731
 
193743
- this.settings.server = "ollama";
193744
-
193745
193732
  this.shadowRoot.querySelector("textarea").addEventListener("keydown", this.#keydownHandler);
193746
193733
 
193747
193734
  this.shadowRoot.querySelector(".expand-icon").addEventListener("click", this.#toggleCollapseHandler);
@@ -193865,8 +193852,6 @@ customElements.define("ide-assi", IdeAssi);
193865
193852
  class ideAssiSettings extends HTMLElement
193866
193853
  {
193867
193854
  constructor() {
193868
- console.log("construct");
193869
-
193870
193855
  super();
193871
193856
  this.attachShadow({ mode: 'open' });
193872
193857
  }
@@ -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
 
@@ -193639,8 +193630,6 @@ class IdeAi
193639
193630
  });
193640
193631
  this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
193641
193632
 
193642
- return "111";
193643
-
193644
193633
  const serviceSrc = await this.#generateTmplFile("/prompts/meta/BuildService.txt", "service.java", {
193645
193634
  userPrompt: userPrompt,
193646
193635
  menuUrl: where.menu.url,
@@ -193736,8 +193725,6 @@ class IdeAssi extends HTMLElement
193736
193725
  #init = (info) => {
193737
193726
  this.settings = this.shadowRoot.querySelector("ide-assi-settings");
193738
193727
 
193739
- this.settings.server = "ollama";
193740
-
193741
193728
  this.shadowRoot.querySelector("textarea").addEventListener("keydown", this.#keydownHandler);
193742
193729
 
193743
193730
  this.shadowRoot.querySelector(".expand-icon").addEventListener("click", this.#toggleCollapseHandler);
@@ -193861,8 +193848,6 @@ customElements.define("ide-assi", IdeAssi);
193861
193848
  class ideAssiSettings extends HTMLElement
193862
193849
  {
193863
193850
  constructor() {
193864
- console.log("construct");
193865
-
193866
193851
  super();
193867
193852
  this.attachShadow({ mode: 'open' });
193868
193853
  }
@@ -299,8 +299,6 @@ export class IdeAi
299
299
  });
300
300
  this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
301
301
 
302
- return "111";
303
-
304
302
  const serviceSrc = await this.#generateTmplFile("/prompts/meta/BuildService.txt", "service.java", {
305
303
  userPrompt: userPrompt,
306
304
  menuUrl: where.menu.url,
@@ -57,8 +57,6 @@ export class IdeAssi extends HTMLElement
57
57
  #init = (info) => {
58
58
  this.settings = this.shadowRoot.querySelector("ide-assi-settings");
59
59
 
60
- this.settings.server = "ollama";
61
-
62
60
  this.shadowRoot.querySelector("textarea").addEventListener("keydown", this.#keydownHandler);
63
61
 
64
62
  this.shadowRoot.querySelector(".expand-icon").addEventListener("click", this.#toggleCollapseHandler);
@@ -3,8 +3,6 @@ import ninegrid from "ninegrid2";
3
3
  class ideAssiSettings extends HTMLElement
4
4
  {
5
5
  constructor() {
6
- console.log("construct");
7
-
8
6
  super();
9
7
  this.attachShadow({ mode: 'open' });
10
8
  }
@@ -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.170.0",
4
+ "version": "0.172.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -299,8 +299,6 @@ export class IdeAi
299
299
  });
300
300
  this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
301
301
 
302
- return "111";
303
-
304
302
  const serviceSrc = await this.#generateTmplFile("/prompts/meta/BuildService.txt", "service.java", {
305
303
  userPrompt: userPrompt,
306
304
  menuUrl: where.menu.url,
@@ -57,8 +57,6 @@ export class IdeAssi extends HTMLElement
57
57
  #init = (info) => {
58
58
  this.settings = this.shadowRoot.querySelector("ide-assi-settings");
59
59
 
60
- this.settings.server = "ollama";
61
-
62
60
  this.shadowRoot.querySelector("textarea").addEventListener("keydown", this.#keydownHandler);
63
61
 
64
62
  this.shadowRoot.querySelector(".expand-icon").addEventListener("click", this.#toggleCollapseHandler);
@@ -3,8 +3,6 @@ import ninegrid from "ninegrid2";
3
3
  class ideAssiSettings extends HTMLElement
4
4
  {
5
5
  constructor() {
6
- console.log("construct");
7
-
8
6
  super();
9
7
  this.attachShadow({ mode: 'open' });
10
8
  }
@@ -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;