@nine-lab/nine-mu 0.1.156 → 0.1.158
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 +19 -13
- package/dist/nine-mu.js.map +1 -1
- package/dist/nine-mu.umd.js +1 -1
- package/dist/nine-mu.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/NineChat.js +23 -8
package/package.json
CHANGED
|
@@ -68,24 +68,39 @@ export class NineChat extends HTMLElement {
|
|
|
68
68
|
|
|
69
69
|
// --- [그룹 2: Action] 엔터키 입력 시 서비스 호출 ---
|
|
70
70
|
#initActions() {
|
|
71
|
+
|
|
71
72
|
const $textarea = this.shadowRoot.querySelector('#q');
|
|
72
73
|
|
|
74
|
+
// 중복 전송 방지 플래그
|
|
75
|
+
this.isProcessing = false;
|
|
76
|
+
|
|
73
77
|
$textarea.addEventListener('keypress', async (e) => {
|
|
74
78
|
if (e.key === 'Enter' && !e.shiftKey) {
|
|
75
79
|
e.preventDefault();
|
|
76
80
|
|
|
77
|
-
const
|
|
81
|
+
const userInput = $textarea.value.trim();
|
|
82
|
+
if (!userInput || this.isProcessing) return;
|
|
83
|
+
|
|
84
|
+
this.isProcessing = true;
|
|
85
|
+
|
|
86
|
+
// 1. 즉시 UI 반영
|
|
87
|
+
this.#$nineChatMessage.add("me", userInput);
|
|
88
|
+
this.#$nineChatMessage.add("ing", ""); // 로딩 상태
|
|
78
89
|
|
|
79
|
-
|
|
90
|
+
// 2. 입력창 비우기
|
|
91
|
+
$textarea.value = "";
|
|
80
92
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
});
|
|
93
|
+
// 3. nine.safe로 매니저 로직 실행
|
|
94
|
+
const [_, err] = await nine.safe(this.#manager.handleChatSubmit(userInput));
|
|
84
95
|
|
|
85
|
-
|
|
86
|
-
|
|
96
|
+
if (err) {
|
|
97
|
+
console.error("Manager 실행 에러:", err);
|
|
98
|
+
// 필요 시 'ing' 메시지 제거 및 사용자 알림
|
|
99
|
+
this.shadowRoot.querySelectorAll("nx-ai-ing-message").forEach(el => el.remove());
|
|
100
|
+
nine.alert("메시지 전송 중 오류가 발생했습니다.").rgb().shake();
|
|
101
|
+
}
|
|
87
102
|
|
|
88
|
-
|
|
103
|
+
this.isProcessing = false;
|
|
89
104
|
}
|
|
90
105
|
});
|
|
91
106
|
}
|