| 2443 | |
| 2444 | // Update active request tracking (called from chat.js) |
| 2445 | updateActiveRequestTracking(chatId, isActive) { |
| 2446 | if (isActive) { |
| 2447 | if (!this.activeRequestIds.includes(chatId)) { |
| 2448 | this.activeRequestIds.push(chatId); |
| 2449 | } |
| 2450 | } else { |
| 2451 | const index = this.activeRequestIds.indexOf(chatId); |
| 2452 | if (index > -1) { |
| 2453 | this.activeRequestIds.splice(index, 1); |
| 2454 | } |
| 2455 | } |
| 2456 | }, |
| 2457 | |
| 2458 | add(role, content, image, audio, targetChatId = null) { |
| 2459 | // If targetChatId is provided, add to that chat, otherwise use active chat |