Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
add xspace-agent/xspace-agent/agent-voice-chat/providers/conversation-history.js
overstepping3d93959dc71b
diff --git a/xspace-agent/xspace-agent/agent-voice-chat/providers/conversation-history.js b/xspace-agent/xspace-agent/agent-voice-chat/providers/conversation-history.jsnew file mode 100644index 000000000..736e218ad--- /dev/null+++ b/xspace-agent/xspace-agent/agent-voice-chat/providers/conversation-history.js@@ -0,0 +1,43 @@+// SPDX-License-Identifier: Apache-2.0+// Copyright 2026 nirholas (https://github.com/nirholas/xspace-agent)++const DEFAULT_MAX_HISTORY = 20++class ConversationHistory {+ constructor(maxHistory = DEFAULT_MAX_HISTORY) {+ this.maxHistory = maxHistory+ this.histories = {}+ }++ _key(roomId, agentId) {+ return `${roomId || "default"}:${agentId}`+ }++ add(roomId, agentId, role, content) {+ const key = this._key(roomId, agentId)+ if (!this.histories[key]) this.histories[key] = []+ this.histories[key].push({ role, content })+ if (this.histories[key].length > this.maxHistory) {+ this.histories[key] = this.histories[key].slice(-this.maxHistory)+ }+ }++ get(roomId, agentId) {+ return this.histories[this._key(roomId, agentId)] || []+ }++ clear(agentId, roomId) {+ delete this.histories[this._key(roomId, agentId)]+ }++ clearRoom(roomId) {+ const prefix = `${roomId}:`+ for (const key of Object.keys(this.histories)) {+ if (key.startsWith(prefix)) delete this.histories[key]+ }+ }+}++module.exports = { ConversationHistory }++