Skip to content

Commit 035d3db

Browse files
committed
Update ping.tsx
1 parent f1278af commit 035d3db

File tree

1 file changed

+20
-21
lines changed
  • packages/usdk/packages/upstreet-agent/packages/react-agents/components/core

1 file changed

+20
-21
lines changed
Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
// userId: this.id,
2-
// supabase: this.useSupabase(),
3-
4-
import React, { useContext } from 'react';
5-
import type {
6-
PromptProps,
7-
} from '../../types';
1+
import React, { useState, useEffect } from 'react';
2+
import { useAgent, useSupabase } from '../../hooks';
83
import {
9-
ConversationContext,
10-
} from '../../context';
4+
PingManager,
5+
} from '../../classes/ping-manager';
6+
7+
export const Prompt = () => {
8+
const agent = useAgent();
9+
const supabase = useSupabase();
1110

12-
export const Prompt: React.FC<PromptProps> = /*memo(*/(props: PromptProps) => {
13-
// const agent = useContext(AgentContext);
14-
const conversation = useContext(ConversationContext).conversation;
11+
const [pingManager, setPingManager] = useState(() => new PingManager({
12+
userId: agent.id,
13+
supabase,
14+
}));
1515

16-
// const deps = [
17-
// props.children,
18-
// ];
19-
// agent.useEpoch(deps);
16+
useEffect(() => {
17+
pingManager.live();
18+
return () => {
19+
pingManager.destroy();
20+
};
21+
}, []);
2022

21-
return <prompt value={{
22-
...props,
23-
conversation,
24-
}} />;
25-
}//);
23+
return null;
24+
};

0 commit comments

Comments
 (0)