@nine-lab/nine-mu 0.1.179 → 0.1.181

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nine-lab/nine-mu",
3
- "version": "0.1.179",
3
+ "version": "0.1.181",
4
4
  "description": "AI-Driven Full-Stack Code Fabrication Engine",
5
5
  "type": "module",
6
6
  "main": "./dist/nine-mu.umd.js",
@@ -100,6 +100,7 @@ export class NineChat extends HTMLElement {
100
100
  this.#$nineChatMessage.add("ai", err.message || "알 수 없는 오류가 발생했습니다. 다시 시도해주세요.");
101
101
  } else {
102
102
  trace.log(result);
103
+ this.#manager.addChatHistory(result.message);
103
104
  this.#$nineChatMessage.add("ai", result.message);
104
105
  }
105
106
  }
@@ -139,12 +139,29 @@ export class NineChatManager {
139
139
 
140
140
 
141
141
 
142
+
143
+
144
+ #chatHistory = []; // 💡 이전 대화들을 저장할 메모리 창고
145
+
146
+ addChatHistory(message) {
147
+
148
+ this.#chatHistory.push({ role: 'ai', text: result.message });
149
+ }
150
+
142
151
  handleChatSubmit = async v => {
143
152
 
144
- const routes = await this.#getRoutes();
153
+ this.#chatHistory.push({ role: 'user', text: v });
154
+
155
+ // 1. 이전 대화 내역을 하나의 텍스트 포맷으로 예쁘게 말아줍니다.
156
+ const formattedHistory = this.#chatHistory.map(chat => {
157
+ return chat.role === 'user' ? `User: ${chat.text}` : `AI: ${chat.text}`;
158
+ }).join('\n');
159
+
145
160
 
161
+ // 2. AI 호출 시 history를 함께 실어서 보냅니다.
146
162
  return await this.#callTool("system-brain", {
147
163
  user_input : v,
164
+ chat_history: formattedHistory,
148
165
  routes : routes,
149
166
  current_path : "/group_member/student_management",
150
167
  });