@nine-lab/nine-mu 0.1.150 → 0.1.152
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 +387 -6
- 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/ChatMessage.js +487 -0
- package/src/components/NineChat.js +1 -1
- package/src/components/ai/aiContainer.js +438 -0
- package/src/components/ai/aiMessage.js +505 -0
- package/src/components/ai/aiSettings.js +149 -0
- package/src/index.js +1 -0
package/dist/nine-mu.js
CHANGED
|
@@ -9,7 +9,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
12
|
-
var _mcpClient, _onAction, _onStatus, _onMessage, _owner, _NineChatManager_instances, connect_fn, fetchRoutes_fn, pushMessage_fn, updateStatus_fn, callTool_fn, _getSourcePath, _service, _routes, _diffPopup, _packageName, _routesPath, _connectorUrl, _mcpClient2, _manager, _NineChat_instances, initInteractions_fn, initActions_fn, render_fn, _makeMenuHandler, _sourceGenHandler, _showDiff, _asisEditorView, _tobeEditorView, _asisEditorEl, _tobeEditorEl, _languageCompartment, _isScrollSyncActive, _initCodeMirror, _setupScrollSync, _applyDiffDecorations, _dialog, _diffView, _asisBackup, _host, _NineDiffPopup_instances, render_fn2, handleConfirm_fn, handleCancel_fn;
|
|
12
|
+
var _mcpClient, _onAction, _onStatus, _onMessage, _owner, _NineChatManager_instances, connect_fn, fetchRoutes_fn, pushMessage_fn, updateStatus_fn, callTool_fn, _getSourcePath, _service, _routes, _diffPopup, _packageName, _routesPath, _connectorUrl, _mcpClient2, _manager, _NineChat_instances, initInteractions_fn, initActions_fn, render_fn, _makeMenuHandler, _sourceGenHandler, _showDiff, _asisEditorView, _tobeEditorView, _asisEditorEl, _tobeEditorEl, _languageCompartment, _isScrollSyncActive, _initCodeMirror, _setupScrollSync, _applyDiffDecorations, _dialog, _diffView, _asisBackup, _host, _NineDiffPopup_instances, render_fn2, handleConfirm_fn, handleCancel_fn, _message, _data, _unique, _init, _message2, _init2, _progressData, _progressElements, _animationIntervals, _aiProgressMessage_instances, updateCurrentActiveProgress_fn, renderProgress_fn, updateProgressItemVisuals_fn, startAnimation_fn, updateProgressItem_fn, _init3;
|
|
13
13
|
import { trace as trace$1, api, nine } from "@nine-lab/nine-util";
|
|
14
14
|
class Trace extends trace$1.constructor {
|
|
15
15
|
constructor() {
|
|
@@ -13811,7 +13811,7 @@ render_fn = function() {
|
|
|
13811
13811
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
13812
13812
|
this.shadowRoot.innerHTML = `
|
|
13813
13813
|
<style>
|
|
13814
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
13814
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.151"}/dist/css/nine-mu.css";
|
|
13815
13815
|
${customImport}
|
|
13816
13816
|
</style>
|
|
13817
13817
|
<div class="wrapper">
|
|
@@ -13821,7 +13821,7 @@ render_fn = function() {
|
|
|
13821
13821
|
<div class="logo"><span></span></div>
|
|
13822
13822
|
<div id="status-tag" style="font-size:10px; color:#ff5722; padding:5px;">nine-mu Engine Ready</div>
|
|
13823
13823
|
</div>
|
|
13824
|
-
<
|
|
13824
|
+
<nine-chat-message></nine-chat-message>
|
|
13825
13825
|
<div class="foot">
|
|
13826
13826
|
<div class="apply-src">
|
|
13827
13827
|
${["MyBatis", "Service", "Controller", "JavaScript"].map((t2) => `
|
|
@@ -40029,7 +40029,7 @@ class NineDiff extends HTMLElement {
|
|
|
40029
40029
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
40030
40030
|
this.shadowRoot.innerHTML = `
|
|
40031
40031
|
<style>
|
|
40032
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
40032
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.151"}/dist/css/nine-mu.css";
|
|
40033
40033
|
${customImport}
|
|
40034
40034
|
</style>
|
|
40035
40035
|
|
|
@@ -40139,7 +40139,7 @@ render_fn2 = function() {
|
|
|
40139
40139
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
40140
40140
|
this.shadowRoot.innerHTML = `
|
|
40141
40141
|
<style>
|
|
40142
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
40142
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.151"}/dist/css/nine-mu.css";
|
|
40143
40143
|
${customImport}
|
|
40144
40144
|
</style>
|
|
40145
40145
|
|
|
@@ -40177,8 +40177,389 @@ handleCancel_fn = function() {
|
|
|
40177
40177
|
__privateGet(this, _dialog).close();
|
|
40178
40178
|
};
|
|
40179
40179
|
customElements.define("nine-diff-popup", NineDiffPopup);
|
|
40180
|
+
class aiMessage extends HTMLElement {
|
|
40181
|
+
constructor() {
|
|
40182
|
+
super();
|
|
40183
|
+
__privateAdd(this, _message);
|
|
40184
|
+
__privateAdd(this, _data);
|
|
40185
|
+
__privateAdd(this, _unique);
|
|
40186
|
+
__publicField(this, "initialize", (info, data, unique) => {
|
|
40187
|
+
__privateSet(this, _data, data);
|
|
40188
|
+
__privateSet(this, _unique, unique);
|
|
40189
|
+
setTimeout(() => {
|
|
40190
|
+
if (!unique) {
|
|
40191
|
+
this.shadowRoot.querySelector(".filter").classList.add("disabled");
|
|
40192
|
+
this.shadowRoot.querySelector(".database").classList.add("disabled");
|
|
40193
|
+
}
|
|
40194
|
+
__privateGet(this, _init).call(this, info);
|
|
40195
|
+
});
|
|
40196
|
+
});
|
|
40197
|
+
__privateAdd(this, _init, (info) => {
|
|
40198
|
+
const rowCount = Number(this.getAttribute("row-count"));
|
|
40199
|
+
if (rowCount < 1) {
|
|
40200
|
+
this.shadowRoot.querySelector(".grid").style.display = "none";
|
|
40201
|
+
this.shadowRoot.querySelector(".chat-menu").style.display = "none";
|
|
40202
|
+
return;
|
|
40203
|
+
}
|
|
40204
|
+
let colgroup = info.map(() => `<col background-color="#888"/>`).join("");
|
|
40205
|
+
let thead = info.map((item) => `<th>${item.desc}</th>`).join("");
|
|
40206
|
+
let tbody = info.map((item) => `<td data-bind="${item.name}" text-align="${item.type == "number" ? "right" : "left"}"></td>`).join("");
|
|
40207
|
+
const html = `
|
|
40208
|
+
<nine-grid class="ai" display-row-count="${rowCount > 5 ? 5 : rowCount}" show-title-bar="false" show-menu-icon="false" show-status-bar="false" select-type="row" auto-fit-col="true" show-title-bar="true" show-menu-icon="true" show-status-bar="true" enable-fixed-col="true" row-resizable="false" col-movable="true">
|
|
40209
|
+
<table style="display:none;">
|
|
40210
|
+
<colgroup>
|
|
40211
|
+
<col background-color="#888" width="30" fixed="left" />
|
|
40212
|
+
${colgroup}
|
|
40213
|
+
</colgroup>
|
|
40214
|
+
<thead>
|
|
40215
|
+
<tr>
|
|
40216
|
+
<th>No.</th>
|
|
40217
|
+
${thead}
|
|
40218
|
+
</tr>
|
|
40219
|
+
</thead>
|
|
40220
|
+
<tbody>
|
|
40221
|
+
<tr>
|
|
40222
|
+
<th><ng-row-indicator/></th>
|
|
40223
|
+
${tbody}
|
|
40224
|
+
</tr>
|
|
40225
|
+
</tbody>
|
|
40226
|
+
</table>
|
|
40227
|
+
</nine-grid>
|
|
40228
|
+
`;
|
|
40229
|
+
this.shadowRoot.querySelector(".grid").innerHTML = html;
|
|
40230
|
+
setTimeout(() => {
|
|
40231
|
+
const grd = this.shadowRoot.querySelector("nine-grid");
|
|
40232
|
+
grd.data.source = __privateGet(this, _data);
|
|
40233
|
+
});
|
|
40234
|
+
});
|
|
40235
|
+
this.attachShadow({ mode: "open" });
|
|
40236
|
+
}
|
|
40237
|
+
connectedCallback() {
|
|
40238
|
+
__privateSet(this, _message, this.getAttribute("message"));
|
|
40239
|
+
this.shadowRoot.innerHTML = `
|
|
40240
|
+
|
|
40241
|
+
|
|
40242
|
+
<div class="chat-message">
|
|
40243
|
+
<div class="message"></div>
|
|
40244
|
+
<span class="more"><a href="#">more</a></span>
|
|
40245
|
+
</div>
|
|
40246
|
+
|
|
40247
|
+
<div class="grid"></div>
|
|
40248
|
+
|
|
40249
|
+
<div class="chat-menu">
|
|
40250
|
+
<div class="left-menu">
|
|
40251
|
+
<div class="filter"></div>
|
|
40252
|
+
<div class="database"></div>
|
|
40253
|
+
<div class="excel"></div>
|
|
40254
|
+
<div class="maximize"></div>
|
|
40255
|
+
</div>
|
|
40256
|
+
</div>
|
|
40257
|
+
`;
|
|
40258
|
+
requestAnimationFrame(() => {
|
|
40259
|
+
const elMessage = this.shadowRoot.querySelector(".message");
|
|
40260
|
+
elMessage.setAttribute("title", __privateGet(this, _message));
|
|
40261
|
+
elMessage.innerHTML = __privateGet(this, _message).replaceAll("\n\n", "<br/>").replaceAll("\n", "<br/>");
|
|
40262
|
+
this.shadowRoot.querySelector(".filter").addEventListener("click", (e) => {
|
|
40263
|
+
if (__privateGet(this, _unique)) {
|
|
40264
|
+
const grd = document.querySelector("nine-grid");
|
|
40265
|
+
grd.filtering.set(__privateGet(this, _data).map(
|
|
40266
|
+
(item) => Object.fromEntries(__privateGet(this, _unique).map((key) => [key, item[key]]))
|
|
40267
|
+
));
|
|
40268
|
+
}
|
|
40269
|
+
});
|
|
40270
|
+
this.shadowRoot.querySelector(".database").addEventListener("click", (e) => {
|
|
40271
|
+
const keys = __privateGet(this, _data).map(
|
|
40272
|
+
(item) => Object.fromEntries(__privateGet(this, _unique).map((key) => [key, item[key]]))
|
|
40273
|
+
);
|
|
40274
|
+
console.log(keys);
|
|
40275
|
+
this.dispatchEvent(new CustomEvent("database", { bubbles: true, detail: { key: keys } }));
|
|
40276
|
+
});
|
|
40277
|
+
this.shadowRoot.querySelector(".maximize").addEventListener("click", (e) => {
|
|
40278
|
+
this.shadowRoot.querySelector("nine-grid").maximize();
|
|
40279
|
+
});
|
|
40280
|
+
this.shadowRoot.querySelector(".excel").addEventListener("click", (e) => {
|
|
40281
|
+
this.shadowRoot.querySelector("nine-grid").export();
|
|
40282
|
+
});
|
|
40283
|
+
this.shadowRoot.querySelector(".more a").addEventListener("click", () => {
|
|
40284
|
+
alert(__privateGet(this, _message));
|
|
40285
|
+
});
|
|
40286
|
+
setTimeout(() => {
|
|
40287
|
+
const elMore = this.shadowRoot.querySelector(".more");
|
|
40288
|
+
if (__privateGet(this, _message).length > 50) {
|
|
40289
|
+
elMore.style.display = "flex";
|
|
40290
|
+
elMore.style.position = "absolute";
|
|
40291
|
+
} else {
|
|
40292
|
+
elMore.style.display = "none";
|
|
40293
|
+
}
|
|
40294
|
+
});
|
|
40295
|
+
});
|
|
40296
|
+
}
|
|
40297
|
+
}
|
|
40298
|
+
_message = new WeakMap();
|
|
40299
|
+
_data = new WeakMap();
|
|
40300
|
+
_unique = new WeakMap();
|
|
40301
|
+
_init = new WeakMap();
|
|
40302
|
+
class aiIngMessage extends HTMLElement {
|
|
40303
|
+
constructor() {
|
|
40304
|
+
super();
|
|
40305
|
+
__privateAdd(this, _message2);
|
|
40306
|
+
__privateAdd(this, _init2, () => {
|
|
40307
|
+
setInterval(() => {
|
|
40308
|
+
__privateSet(this, _message2, __privateGet(this, _message2).length < 3 ? __privateGet(this, _message2) + "." : "");
|
|
40309
|
+
this.shadowRoot.querySelector(".chat-message").innerHTML = __privateGet(this, _message2) || " ";
|
|
40310
|
+
}, 500);
|
|
40311
|
+
});
|
|
40312
|
+
this.attachShadow({ mode: "open" });
|
|
40313
|
+
}
|
|
40314
|
+
connectedCallback() {
|
|
40315
|
+
__privateSet(this, _message2, ".");
|
|
40316
|
+
this.shadowRoot.innerHTML = `
|
|
40317
|
+
|
|
40318
|
+
<div class="chat-message">
|
|
40319
|
+
.
|
|
40320
|
+
</div>
|
|
40321
|
+
`;
|
|
40322
|
+
__privateGet(this, _init2).call(this);
|
|
40323
|
+
}
|
|
40324
|
+
}
|
|
40325
|
+
_message2 = new WeakMap();
|
|
40326
|
+
_init2 = new WeakMap();
|
|
40327
|
+
class aiMyMessage extends HTMLElement {
|
|
40328
|
+
constructor() {
|
|
40329
|
+
super();
|
|
40330
|
+
this.attachShadow({ mode: "open" });
|
|
40331
|
+
}
|
|
40332
|
+
connectedCallback() {
|
|
40333
|
+
const message = this.getAttribute("message");
|
|
40334
|
+
this.shadowRoot.innerHTML = `
|
|
40335
|
+
|
|
40336
|
+
|
|
40337
|
+
<div class="chat-message">
|
|
40338
|
+
${message}
|
|
40339
|
+
</div>
|
|
40340
|
+
`;
|
|
40341
|
+
}
|
|
40342
|
+
}
|
|
40343
|
+
class aiProgressMessage extends HTMLElement {
|
|
40344
|
+
constructor() {
|
|
40345
|
+
super();
|
|
40346
|
+
__privateAdd(this, _aiProgressMessage_instances);
|
|
40347
|
+
__privateAdd(this, _progressData, []);
|
|
40348
|
+
__privateAdd(this, _progressElements, /* @__PURE__ */ new Map());
|
|
40349
|
+
__privateAdd(this, _animationIntervals, /* @__PURE__ */ new Map());
|
|
40350
|
+
this.attachShadow({ mode: "open" });
|
|
40351
|
+
}
|
|
40352
|
+
connectedCallback() {
|
|
40353
|
+
this.shadowRoot.innerHTML = `
|
|
40354
|
+
|
|
40355
|
+
<div class="chat-message progress-message">
|
|
40356
|
+
<ul class="progress-list"></ul>
|
|
40357
|
+
</div>
|
|
40358
|
+
`;
|
|
40359
|
+
}
|
|
40360
|
+
/**
|
|
40361
|
+
* 진행 상태 데이터를 초기화하고 화면에 표시합니다.
|
|
40362
|
+
* @param {Array<Object>} data - [{id: 'step1', message: '분석중입니다.', completedMessage: '분석이 완료되었습니다.'}, ...]
|
|
40363
|
+
*/
|
|
40364
|
+
initialize(data) {
|
|
40365
|
+
__privateSet(this, _progressData, data.map((item) => ({
|
|
40366
|
+
...item,
|
|
40367
|
+
status: "pending",
|
|
40368
|
+
originalMessage: item.message
|
|
40369
|
+
})));
|
|
40370
|
+
setTimeout(() => {
|
|
40371
|
+
__privateMethod(this, _aiProgressMessage_instances, renderProgress_fn).call(this);
|
|
40372
|
+
__privateMethod(this, _aiProgressMessage_instances, updateCurrentActiveProgress_fn).call(this);
|
|
40373
|
+
}, 300);
|
|
40374
|
+
}
|
|
40375
|
+
/**
|
|
40376
|
+
* 특정 단계의 진행 상태를 업데이트합니다.
|
|
40377
|
+
* @param {string} id - 업데이트할 단계의 고유 ID
|
|
40378
|
+
* @param {string} status - 'completed' 또는 'pending'
|
|
40379
|
+
*/
|
|
40380
|
+
updateProgress(id2, status) {
|
|
40381
|
+
const itemIndex = __privateGet(this, _progressData).findIndex((item) => item.id === id2);
|
|
40382
|
+
if (itemIndex > -1) {
|
|
40383
|
+
if (__privateGet(this, _progressData)[itemIndex].status !== status) {
|
|
40384
|
+
__privateGet(this, _progressData)[itemIndex].status = status;
|
|
40385
|
+
__privateMethod(this, _aiProgressMessage_instances, updateProgressItem_fn).call(this, __privateGet(this, _progressData)[itemIndex]);
|
|
40386
|
+
__privateMethod(this, _aiProgressMessage_instances, updateCurrentActiveProgress_fn).call(this);
|
|
40387
|
+
}
|
|
40388
|
+
}
|
|
40389
|
+
}
|
|
40390
|
+
}
|
|
40391
|
+
_progressData = new WeakMap();
|
|
40392
|
+
_progressElements = new WeakMap();
|
|
40393
|
+
_animationIntervals = new WeakMap();
|
|
40394
|
+
_aiProgressMessage_instances = new WeakSet();
|
|
40395
|
+
// 현재 진행 중인 첫 번째 pending 항목을 찾아 'active' 상태로 만들고 애니메이션 시작
|
|
40396
|
+
// 이전에 active였던 항목의 애니메이션은 중지
|
|
40397
|
+
updateCurrentActiveProgress_fn = function() {
|
|
40398
|
+
let foundActive = false;
|
|
40399
|
+
__privateGet(this, _progressData).forEach((item) => {
|
|
40400
|
+
const li = __privateGet(this, _progressElements).get(item.id);
|
|
40401
|
+
if (!li) return;
|
|
40402
|
+
li.classList.remove("active");
|
|
40403
|
+
if (__privateGet(this, _animationIntervals).has(item.id)) {
|
|
40404
|
+
clearInterval(__privateGet(this, _animationIntervals).get(item.id));
|
|
40405
|
+
__privateGet(this, _animationIntervals).delete(item.id);
|
|
40406
|
+
li.querySelector(".animated-dots").textContent = "";
|
|
40407
|
+
}
|
|
40408
|
+
if (item.status === "pending" && !foundActive) {
|
|
40409
|
+
li.classList.add("active");
|
|
40410
|
+
__privateMethod(this, _aiProgressMessage_instances, startAnimation_fn).call(this, item);
|
|
40411
|
+
foundActive = true;
|
|
40412
|
+
}
|
|
40413
|
+
});
|
|
40414
|
+
};
|
|
40415
|
+
renderProgress_fn = function() {
|
|
40416
|
+
const progressList = this.shadowRoot.querySelector(".progress-list");
|
|
40417
|
+
progressList.innerHTML = "";
|
|
40418
|
+
__privateGet(this, _progressElements).clear();
|
|
40419
|
+
__privateGet(this, _animationIntervals).forEach((intervalId) => clearInterval(intervalId));
|
|
40420
|
+
__privateGet(this, _animationIntervals).clear();
|
|
40421
|
+
__privateGet(this, _progressData).forEach((item, index) => {
|
|
40422
|
+
const li = document.createElement("li");
|
|
40423
|
+
li.setAttribute("data-id", item.id);
|
|
40424
|
+
li.classList.add("progress-item");
|
|
40425
|
+
li.innerHTML = `
|
|
40426
|
+
<span class="step-number">${index + 1}.</span>
|
|
40427
|
+
<span class="text">${item.originalMessage}</span>
|
|
40428
|
+
<span class="animated-dots"></span>
|
|
40429
|
+
`;
|
|
40430
|
+
progressList.appendChild(li);
|
|
40431
|
+
__privateGet(this, _progressElements).set(item.id, li);
|
|
40432
|
+
__privateMethod(this, _aiProgressMessage_instances, updateProgressItemVisuals_fn).call(this, item);
|
|
40433
|
+
});
|
|
40434
|
+
};
|
|
40435
|
+
// 항목의 시각적 상태(텍스트, 완료 체크)만 업데이트
|
|
40436
|
+
updateProgressItemVisuals_fn = function(item) {
|
|
40437
|
+
const li = __privateGet(this, _progressElements).get(item.id);
|
|
40438
|
+
if (li) {
|
|
40439
|
+
li.classList.remove("pending", "completed");
|
|
40440
|
+
li.classList.add(item.status);
|
|
40441
|
+
const textSpan = li.querySelector(".text");
|
|
40442
|
+
const dotsSpan = li.querySelector(".animated-dots");
|
|
40443
|
+
if (item.status === "completed") {
|
|
40444
|
+
textSpan.textContent = item.completedMessage;
|
|
40445
|
+
dotsSpan.textContent = "";
|
|
40446
|
+
} else {
|
|
40447
|
+
textSpan.textContent = item.originalMessage;
|
|
40448
|
+
}
|
|
40449
|
+
}
|
|
40450
|
+
};
|
|
40451
|
+
// 점 애니메이션 시작 함수
|
|
40452
|
+
startAnimation_fn = function(item) {
|
|
40453
|
+
const li = __privateGet(this, _progressElements).get(item.id);
|
|
40454
|
+
if (li) {
|
|
40455
|
+
const dotsSpan = li.querySelector(".animated-dots");
|
|
40456
|
+
let dotsCount = 0;
|
|
40457
|
+
const intervalId = setInterval(() => {
|
|
40458
|
+
dotsCount = (dotsCount + 1) % 4;
|
|
40459
|
+
dotsSpan.textContent = ".".repeat(dotsCount);
|
|
40460
|
+
}, 300);
|
|
40461
|
+
__privateGet(this, _animationIntervals).set(item.id, intervalId);
|
|
40462
|
+
}
|
|
40463
|
+
};
|
|
40464
|
+
// 개별 항목의 상태 업데이트 (텍스트 변경, 클래스 추가/제거)
|
|
40465
|
+
// 애니메이션 시작/중지는 `#updateCurrentActiveProgress`에서 담당
|
|
40466
|
+
updateProgressItem_fn = function(item) {
|
|
40467
|
+
__privateMethod(this, _aiProgressMessage_instances, updateProgressItemVisuals_fn).call(this, item);
|
|
40468
|
+
};
|
|
40469
|
+
class ChatMessage extends HTMLElement {
|
|
40470
|
+
constructor() {
|
|
40471
|
+
super();
|
|
40472
|
+
__privateAdd(this, _init3, () => {
|
|
40473
|
+
});
|
|
40474
|
+
__publicField(this, "add", (sender, message, info, data, unique) => {
|
|
40475
|
+
if (unique && !Array.isArray(unique)) {
|
|
40476
|
+
unique = unique.split(",");
|
|
40477
|
+
}
|
|
40478
|
+
const target = this.shadowRoot.querySelector(".chat-body");
|
|
40479
|
+
let el;
|
|
40480
|
+
switch (sender) {
|
|
40481
|
+
case "me":
|
|
40482
|
+
el = document.createElement("nx-ai-my-message");
|
|
40483
|
+
el.setAttribute("message", message);
|
|
40484
|
+
target.appendChild(el);
|
|
40485
|
+
break;
|
|
40486
|
+
case "ing":
|
|
40487
|
+
el = document.createElement("nx-ai-ing-message");
|
|
40488
|
+
target.appendChild(el);
|
|
40489
|
+
break;
|
|
40490
|
+
case "ai":
|
|
40491
|
+
this.shadowRoot.querySelectorAll("nx-ai-ing-message").forEach((el2) => {
|
|
40492
|
+
el2.remove();
|
|
40493
|
+
});
|
|
40494
|
+
el = document.createElement("nx-ai-message");
|
|
40495
|
+
el.setAttribute("message", message);
|
|
40496
|
+
el.setAttribute("row-count", data ? data.length : 0);
|
|
40497
|
+
el.initialize(info, data, unique);
|
|
40498
|
+
target.appendChild(el);
|
|
40499
|
+
break;
|
|
40500
|
+
}
|
|
40501
|
+
setTimeout(() => {
|
|
40502
|
+
el.scrollIntoView({ behavior: "smooth", block: "end" });
|
|
40503
|
+
}, 200);
|
|
40504
|
+
});
|
|
40505
|
+
/**
|
|
40506
|
+
* 챗 메시지를 추가합니다.
|
|
40507
|
+
* @param {string} sender - 메시지 발신자 ('me', 'ing', 'ai', 'progress')
|
|
40508
|
+
* @param {string} message - 메시지 내용 (progress 타입의 경우 사용되지 않음)
|
|
40509
|
+
* @param {Array<Object>} info - nine-grid 정보 (ai 타입에만 해당)
|
|
40510
|
+
* @param {Array<Object>} data - nine-grid 데이터 (ai 타입에만 해당)
|
|
40511
|
+
* @param {Array<string>|string} unique - nine-grid 고유 키 (ai 타입에만 해당)
|
|
40512
|
+
* @param {Array<Object>} progressData - aiProgressMessage의 초기 진행 데이터 (progress 타입에만 해당)
|
|
40513
|
+
* @returns {HTMLElement|null} 생성된 메시지 엘리먼트 (특히 aiProgressMessage의 경우 업데이트를 위해 반환)
|
|
40514
|
+
*/
|
|
40515
|
+
__publicField(this, "addProgress", (progressData = null) => {
|
|
40516
|
+
const target = this.shadowRoot.querySelector(".chat-body");
|
|
40517
|
+
this.shadowRoot.querySelectorAll("nx-ai-ing-message").forEach((el2) => {
|
|
40518
|
+
el2.remove();
|
|
40519
|
+
});
|
|
40520
|
+
let el = document.createElement("nx-ai-progress-message");
|
|
40521
|
+
if (progressData) {
|
|
40522
|
+
el.initialize(progressData);
|
|
40523
|
+
}
|
|
40524
|
+
target.appendChild(el);
|
|
40525
|
+
setTimeout(() => {
|
|
40526
|
+
if (el) {
|
|
40527
|
+
el.scrollIntoView({ behavior: "smooth", block: "end" });
|
|
40528
|
+
}
|
|
40529
|
+
}, 200);
|
|
40530
|
+
return el;
|
|
40531
|
+
});
|
|
40532
|
+
this.attachShadow({ mode: "open" });
|
|
40533
|
+
}
|
|
40534
|
+
connectedCallback() {
|
|
40535
|
+
this.getAttribute("message");
|
|
40536
|
+
this.shadowRoot.innerHTML = `
|
|
40537
|
+
|
|
40538
|
+
|
|
40539
|
+
<div class="chat-body">
|
|
40540
|
+
</div>
|
|
40541
|
+
`;
|
|
40542
|
+
__privateGet(this, _init3).call(this);
|
|
40543
|
+
}
|
|
40544
|
+
}
|
|
40545
|
+
_init3 = new WeakMap();
|
|
40546
|
+
if (!customElements.get("nx-ai-message")) {
|
|
40547
|
+
customElements.define("nx-ai-message", aiMessage);
|
|
40548
|
+
}
|
|
40549
|
+
if (!customElements.get("nx-ai-ing-message")) {
|
|
40550
|
+
customElements.define("nx-ai-ing-message", aiIngMessage);
|
|
40551
|
+
}
|
|
40552
|
+
if (!customElements.get("nx-ai-my-message")) {
|
|
40553
|
+
customElements.define("nx-ai-my-message", aiMyMessage);
|
|
40554
|
+
}
|
|
40555
|
+
if (!customElements.get("nx-ai-progress-message")) {
|
|
40556
|
+
customElements.define("nx-ai-progress-message", aiProgressMessage);
|
|
40557
|
+
}
|
|
40558
|
+
if (!customElements.get("nine-chat-message")) {
|
|
40559
|
+
customElements.define("nine-chat-message", ChatMessage);
|
|
40560
|
+
}
|
|
40180
40561
|
const NineMu = {
|
|
40181
|
-
version: "0.1.
|
|
40562
|
+
version: "0.1.151",
|
|
40182
40563
|
init: (config2) => {
|
|
40183
40564
|
trace$1.log("🛠️ Nine-Mu Engine initialized", config2);
|
|
40184
40565
|
}
|