import React from 'react'; // import dedent from 'dedent'; // import ethers from 'upstreet-sdk/ethers'; // const { Contract } = ethers; import { useAgents, useCurrentAgent, // useActions, // AgentEvent, ActionEvent, PerceptionEvent, PendingActionEvent, // AgentObject, ActionMessage, // Scene, Agent, Action, JsonAction, Perception, AgentAppProps, DefaultAgentComponents, DefaultActions, DefaultPrompts, DefaultParsers, DefaultPerceptions, DefaultSchedulers, } from 'upstreet-sdk/agents'; // const AddMemoryAction = () => { return ( { const { agent, message } = e.data; const args = message.args as any; if (typeof args === 'object' && typeof args?.content === 'string') { console.log('remember handler 1', new Error().stack); await agent.addMemory(args.content, message); console.log('remember handler 2'); await agent.addAction(message); console.log('remember handler 3'); await agent.monologue(`Remembered: ${JSON.stringify(args.content)}`); console.log('remember handler 4'); } else { throw new Error('Invalid args'); } }} /> ); }; const GetMemoryAction = () => { return ( { const { agent, message } = e.data; const args = message.args as any; if (typeof args === 'object' && typeof args?.query === 'string') { const memories = await agent.getMemory(args.query, { matchThreshold: 0.2, matchCount: 10, }); if (memories.length > 0) { const memory = memories[0]; const newMessage = { ...message, args: { ...message.args, value: memory, }, }; await agent.addAction(newMessage); console.log('got memory', memory); await agent.monologue( `Remembered: ${JSON.stringify(args.query)} -> ${JSON.stringify(memory.text)}`, ); } else { await agent.monologue( `Could not remember: ${JSON.stringify(args.query)}`, ); } } else { throw new Error('Invalid args'); } }} /> ); }; const MemoryActions = () => { return ( <> ); }; export default function render() { return ( ); }