@@ -4,25 +4,16 @@ import { BeatLoader } from "react-spinners";
4
4
import { StyledPromptButton } from "@/SharedButton" ;
5
5
import { LoggingDrawer } from "@/LoggingDrawer" ;
6
6
import { ClickPromptBird } from "@/ClickPromptBird" ;
7
+ import { SharedApi } from "@/types/shared" ;
7
8
8
- export type ExecButtonProps = {
9
+ interface ExecButtonProps extends SharedApi {
9
10
loading ?: boolean ;
10
11
text : string ;
11
12
children ?: React . ReactNode ;
12
13
handleResponse ?: ( response : any ) => void ;
13
14
conversationId ?: number ;
14
15
updateConversationId ?: ( conversationId : number ) => void ;
15
- createConversation : ( name ?: string ) => Promise < any > ;
16
- sendMessage : ( conversageId : number , message : string , name ?: string ) => Promise < any > ;
17
- isLoggedInApi : ( ) => Promise < any > ;
18
- changeConversationNameApi : ( conversation_id : number , name : string ) => Promise < any > ;
19
- createConversationApi : ( name ?: string ) => Promise < any > ;
20
- getChatsByConversationIdApi : ( conversationId : number ) => Promise < any > ;
21
- deleteConversationApi : ( conversationId : number ) => Promise < any > ;
22
- deleteAllConversationsApi : ( ) => Promise < any > ;
23
- sendMsgWithStreamResApi : ( conversageId : number , message : string , name ?: string ) => Promise < any > ;
24
- logoutApi : ( ) => Promise < any > ;
25
- } ;
16
+ }
26
17
27
18
export const ExecutePromptButton = ( {
28
19
loading,
@@ -31,8 +22,6 @@ export const ExecutePromptButton = ({
31
22
handleResponse,
32
23
conversationId,
33
24
updateConversationId,
34
- createConversation,
35
- sendMessage,
36
25
isLoggedInApi,
37
26
changeConversationNameApi,
38
27
createConversationApi,
@@ -63,7 +52,7 @@ export const ExecutePromptButton = ({
63
52
64
53
let newConversationId = conversationId ;
65
54
if ( ! conversationId ) {
66
- const conversation = await createConversation ( ) ;
55
+ const conversation = await createConversationApi ( ) ;
67
56
if ( ! conversation ) {
68
57
return ;
69
58
}
@@ -73,7 +62,7 @@ export const ExecutePromptButton = ({
73
62
}
74
63
75
64
if ( newConversationId ) {
76
- const response : any = await sendMessage ( newConversationId , text ) ;
65
+ const response : any = await sendMsgWithStreamResApi ( newConversationId , text ) ;
77
66
if ( response && handleResponse ) {
78
67
handleResponse ( response as any ) ;
79
68
}
@@ -117,13 +106,13 @@ export const ExecutePromptButton = ({
117
106
updateStatus : updateLoginStatus ,
118
107
isLoggedIn : hasLogin ,
119
108
initMessage : text ,
120
- changeConversationNameApi : changeConversationNameApi ,
121
- createConversationApi : createConversationApi ,
122
- getChatsByConversationIdApi : getChatsByConversationIdApi ,
123
- deleteConversationApi : deleteConversationApi ,
124
- deleteAllConversationsApi : deleteAllConversationsApi ,
125
- sendMsgWithStreamResApi : sendMsgWithStreamResApi ,
126
- logoutApi : logoutApi ,
109
+ changeConversationNameApi,
110
+ createConversationApi,
111
+ getChatsByConversationIdApi,
112
+ deleteConversationApi,
113
+ deleteAllConversationsApi,
114
+ sendMsgWithStreamResApi,
115
+ logoutApi,
127
116
} ) }
128
117
</ >
129
118
) ;
0 commit comments