@copilotkit/react-core
Version:
<div align="center"> <a href="https://copilotkit.ai" target="_blank"> <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/banner.png" alt="CopilotKit Logo"> </a>
95 lines (93 loc) • 2.55 kB
JavaScript
import {
__async
} from "./chunk-SKC7AJIV.mjs";
// src/context/copilot-context.tsx
import React from "react";
var emptyCopilotContext = {
actions: {},
setAction: () => {
},
removeAction: () => {
},
coAgentStateRenders: {},
setCoAgentStateRender: () => {
},
removeCoAgentStateRender: () => {
},
chatComponentsCache: { current: { actions: {}, coAgentStateRenders: {} } },
getContextString: (documents, categories) => returnAndThrowInDebug(""),
addContext: () => "",
removeContext: () => {
},
getFunctionCallHandler: () => returnAndThrowInDebug(() => __async(void 0, null, function* () {
})),
isLoading: false,
setIsLoading: () => returnAndThrowInDebug(false),
chatInstructions: "",
setChatInstructions: () => returnAndThrowInDebug(""),
additionalInstructions: [],
setAdditionalInstructions: () => returnAndThrowInDebug([]),
getDocumentsContext: (categories) => returnAndThrowInDebug([]),
addDocumentContext: () => returnAndThrowInDebug(""),
removeDocumentContext: () => {
},
runtimeClient: {},
copilotApiConfig: new class {
get chatApiEndpoint() {
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
}
get headers() {
return {};
}
get body() {
return {};
}
}(),
chatSuggestionConfiguration: {},
addChatSuggestionConfiguration: () => {
},
removeChatSuggestionConfiguration: () => {
},
showDevConsole: "auto",
coagentStates: {},
setCoagentStates: () => {
},
coagentStatesRef: { current: {} },
setCoagentStatesWithRef: () => {
},
agentSession: null,
setAgentSession: () => {
},
forwardedParameters: {},
agentLock: null,
threadId: "",
setThreadId: () => {
},
runId: null,
setRunId: () => {
},
chatAbortControllerRef: { current: null },
availableAgents: [],
extensions: {},
setExtensions: () => {
},
langGraphInterruptAction: null,
setLangGraphInterruptAction: () => null,
removeLangGraphInterruptAction: () => null
};
var CopilotContext = React.createContext(emptyCopilotContext);
function useCopilotContext() {
const context = React.useContext(CopilotContext);
if (context === emptyCopilotContext) {
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
}
return context;
}
function returnAndThrowInDebug(_value) {
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
}
export {
CopilotContext,
useCopilotContext
};
//# sourceMappingURL=chunk-UDUFMGWQ.mjs.map