forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopilot-context.ts
More file actions
91 lines (66 loc) · 1.95 KB
/
Copy pathcopilot-context.ts
File metadata and controls
91 lines (66 loc) · 1.95 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import type { CopilotContextParams, CopilotApiConfig } from "../context";
const noop = () => {};
const copilotApiConfig: CopilotApiConfig = {
chatApiEndpoint: "http://localhost",
headers: {},
};
export function createTestCopilotContext(
overrides: Partial<CopilotContextParams> = {},
): CopilotContextParams {
return {
actions: {},
setAction: noop,
removeAction: noop,
setRegisteredActions: () => "action-id",
removeRegisteredAction: noop,
chatComponentsCache: { current: { actions: {}, coAgentStateRenders: {} } },
getFunctionCallHandler: () => async () => {},
addContext: () => "context-id",
removeContext: noop,
getAllContext: () => [],
getContextString: () => "",
addDocumentContext: () => "document-id",
removeDocumentContext: noop,
getDocumentsContext: () => [],
isLoading: false,
setIsLoading: noop,
chatSuggestionConfiguration: {},
addChatSuggestionConfiguration: noop,
removeChatSuggestionConfiguration: noop,
chatInstructions: "",
setChatInstructions: noop,
additionalInstructions: [],
setAdditionalInstructions: noop,
copilotApiConfig,
showDevConsole: false,
coagentStates: {},
setCoagentStates: noop,
coagentStatesRef: { current: {} },
setCoagentStatesWithRef: noop,
agentSession: null,
setAgentSession: noop,
agentLock: null,
threadId: "",
setThreadId: noop,
runId: null,
setRunId: noop,
chatAbortControllerRef: { current: null },
forwardedParameters: {},
availableAgents: [],
extensions: {},
setExtensions: noop,
interruptActions: {},
setInterruptAction: noop,
removeInterruptAction: noop,
interruptEventQueue: {},
addInterruptEvent: noop,
resolveInterruptEvent: noop,
onError: noop,
bannerError: null,
setBannerError: noop,
internalErrorHandlers: {},
setInternalErrorHandler: noop,
removeInternalErrorHandler: noop,
...overrides,
};
}