@nine-lab/nine-mu 0.1.406 → 0.1.408
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.
- package/dist/nine-mu.js +561 -583
- package/dist/nine-mu.js.map +1 -1
- package/dist/nine-mu.umd.js +3 -3
- package/dist/nine-mu.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ai/NineNaturalQuery.js +7 -38
package/package.json
CHANGED
|
@@ -4,9 +4,6 @@ import { TipPopup } from '@nine-lab/nine-ai';
|
|
|
4
4
|
|
|
5
5
|
export class NineNaturalQuery extends HTMLElement {
|
|
6
6
|
|
|
7
|
-
#schema = null;
|
|
8
|
-
#connectorUrl = '';
|
|
9
|
-
#aiProcessor = null;
|
|
10
7
|
#tipPopup;
|
|
11
8
|
|
|
12
9
|
constructor() {
|
|
@@ -15,45 +12,10 @@ export class NineNaturalQuery extends HTMLElement {
|
|
|
15
12
|
}
|
|
16
13
|
|
|
17
14
|
async connectedCallback() {
|
|
18
|
-
// 속성에서 커넥터 주소 읽기 (기본값 설정 가능)
|
|
19
|
-
this.#connectorUrl = this.getAttribute('connector-url') || 'http://localhost:3001';
|
|
20
|
-
|
|
21
15
|
this.#render();
|
|
22
16
|
}
|
|
23
17
|
|
|
24
18
|
|
|
25
|
-
/**
|
|
26
|
-
* 서버(Connector)에 생성된 SQL 실행 요청
|
|
27
|
-
*/
|
|
28
|
-
async #runQuery(sql) {
|
|
29
|
-
try {
|
|
30
|
-
trace.log("🚀 쿼리 실행 요청:", sql);
|
|
31
|
-
|
|
32
|
-
const response = await fetch(`${this.#connectorUrl}/api/query`, {
|
|
33
|
-
method: 'POST',
|
|
34
|
-
headers: { 'Content-Type': 'application/json' },
|
|
35
|
-
body: JSON.stringify({ sql: sql })
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
trace.log(response);
|
|
39
|
-
|
|
40
|
-
if (!response.ok) throw new Error('쿼리 실행 실패');
|
|
41
|
-
|
|
42
|
-
const result = await response.json();
|
|
43
|
-
|
|
44
|
-
if (result.success) {
|
|
45
|
-
trace.log("✅ 쿼리 실행 결과:", result.data);
|
|
46
|
-
|
|
47
|
-
return result.data;
|
|
48
|
-
// TODO: 결과를 UI(표 등)에 출력하는 로직 추가
|
|
49
|
-
} else {
|
|
50
|
-
throw new Error(result.error || '쿼리 실행 중 오류 발생');
|
|
51
|
-
}
|
|
52
|
-
} catch (error) {
|
|
53
|
-
trace.error("❌ 쿼리 실행 실패:", error.message);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
19
|
|
|
58
20
|
#render() {
|
|
59
21
|
|
|
@@ -109,6 +71,13 @@ export class NineNaturalQuery extends HTMLElement {
|
|
|
109
71
|
});
|
|
110
72
|
|
|
111
73
|
trace.log(response);
|
|
74
|
+
if (response.list) {
|
|
75
|
+
const el = document.querySelector("nine-natual-query-result");
|
|
76
|
+
if (el) {
|
|
77
|
+
el.redraw(result.list); // 서버가 이미 실행해서 보낸 데이터를 바로 사용
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
112
81
|
/**
|
|
113
82
|
const result = await response.json();
|
|
114
83
|
|