-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathchat.ts
77 lines (76 loc) · 3.32 KB
/
chat.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import {
NotificationHandler,
RequestHandler,
ChatParams,
ChatResult,
EndChatParams,
EndChatResult,
FeedbackParams,
FollowUpClickParams,
InfoLinkClickParams,
InsertToCursorPositionParams,
LinkClickParams,
QuickActionParams,
QuickActionResult,
SourceLinkClickParams,
TabChangeParams,
TabAddParams,
TabRemoveParams,
OpenTabParams,
OpenTabResult,
ChatUpdateParams,
FileClickParams,
InlineChatParams,
InlineChatResult,
ContextCommandParams,
CreatePromptParams,
InlineChatResultParams,
ListConversationsParams,
ListConversationsResult,
ConversationClickParams,
ConversationClickResult,
GetSerializedChatResult,
GetSerializedChatParams,
TabBarActionParams,
TabBarActionResult,
ChatOptionsUpdateParams,
PromptInputOptionChangeParams,
ButtonClickParams,
ButtonClickResult,
} from '../protocol'
/**
* The Chat feature interface. Provides access to chat features
*/
export type Chat = {
// Requests
onChatPrompt: (handler: RequestHandler<ChatParams, ChatResult | undefined | null, ChatResult>) => void
onInlineChatPrompt: (
handler: RequestHandler<InlineChatParams, InlineChatResult | undefined | null, InlineChatResult>
) => void
onEndChat: (handler: RequestHandler<EndChatParams, EndChatResult, void>) => void
onQuickAction: (handler: RequestHandler<QuickActionParams, QuickActionResult, void>) => void
openTab: (params: OpenTabParams) => Promise<OpenTabResult>
onButtonClick: (handler: RequestHandler<ButtonClickParams, ButtonClickResult, ButtonClickResult>) => void
onListConversations: (handler: RequestHandler<ListConversationsParams, ListConversationsResult, void>) => void
onConversationClick: (handler: RequestHandler<ConversationClickParams, ConversationClickResult, void>) => void
onTabBarAction: (handler: RequestHandler<TabBarActionParams, TabBarActionResult, void>) => void
getSerializedChat: (params: GetSerializedChatParams) => Promise<GetSerializedChatResult>
// Notifications
onSendFeedback: (handler: NotificationHandler<FeedbackParams>) => void
onReady: (handler: NotificationHandler<void>) => void
onTabAdd: (handler: NotificationHandler<TabAddParams>) => void
onTabChange: (handler: NotificationHandler<TabChangeParams>) => void
onTabRemove: (handler: NotificationHandler<TabRemoveParams>) => void
onCodeInsertToCursorPosition: (handler: NotificationHandler<InsertToCursorPositionParams>) => void
onLinkClick: (handler: NotificationHandler<LinkClickParams>) => void
onInfoLinkClick: (handler: NotificationHandler<InfoLinkClickParams>) => void
onSourceLinkClick: (handler: NotificationHandler<SourceLinkClickParams>) => void
onFollowUpClicked: (handler: NotificationHandler<FollowUpClickParams>) => void
sendChatUpdate: (params: ChatUpdateParams) => void
onFileClicked: (handler: NotificationHandler<FileClickParams>) => void
chatOptionsUpdate: (params: ChatOptionsUpdateParams) => void
sendContextCommands: (params: ContextCommandParams) => void
onCreatePrompt: (handler: NotificationHandler<CreatePromptParams>) => void
onInlineChatResult: (handler: NotificationHandler<InlineChatResultParams>) => void
onPromptInputOptionChange: (handler: NotificationHandler<PromptInputOptionChangeParams>) => void
}