ide-assi 0.171.0 → 0.173.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
 
@@ -193734,8 +193725,18 @@ class IdeAssi extends HTMLElement
193734
193725
  });
193735
193726
  };
193736
193727
 
193728
+ #config = async () => {
193729
+ const res = await fetch(`/api/source/generateTmplFile`, {
193730
+ method: "POST",
193731
+ headers: {"Content-Type": "application/json"},
193732
+ });
193733
+
193734
+ console.log(res);
193735
+ };
193737
193736
 
193738
193737
  #init = (info) => {
193738
+ this.#config();
193739
+
193739
193740
  this.settings = this.shadowRoot.querySelector("ide-assi-settings");
193740
193741
 
193741
193742
  this.shadowRoot.querySelector("textarea").addEventListener("keydown", this.#keydownHandler);
@@ -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
 
@@ -193730,8 +193721,18 @@ class IdeAssi extends HTMLElement
193730
193721
  });
193731
193722
  };
193732
193723
 
193724
+ #config = async () => {
193725
+ const res = await fetch(`/api/source/generateTmplFile`, {
193726
+ method: "POST",
193727
+ headers: {"Content-Type": "application/json"},
193728
+ });
193729
+
193730
+ console.log(res);
193731
+ };
193733
193732
 
193734
193733
  #init = (info) => {
193734
+ this.#config();
193735
+
193735
193736
  this.settings = this.shadowRoot.querySelector("ide-assi-settings");
193736
193737
 
193737
193738
  this.shadowRoot.querySelector("textarea").addEventListener("keydown", this.#keydownHandler);
@@ -53,8 +53,18 @@ export class IdeAssi extends HTMLElement
53
53
  });
54
54
  };
55
55
 
56
+ #config = async () => {
57
+ const res = await fetch(`/api/source/generateTmplFile`, {
58
+ method: "POST",
59
+ headers: {"Content-Type": "application/json"},
60
+ });
61
+
62
+ console.log(res);
63
+ };
56
64
 
57
65
  #init = (info) => {
66
+ this.#config();
67
+
58
68
  this.settings = this.shadowRoot.querySelector("ide-assi-settings");
59
69
 
60
70
  this.shadowRoot.querySelector("textarea").addEventListener("keydown", this.#keydownHandler);
@@ -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.173.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -53,8 +53,18 @@ export class IdeAssi extends HTMLElement
53
53
  });
54
54
  };
55
55
 
56
+ #config = async () => {
57
+ const res = await fetch(`/api/source/generateTmplFile`, {
58
+ method: "POST",
59
+ headers: {"Content-Type": "application/json"},
60
+ });
61
+
62
+ console.log(res);
63
+ };
56
64
 
57
65
  #init = (info) => {
66
+ this.#config();
67
+
58
68
  this.settings = this.shadowRoot.querySelector("ide-assi-settings");
59
69
 
60
70
  this.shadowRoot.querySelector("textarea").addEventListener("keydown", this.#keydownHandler);
@@ -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;