MCPcopy Create free account
hub / github.com/GCWing/BitFun / sendMessage

Method sendMessage

src/web-ui/src/app/services/AppManager.ts:181–217  ·  view source on GitHub ↗
(sessionId: string, content: string)

Source from the content-addressed store, hash-verified

179 }
180
181 async sendMessage(sessionId: string, content: string): Promise<void> {
182 const session = this.state.chatSessions.find(s => s.id === sessionId);
183 if (!session) {
184 throw new Error(`Chat session not found: ${sessionId}`);
185 }
186
187 const userMessage: ChatMessage = {
188 id: `msg_${Date.now()}_user`,
189 role: 'user',
190 content,
191 timestamp: new Date(),
192 agentId: session.agentId
193 };
194
195 // Add user message
196 const updatedMessages = [...session.messages, userMessage];
197 const updatedSession = {
198 ...session,
199 messages: updatedMessages,
200 updatedAt: new Date()
201 };
202
203 const updatedSessions = this.state.chatSessions.map(s =>
204 s.id === sessionId ? updatedSession : s
205 );
206
207 this.updateState({
208 chatSessions: updatedSessions,
209 activeChatSession: updatedSession
210 });
211
212 this.emitEvent({
213 type: 'chat:message:sent',
214 payload: { sessionId, message: userMessage }
215 });
216
217 }
218
219 // Extension management
220 async enableExtension(extensionId: string): Promise<void> {

Callers

nothing calls this directly

Calls 2

updateStateMethod · 0.95
emitEventMethod · 0.95

Tested by

no test coverage detected