File tree Expand file tree Collapse file tree 1 file changed +20
-21
lines changed
packages/usdk/packages/upstreet-agent/packages/react-agents/components/core Expand file tree Collapse file tree 1 file changed +20
-21
lines changed Original file line number Diff line number Diff line change 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' ;
83import {
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+ } ;
You can’t perform that action at this time.
0 commit comments