@copilotkit/react-core 0.25.0-multi-release-alpha.0 → 0.25.0-multi-feature-usecopilotreadable.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +165 -162
- package/CHANGELOG.md +47 -3
- package/dist/chunk-5L5PJJNT.mjs +28 -0
- package/dist/chunk-5L5PJJNT.mjs.map +1 -0
- package/dist/{chunk-GVLCTSXW.mjs → chunk-BCKOSVRB.mjs} +2 -2
- package/dist/{chunk-KJQZ2VEU.mjs → chunk-EABGYUTZ.mjs} +1 -1
- package/dist/chunk-EABGYUTZ.mjs.map +1 -0
- package/dist/chunk-EYKDJBDE.mjs +1 -0
- package/dist/{chunk-QGRMN7L3.mjs → chunk-L45P674M.mjs} +4 -4
- package/dist/chunk-L45P674M.mjs.map +1 -0
- package/dist/{chunk-AEUR5JBT.mjs → chunk-X3FZ6GTK.mjs} +11 -1
- package/dist/chunk-X3FZ6GTK.mjs.map +1 -0
- package/dist/components/copilot-provider/copilotkit.mjs +9 -435
- package/dist/components/copilot-provider/copilotkit.mjs.map +1 -1
- package/dist/components/copilot-provider/index.mjs +10 -435
- package/dist/components/copilot-provider/index.mjs.map +1 -1
- package/dist/components/copilot-provider/standard-copilot-api-config.mjs +4 -9
- package/dist/components/copilot-provider/standard-copilot-api-config.mjs.map +1 -1
- package/dist/components/index.mjs +11 -435
- package/dist/components/index.mjs.map +1 -1
- package/dist/context/copilot-context.mjs +5 -64
- package/dist/context/copilot-context.mjs.map +1 -1
- package/dist/context/index.mjs +6 -64
- package/dist/context/index.mjs.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +22 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +29 -528
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/use-chat.mjs +4 -295
- package/dist/hooks/use-chat.mjs.map +1 -1
- package/dist/hooks/use-copilot-action-implementation.mjs +5 -102
- package/dist/hooks/use-copilot-action-implementation.mjs.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +6 -107
- package/dist/hooks/use-copilot-action.mjs.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +13 -430
- package/dist/hooks/use-copilot-chat.mjs.map +1 -1
- package/dist/hooks/use-copilot-readable.d.ts +33 -0
- package/dist/hooks/use-copilot-readable.js +121 -0
- package/dist/hooks/use-copilot-readable.js.map +1 -0
- package/dist/hooks/use-copilot-readable.mjs +9 -0
- package/dist/hooks/use-copilot-readable.mjs.map +1 -0
- package/dist/hooks/use-flat-category-store.mjs +4 -65
- package/dist/hooks/use-flat-category-store.mjs.map +1 -1
- package/dist/hooks/use-make-copilot-actionable.mjs +5 -88
- package/dist/hooks/use-make-copilot-actionable.mjs.map +1 -1
- package/dist/hooks/use-make-copilot-document-readable.mjs +5 -78
- package/dist/hooks/use-make-copilot-document-readable.mjs.map +1 -1
- package/dist/hooks/use-make-copilot-readable.d.ts +1 -5
- package/dist/hooks/use-make-copilot-readable.js.map +1 -1
- package/dist/hooks/use-make-copilot-readable.mjs +5 -78
- package/dist/hooks/use-make-copilot-readable.mjs.map +1 -1
- package/dist/hooks/use-tree.mjs +4 -150
- package/dist/hooks/use-tree.mjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +33 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -1113
- package/dist/index.mjs.map +1 -1
- package/dist/lib/copilot-task.d.ts +7 -2
- package/dist/lib/copilot-task.js +3 -3
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +11 -192
- package/dist/lib/copilot-task.mjs.map +1 -1
- package/dist/lib/index.js +3 -3
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +12 -192
- package/dist/lib/index.mjs.map +1 -1
- package/dist/openai-assistants/hooks/index.mjs +15 -228
- package/dist/openai-assistants/hooks/index.mjs.map +1 -1
- package/dist/openai-assistants/hooks/use-assistants.mjs +7 -45
- package/dist/openai-assistants/hooks/use-assistants.mjs.map +1 -1
- package/dist/openai-assistants/hooks/use-copilot-chat-v2.mjs +15 -228
- package/dist/openai-assistants/hooks/use-copilot-chat-v2.mjs.map +1 -1
- package/dist/openai-assistants/index.mjs +18 -228
- package/dist/openai-assistants/index.mjs.map +1 -1
- package/dist/openai-assistants/utils/index.mjs +5 -43
- package/dist/openai-assistants/utils/index.mjs.map +1 -1
- package/dist/openai-assistants/utils/process-message-stream.mjs +4 -43
- package/dist/openai-assistants/utils/process-message-stream.mjs.map +1 -1
- package/dist/types/index.mjs +1 -0
- package/dist/utils/fetch-chat-completion.mjs +5 -112
- package/dist/utils/fetch-chat-completion.mjs.map +1 -1
- package/package.json +4 -4
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-copilot-readable.ts +60 -0
- package/src/hooks/use-make-copilot-readable.ts +1 -5
- package/src/lib/copilot-task.ts +12 -5
- package/dist/chunk-AEUR5JBT.mjs.map +0 -1
- package/dist/chunk-IOP6JX34.mjs +0 -1
- package/dist/chunk-KJQZ2VEU.mjs.map +0 -1
- package/dist/chunk-QGRMN7L3.mjs.map +0 -1
- /package/dist/{chunk-GVLCTSXW.mjs.map → chunk-BCKOSVRB.mjs.map} +0 -0
- /package/dist/{chunk-IOP6JX34.mjs.map → chunk-EYKDJBDE.mjs.map} +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var __async = (__this, __arguments, generator) => {
|
|
30
|
+
return new Promise((resolve, reject) => {
|
|
31
|
+
var fulfilled = (value) => {
|
|
32
|
+
try {
|
|
33
|
+
step(generator.next(value));
|
|
34
|
+
} catch (e) {
|
|
35
|
+
reject(e);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var rejected = (value) => {
|
|
39
|
+
try {
|
|
40
|
+
step(generator.throw(value));
|
|
41
|
+
} catch (e) {
|
|
42
|
+
reject(e);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
46
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// src/hooks/use-copilot-readable.ts
|
|
51
|
+
var use_copilot_readable_exports = {};
|
|
52
|
+
__export(use_copilot_readable_exports, {
|
|
53
|
+
useCopilotReadable: () => useCopilotReadable
|
|
54
|
+
});
|
|
55
|
+
module.exports = __toCommonJS(use_copilot_readable_exports);
|
|
56
|
+
var import_react2 = require("react");
|
|
57
|
+
|
|
58
|
+
// src/context/copilot-context.tsx
|
|
59
|
+
var import_react = __toESM(require("react"));
|
|
60
|
+
var emptyCopilotContext = {
|
|
61
|
+
entryPoints: {},
|
|
62
|
+
setEntryPoint: () => {
|
|
63
|
+
},
|
|
64
|
+
removeEntryPoint: () => {
|
|
65
|
+
},
|
|
66
|
+
getChatCompletionFunctionDescriptions: () => returnAndThrowInDebug([]),
|
|
67
|
+
getFunctionCallHandler: () => returnAndThrowInDebug(() => __async(void 0, null, function* () {
|
|
68
|
+
})),
|
|
69
|
+
chatComponentsCache: { current: {} },
|
|
70
|
+
getContextString: (documents, categories) => returnAndThrowInDebug(""),
|
|
71
|
+
addContext: () => "",
|
|
72
|
+
removeContext: () => {
|
|
73
|
+
},
|
|
74
|
+
getDocumentsContext: (categories) => returnAndThrowInDebug([]),
|
|
75
|
+
addDocumentContext: () => returnAndThrowInDebug(""),
|
|
76
|
+
removeDocumentContext: () => {
|
|
77
|
+
},
|
|
78
|
+
copilotApiConfig: new class {
|
|
79
|
+
get chatApiEndpoint() {
|
|
80
|
+
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
|
|
81
|
+
}
|
|
82
|
+
get chatApiEndpointV2() {
|
|
83
|
+
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
|
|
84
|
+
}
|
|
85
|
+
get headers() {
|
|
86
|
+
return {};
|
|
87
|
+
}
|
|
88
|
+
get body() {
|
|
89
|
+
return {};
|
|
90
|
+
}
|
|
91
|
+
}()
|
|
92
|
+
};
|
|
93
|
+
var CopilotContext = import_react.default.createContext(emptyCopilotContext);
|
|
94
|
+
function returnAndThrowInDebug(value) {
|
|
95
|
+
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// src/hooks/use-copilot-readable.ts
|
|
100
|
+
function convertToJSON(description, value) {
|
|
101
|
+
return `${description}: ${typeof value === "string" ? value : JSON.stringify(value)}`;
|
|
102
|
+
}
|
|
103
|
+
function useCopilotReadable({ description, value, parentId, categories, convert }, dependencies) {
|
|
104
|
+
const { addContext, removeContext } = (0, import_react2.useContext)(CopilotContext);
|
|
105
|
+
const idRef = (0, import_react2.useRef)();
|
|
106
|
+
convert = convert || convertToJSON;
|
|
107
|
+
const information = convert(description, value);
|
|
108
|
+
(0, import_react2.useEffect)(() => {
|
|
109
|
+
const id = addContext(information, parentId, categories);
|
|
110
|
+
idRef.current = id;
|
|
111
|
+
return () => {
|
|
112
|
+
removeContext(id);
|
|
113
|
+
};
|
|
114
|
+
}, [information, parentId, addContext, removeContext, ...dependencies || []]);
|
|
115
|
+
return idRef.current;
|
|
116
|
+
}
|
|
117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
+
0 && (module.exports = {
|
|
119
|
+
useCopilotReadable
|
|
120
|
+
});
|
|
121
|
+
//# sourceMappingURL=use-copilot-readable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-copilot-readable.ts","../../src/context/copilot-context.tsx"],"sourcesContent":["import { useContext, useEffect, useRef } from \"react\";\nimport { CopilotContext } from \"../context/copilot-context\";\n\n/**\n * Options for the useCopilotReadable hook.\n */\nexport interface UseCopilotReadableOptions {\n /**\n * The description of the information to be added to the Copilot context.\n */\n description: string;\n /**\n * The value to be added to the Copilot context.\n */\n value: any;\n /**\n * The ID of the parent context, if any.\n */\n parentId?: string;\n /**\n * An array of categories to control which context are visible where. Particularly useful\n * with CopilotTextarea (see `useMakeAutosuggestionFunction`)\n */\n categories?: string[];\n\n /**\n * A custom conversion function to use to serialize the value to a string. If not provided, the value\n * will be serialized using `JSON.stringify`.\n */\n convert?: (description: string, value: any) => string;\n}\n\nfunction convertToJSON(description: string, value: any): string {\n return `${description}: ${typeof value === \"string\" ? value : JSON.stringify(value)}`;\n}\n\n/**\n * Adds the given information to the Copilot context to make it readable by Copilot.\n */\nexport function useCopilotReadable(\n { description, value, parentId, categories, convert }: UseCopilotReadableOptions,\n dependencies?: any[],\n): string | undefined {\n const { addContext, removeContext } = useContext(CopilotContext);\n const idRef = useRef<string>();\n convert = convert || convertToJSON;\n\n const information = convert(description, value);\n\n useEffect(() => {\n const id = addContext(information, parentId, categories);\n idRef.current = id;\n\n return () => {\n removeContext(id);\n };\n }, [information, parentId, addContext, removeContext, ...(dependencies || [])]);\n\n return idRef.current;\n}\n","import { FunctionCallHandler, ToolDefinition } from \"@copilotkit/shared\";\nimport { ActionRenderProps, FrontendAction } from \"../types/frontend-action\";\nimport React, { Ref } from \"react\";\nimport { TreeNodeId } from \"../hooks/use-tree\";\nimport { DocumentPointer } from \"../types\";\n\n/**\n * Interface for the configuration of the Copilot API.\n */\nexport interface CopilotApiConfig {\n /**\n * The endpoint for the chat API.\n */\n chatApiEndpoint: string;\n\n /**\n * The endpoint for the chat API v2.\n */\n chatApiEndpointV2: string;\n\n /**\n * additional headers to be sent with the request\n * @default {}\n * @example\n * ```\n * {\n * 'Authorization': 'Bearer your_token_here'\n * }\n * ```\n */\n headers: Record<string, string>;\n\n /**\n * Additional body params to be sent with the request\n * @default {}\n * @example\n * ```\n * {\n * 'message': 'Hello, world!'\n * }\n * ```\n */\n body: Record<string, any>;\n\n /**\n * Backend only props that will be combined to body params to be sent with the request\n * @default {}\n * @example\n * ```\n * {\n * 'user_id': 'user_id'\n * }\n * ```\n */\n backendOnlyProps?: Record<string, any>;\n}\n\nexport type InChatRenderFunction = (props: ActionRenderProps<any>) => string | JSX.Element;\n\nexport interface CopilotContextParams {\n // function-calling\n entryPoints: Record<string, FrontendAction<any>>;\n setEntryPoint: (id: string, entryPoint: FrontendAction<any>) => void;\n removeEntryPoint: (id: string) => void;\n chatComponentsCache: React.RefObject<Record<string, InChatRenderFunction | string>>;\n getChatCompletionFunctionDescriptions: (\n customEntryPoints?: Record<string, FrontendAction<any>>,\n ) => ToolDefinition[];\n getFunctionCallHandler: (\n customEntryPoints?: Record<string, FrontendAction<any>>,\n ) => FunctionCallHandler;\n\n // text context\n addContext: (context: string, parentId?: string, categories?: string[]) => TreeNodeId;\n removeContext: (id: TreeNodeId) => void;\n getContextString: (documents: DocumentPointer[], categories: string[]) => string;\n\n // document context\n addDocumentContext: (documentPointer: DocumentPointer, categories?: string[]) => TreeNodeId;\n removeDocumentContext: (documentId: string) => void;\n getDocumentsContext: (categories: string[]) => DocumentPointer[];\n\n // api endpoints\n copilotApiConfig: CopilotApiConfig;\n}\n\nconst emptyCopilotContext: CopilotContextParams = {\n entryPoints: {},\n setEntryPoint: () => {},\n removeEntryPoint: () => {},\n getChatCompletionFunctionDescriptions: () => returnAndThrowInDebug([]),\n getFunctionCallHandler: () => returnAndThrowInDebug(async () => {}),\n chatComponentsCache: { current: {} },\n getContextString: (documents: DocumentPointer[], categories: string[]) =>\n returnAndThrowInDebug(\"\"),\n addContext: () => \"\",\n removeContext: () => {},\n\n getDocumentsContext: (categories: string[]) => returnAndThrowInDebug([]),\n addDocumentContext: () => returnAndThrowInDebug(\"\"),\n removeDocumentContext: () => {},\n\n copilotApiConfig: new (class implements CopilotApiConfig {\n get chatApiEndpoint(): string {\n throw new Error(\"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!\");\n }\n get chatApiEndpointV2(): string {\n throw new Error(\"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!\");\n }\n get headers(): Record<string, string> {\n return {};\n }\n get body(): Record<string, any> {\n return {};\n }\n })(),\n};\n\nexport const CopilotContext = React.createContext<CopilotContextParams>(emptyCopilotContext);\n\nexport function useCopilotContext(): CopilotContextParams {\n return React.useContext(CopilotContext);\n}\n\nfunction returnAndThrowInDebug<T>(value: T): T {\n throw new Error(\"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!\");\n return value;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA8C;;;ACE9C,mBAA2B;AAoF3B,IAAM,sBAA4C;AAAA,EAChD,aAAa,CAAC;AAAA,EACd,eAAe,MAAM;AAAA,EAAC;AAAA,EACtB,kBAAkB,MAAM;AAAA,EAAC;AAAA,EACzB,uCAAuC,MAAM,sBAAsB,CAAC,CAAC;AAAA,EACrE,wBAAwB,MAAM,sBAAsB,MAAY;AAAA,EAAC,EAAC;AAAA,EAClE,qBAAqB,EAAE,SAAS,CAAC,EAAE;AAAA,EACnC,kBAAkB,CAAC,WAA8B,eAC/C,sBAAsB,EAAE;AAAA,EAC1B,YAAY,MAAM;AAAA,EAClB,eAAe,MAAM;AAAA,EAAC;AAAA,EAEtB,qBAAqB,CAAC,eAAyB,sBAAsB,CAAC,CAAC;AAAA,EACvE,oBAAoB,MAAM,sBAAsB,EAAE;AAAA,EAClD,uBAAuB,MAAM;AAAA,EAAC;AAAA,EAE9B,kBAAkB,IAAK,MAAkC;AAAA,IACvD,IAAI,kBAA0B;AAC5B,YAAM,IAAI,MAAM,uEAAuE;AAAA,IACzF;AAAA,IACA,IAAI,oBAA4B;AAC9B,YAAM,IAAI,MAAM,uEAAuE;AAAA,IACzF;AAAA,IACA,IAAI,UAAkC;AACpC,aAAO,CAAC;AAAA,IACV;AAAA,IACA,IAAI,OAA4B;AAC9B,aAAO,CAAC;AAAA,IACV;AAAA,EACF,EAAG;AACL;AAEO,IAAM,iBAAiB,aAAAC,QAAM,cAAoC,mBAAmB;AAM3F,SAAS,sBAAyB,OAAa;AAC7C,QAAM,IAAI,MAAM,uEAAuE;AACvF,SAAO;AACT;;;AD/FA,SAAS,cAAc,aAAqB,OAAoB;AAC9D,SAAO,GAAG,gBAAgB,OAAO,UAAU,WAAW,QAAQ,KAAK,UAAU,KAAK;AACpF;AAKO,SAAS,mBACd,EAAE,aAAa,OAAO,UAAU,YAAY,QAAQ,GACpD,cACoB;AACpB,QAAM,EAAE,YAAY,cAAc,QAAI,0BAAW,cAAc;AAC/D,QAAM,YAAQ,sBAAe;AAC7B,YAAU,WAAW;AAErB,QAAM,cAAc,QAAQ,aAAa,KAAK;AAE9C,+BAAU,MAAM;AACd,UAAM,KAAK,WAAW,aAAa,UAAU,UAAU;AACvD,UAAM,UAAU;AAEhB,WAAO,MAAM;AACX,oBAAc,EAAE;AAAA,IAClB;AAAA,EACF,GAAG,CAAC,aAAa,UAAU,YAAY,eAAe,GAAI,gBAAgB,CAAC,CAAE,CAAC;AAE9E,SAAO,MAAM;AACf;","names":["import_react","React"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,68 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const [elements, dispatch] = useReducer(flatCategoryStoreReducer, /* @__PURE__ */ new Map());
|
|
6
|
-
const addElement = useCallback((value, categories) => {
|
|
7
|
-
const newId = nanoid();
|
|
8
|
-
dispatch({
|
|
9
|
-
type: "ADD_ELEMENT",
|
|
10
|
-
value,
|
|
11
|
-
id: newId,
|
|
12
|
-
categories
|
|
13
|
-
});
|
|
14
|
-
return newId;
|
|
15
|
-
}, []);
|
|
16
|
-
const removeElement = useCallback((id) => {
|
|
17
|
-
dispatch({ type: "REMOVE_ELEMENT", id });
|
|
18
|
-
}, []);
|
|
19
|
-
const allElements = useCallback(
|
|
20
|
-
(categories) => {
|
|
21
|
-
const categoriesSet = new Set(categories);
|
|
22
|
-
const result = [];
|
|
23
|
-
elements.forEach((element) => {
|
|
24
|
-
if (setsHaveIntersection(categoriesSet, element.categories)) {
|
|
25
|
-
result.push(element.value);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
return result;
|
|
29
|
-
},
|
|
30
|
-
[elements]
|
|
31
|
-
);
|
|
32
|
-
return { addElement, removeElement, allElements };
|
|
33
|
-
};
|
|
34
|
-
var use_flat_category_store_default = useFlatCategoryStore;
|
|
35
|
-
function flatCategoryStoreReducer(state, action) {
|
|
36
|
-
switch (action.type) {
|
|
37
|
-
case "ADD_ELEMENT": {
|
|
38
|
-
const { value, id, categories } = action;
|
|
39
|
-
const newElement = {
|
|
40
|
-
id,
|
|
41
|
-
value,
|
|
42
|
-
categories: new Set(categories)
|
|
43
|
-
};
|
|
44
|
-
const newState = new Map(state);
|
|
45
|
-
newState.set(id, newElement);
|
|
46
|
-
return newState;
|
|
47
|
-
}
|
|
48
|
-
case "REMOVE_ELEMENT": {
|
|
49
|
-
const newState = new Map(state);
|
|
50
|
-
newState.delete(action.id);
|
|
51
|
-
return newState;
|
|
52
|
-
}
|
|
53
|
-
default:
|
|
54
|
-
return state;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function setsHaveIntersection(setA, setB) {
|
|
58
|
-
const [smallerSet, largerSet] = setA.size <= setB.size ? [setA, setB] : [setB, setA];
|
|
59
|
-
for (let item of smallerSet) {
|
|
60
|
-
if (largerSet.has(item)) {
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
use_flat_category_store_default
|
|
3
|
+
} from "../chunk-YULKJPY3.mjs";
|
|
4
|
+
import "../chunk-MRXNTQOX.mjs";
|
|
66
5
|
export {
|
|
67
6
|
use_flat_category_store_default as default
|
|
68
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,91 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// src/hooks/use-make-copilot-actionable.ts
|
|
23
|
-
import { useRef, useContext, useEffect, useMemo } from "react";
|
|
24
|
-
|
|
25
|
-
// src/context/copilot-context.tsx
|
|
26
|
-
import React from "react";
|
|
27
|
-
var emptyCopilotContext = {
|
|
28
|
-
entryPoints: {},
|
|
29
|
-
setEntryPoint: () => {
|
|
30
|
-
},
|
|
31
|
-
removeEntryPoint: () => {
|
|
32
|
-
},
|
|
33
|
-
getChatCompletionFunctionDescriptions: () => returnAndThrowInDebug([]),
|
|
34
|
-
getFunctionCallHandler: () => returnAndThrowInDebug(() => __async(void 0, null, function* () {
|
|
35
|
-
})),
|
|
36
|
-
chatComponentsCache: { current: {} },
|
|
37
|
-
getContextString: (documents, categories) => returnAndThrowInDebug(""),
|
|
38
|
-
addContext: () => "",
|
|
39
|
-
removeContext: () => {
|
|
40
|
-
},
|
|
41
|
-
getDocumentsContext: (categories) => returnAndThrowInDebug([]),
|
|
42
|
-
addDocumentContext: () => returnAndThrowInDebug(""),
|
|
43
|
-
removeDocumentContext: () => {
|
|
44
|
-
},
|
|
45
|
-
copilotApiConfig: new class {
|
|
46
|
-
get chatApiEndpoint() {
|
|
47
|
-
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
|
|
48
|
-
}
|
|
49
|
-
get chatApiEndpointV2() {
|
|
50
|
-
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
|
|
51
|
-
}
|
|
52
|
-
get headers() {
|
|
53
|
-
return {};
|
|
54
|
-
}
|
|
55
|
-
get body() {
|
|
56
|
-
return {};
|
|
57
|
-
}
|
|
58
|
-
}()
|
|
59
|
-
};
|
|
60
|
-
var CopilotContext = React.createContext(emptyCopilotContext);
|
|
61
|
-
function returnAndThrowInDebug(value) {
|
|
62
|
-
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
|
|
63
|
-
return value;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// src/hooks/use-make-copilot-actionable.ts
|
|
67
|
-
import { nanoid } from "nanoid";
|
|
68
|
-
import { annotatedFunctionToAction } from "@copilotkit/shared";
|
|
69
|
-
function useMakeCopilotActionable(annotatedFunction, dependencies) {
|
|
70
|
-
const idRef = useRef(nanoid());
|
|
71
|
-
const { setEntryPoint, removeEntryPoint } = useContext(CopilotContext);
|
|
72
|
-
const memoizedAnnotatedFunction = useMemo(
|
|
73
|
-
() => ({
|
|
74
|
-
name: annotatedFunction.name,
|
|
75
|
-
description: annotatedFunction.description,
|
|
76
|
-
argumentAnnotations: annotatedFunction.argumentAnnotations,
|
|
77
|
-
implementation: annotatedFunction.implementation
|
|
78
|
-
}),
|
|
79
|
-
dependencies
|
|
80
|
-
);
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
const action = annotatedFunctionToAction(memoizedAnnotatedFunction);
|
|
83
|
-
setEntryPoint(idRef.current, action);
|
|
84
|
-
return () => {
|
|
85
|
-
removeEntryPoint(idRef.current);
|
|
86
|
-
};
|
|
87
|
-
}, [memoizedAnnotatedFunction, setEntryPoint, removeEntryPoint]);
|
|
88
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
useMakeCopilotActionable
|
|
3
|
+
} from "../chunk-BGB5G33N.mjs";
|
|
4
|
+
import "../chunk-KIKHLN4X.mjs";
|
|
5
|
+
import "../chunk-MRXNTQOX.mjs";
|
|
89
6
|
export {
|
|
90
7
|
useMakeCopilotActionable
|
|
91
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,81 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// src/hooks/use-make-copilot-document-readable.ts
|
|
23
|
-
import { useContext, useEffect, useRef } from "react";
|
|
24
|
-
|
|
25
|
-
// src/context/copilot-context.tsx
|
|
26
|
-
import React from "react";
|
|
27
|
-
var emptyCopilotContext = {
|
|
28
|
-
entryPoints: {},
|
|
29
|
-
setEntryPoint: () => {
|
|
30
|
-
},
|
|
31
|
-
removeEntryPoint: () => {
|
|
32
|
-
},
|
|
33
|
-
getChatCompletionFunctionDescriptions: () => returnAndThrowInDebug([]),
|
|
34
|
-
getFunctionCallHandler: () => returnAndThrowInDebug(() => __async(void 0, null, function* () {
|
|
35
|
-
})),
|
|
36
|
-
chatComponentsCache: { current: {} },
|
|
37
|
-
getContextString: (documents, categories) => returnAndThrowInDebug(""),
|
|
38
|
-
addContext: () => "",
|
|
39
|
-
removeContext: () => {
|
|
40
|
-
},
|
|
41
|
-
getDocumentsContext: (categories) => returnAndThrowInDebug([]),
|
|
42
|
-
addDocumentContext: () => returnAndThrowInDebug(""),
|
|
43
|
-
removeDocumentContext: () => {
|
|
44
|
-
},
|
|
45
|
-
copilotApiConfig: new class {
|
|
46
|
-
get chatApiEndpoint() {
|
|
47
|
-
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
|
|
48
|
-
}
|
|
49
|
-
get chatApiEndpointV2() {
|
|
50
|
-
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
|
|
51
|
-
}
|
|
52
|
-
get headers() {
|
|
53
|
-
return {};
|
|
54
|
-
}
|
|
55
|
-
get body() {
|
|
56
|
-
return {};
|
|
57
|
-
}
|
|
58
|
-
}()
|
|
59
|
-
};
|
|
60
|
-
var CopilotContext = React.createContext(emptyCopilotContext);
|
|
61
|
-
function returnAndThrowInDebug(value) {
|
|
62
|
-
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
|
|
63
|
-
return value;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// src/hooks/use-make-copilot-document-readable.ts
|
|
67
|
-
function useMakeCopilotDocumentReadable(document, categories, dependencies = []) {
|
|
68
|
-
const { addDocumentContext, removeDocumentContext } = useContext(CopilotContext);
|
|
69
|
-
const idRef = useRef();
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
const id = addDocumentContext(document, categories);
|
|
72
|
-
idRef.current = id;
|
|
73
|
-
return () => {
|
|
74
|
-
removeDocumentContext(id);
|
|
75
|
-
};
|
|
76
|
-
}, [addDocumentContext, removeDocumentContext, ...dependencies]);
|
|
77
|
-
return idRef.current;
|
|
78
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
useMakeCopilotDocumentReadable
|
|
3
|
+
} from "../chunk-H6V2C2AN.mjs";
|
|
4
|
+
import "../chunk-KIKHLN4X.mjs";
|
|
5
|
+
import "../chunk-MRXNTQOX.mjs";
|
|
79
6
|
export {
|
|
80
7
|
useMakeCopilotDocumentReadable
|
|
81
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @param information - The information to be added to the Copilot context.
|
|
4
|
-
* @param parentId - The ID of the parent context, if any.
|
|
5
|
-
* @param categories - An array of categories to control which context are visible where. Particularly useful with CopilotTextarea (see `useMakeAutosuggestionFunction`)
|
|
6
|
-
* @returns The ID of the added context.
|
|
2
|
+
* @deprecated Use the useCopilotReadable function instead.
|
|
7
3
|
*/
|
|
8
4
|
declare function useMakeCopilotReadable(information: string, parentId?: string, categories?: string[]): string | undefined;
|
|
9
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/use-make-copilot-readable.ts","../../src/context/copilot-context.tsx"],"sourcesContent":["import { useContext, useEffect, useRef } from \"react\";\nimport { CopilotContext } from \"../context/copilot-context\";\n\n/**\n *
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-make-copilot-readable.ts","../../src/context/copilot-context.tsx"],"sourcesContent":["import { useContext, useEffect, useRef } from \"react\";\nimport { CopilotContext } from \"../context/copilot-context\";\n\n/**\n * @deprecated Use the useCopilotReadable function instead.\n */\nexport function useMakeCopilotReadable(\n information: string,\n parentId?: string,\n categories?: string[],\n): string | undefined {\n const { addContext, removeContext } = useContext(CopilotContext);\n const idRef = useRef<string>();\n\n useEffect(() => {\n const id = addContext(information, parentId, categories);\n idRef.current = id;\n\n return () => {\n removeContext(id);\n };\n }, [information, parentId, addContext, removeContext]);\n\n return idRef.current;\n}\n","import { FunctionCallHandler, ToolDefinition } from \"@copilotkit/shared\";\nimport { ActionRenderProps, FrontendAction } from \"../types/frontend-action\";\nimport React, { Ref } from \"react\";\nimport { TreeNodeId } from \"../hooks/use-tree\";\nimport { DocumentPointer } from \"../types\";\n\n/**\n * Interface for the configuration of the Copilot API.\n */\nexport interface CopilotApiConfig {\n /**\n * The endpoint for the chat API.\n */\n chatApiEndpoint: string;\n\n /**\n * The endpoint for the chat API v2.\n */\n chatApiEndpointV2: string;\n\n /**\n * additional headers to be sent with the request\n * @default {}\n * @example\n * ```\n * {\n * 'Authorization': 'Bearer your_token_here'\n * }\n * ```\n */\n headers: Record<string, string>;\n\n /**\n * Additional body params to be sent with the request\n * @default {}\n * @example\n * ```\n * {\n * 'message': 'Hello, world!'\n * }\n * ```\n */\n body: Record<string, any>;\n\n /**\n * Backend only props that will be combined to body params to be sent with the request\n * @default {}\n * @example\n * ```\n * {\n * 'user_id': 'user_id'\n * }\n * ```\n */\n backendOnlyProps?: Record<string, any>;\n}\n\nexport type InChatRenderFunction = (props: ActionRenderProps<any>) => string | JSX.Element;\n\nexport interface CopilotContextParams {\n // function-calling\n entryPoints: Record<string, FrontendAction<any>>;\n setEntryPoint: (id: string, entryPoint: FrontendAction<any>) => void;\n removeEntryPoint: (id: string) => void;\n chatComponentsCache: React.RefObject<Record<string, InChatRenderFunction | string>>;\n getChatCompletionFunctionDescriptions: (\n customEntryPoints?: Record<string, FrontendAction<any>>,\n ) => ToolDefinition[];\n getFunctionCallHandler: (\n customEntryPoints?: Record<string, FrontendAction<any>>,\n ) => FunctionCallHandler;\n\n // text context\n addContext: (context: string, parentId?: string, categories?: string[]) => TreeNodeId;\n removeContext: (id: TreeNodeId) => void;\n getContextString: (documents: DocumentPointer[], categories: string[]) => string;\n\n // document context\n addDocumentContext: (documentPointer: DocumentPointer, categories?: string[]) => TreeNodeId;\n removeDocumentContext: (documentId: string) => void;\n getDocumentsContext: (categories: string[]) => DocumentPointer[];\n\n // api endpoints\n copilotApiConfig: CopilotApiConfig;\n}\n\nconst emptyCopilotContext: CopilotContextParams = {\n entryPoints: {},\n setEntryPoint: () => {},\n removeEntryPoint: () => {},\n getChatCompletionFunctionDescriptions: () => returnAndThrowInDebug([]),\n getFunctionCallHandler: () => returnAndThrowInDebug(async () => {}),\n chatComponentsCache: { current: {} },\n getContextString: (documents: DocumentPointer[], categories: string[]) =>\n returnAndThrowInDebug(\"\"),\n addContext: () => \"\",\n removeContext: () => {},\n\n getDocumentsContext: (categories: string[]) => returnAndThrowInDebug([]),\n addDocumentContext: () => returnAndThrowInDebug(\"\"),\n removeDocumentContext: () => {},\n\n copilotApiConfig: new (class implements CopilotApiConfig {\n get chatApiEndpoint(): string {\n throw new Error(\"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!\");\n }\n get chatApiEndpointV2(): string {\n throw new Error(\"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!\");\n }\n get headers(): Record<string, string> {\n return {};\n }\n get body(): Record<string, any> {\n return {};\n }\n })(),\n};\n\nexport const CopilotContext = React.createContext<CopilotContextParams>(emptyCopilotContext);\n\nexport function useCopilotContext(): CopilotContextParams {\n return React.useContext(CopilotContext);\n}\n\nfunction returnAndThrowInDebug<T>(value: T): T {\n throw new Error(\"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!\");\n return value;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA8C;;;ACE9C,mBAA2B;AAoF3B,IAAM,sBAA4C;AAAA,EAChD,aAAa,CAAC;AAAA,EACd,eAAe,MAAM;AAAA,EAAC;AAAA,EACtB,kBAAkB,MAAM;AAAA,EAAC;AAAA,EACzB,uCAAuC,MAAM,sBAAsB,CAAC,CAAC;AAAA,EACrE,wBAAwB,MAAM,sBAAsB,MAAY;AAAA,EAAC,EAAC;AAAA,EAClE,qBAAqB,EAAE,SAAS,CAAC,EAAE;AAAA,EACnC,kBAAkB,CAAC,WAA8B,eAC/C,sBAAsB,EAAE;AAAA,EAC1B,YAAY,MAAM;AAAA,EAClB,eAAe,MAAM;AAAA,EAAC;AAAA,EAEtB,qBAAqB,CAAC,eAAyB,sBAAsB,CAAC,CAAC;AAAA,EACvE,oBAAoB,MAAM,sBAAsB,EAAE;AAAA,EAClD,uBAAuB,MAAM;AAAA,EAAC;AAAA,EAE9B,kBAAkB,IAAK,MAAkC;AAAA,IACvD,IAAI,kBAA0B;AAC5B,YAAM,IAAI,MAAM,uEAAuE;AAAA,IACzF;AAAA,IACA,IAAI,oBAA4B;AAC9B,YAAM,IAAI,MAAM,uEAAuE;AAAA,IACzF;AAAA,IACA,IAAI,UAAkC;AACpC,aAAO,CAAC;AAAA,IACV;AAAA,IACA,IAAI,OAA4B;AAC9B,aAAO,CAAC;AAAA,IACV;AAAA,EACF,EAAG;AACL;AAEO,IAAM,iBAAiB,aAAAC,QAAM,cAAoC,mBAAmB;AAM3F,SAAS,sBAAyB,OAAa;AAC7C,QAAM,IAAI,MAAM,uEAAuE;AACvF,SAAO;AACT;;;ADzHO,SAAS,uBACd,aACA,UACA,YACoB;AACpB,QAAM,EAAE,YAAY,cAAc,QAAI,0BAAW,cAAc;AAC/D,QAAM,YAAQ,sBAAe;AAE7B,+BAAU,MAAM;AACd,UAAM,KAAK,WAAW,aAAa,UAAU,UAAU;AACvD,UAAM,UAAU;AAEhB,WAAO,MAAM;AACX,oBAAc,EAAE;AAAA,IAClB;AAAA,EACF,GAAG,CAAC,aAAa,UAAU,YAAY,aAAa,CAAC;AAErD,SAAO,MAAM;AACf;","names":["import_react","React"]}
|
|
@@ -1,81 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// src/hooks/use-make-copilot-readable.ts
|
|
23
|
-
import { useContext, useEffect, useRef } from "react";
|
|
24
|
-
|
|
25
|
-
// src/context/copilot-context.tsx
|
|
26
|
-
import React from "react";
|
|
27
|
-
var emptyCopilotContext = {
|
|
28
|
-
entryPoints: {},
|
|
29
|
-
setEntryPoint: () => {
|
|
30
|
-
},
|
|
31
|
-
removeEntryPoint: () => {
|
|
32
|
-
},
|
|
33
|
-
getChatCompletionFunctionDescriptions: () => returnAndThrowInDebug([]),
|
|
34
|
-
getFunctionCallHandler: () => returnAndThrowInDebug(() => __async(void 0, null, function* () {
|
|
35
|
-
})),
|
|
36
|
-
chatComponentsCache: { current: {} },
|
|
37
|
-
getContextString: (documents, categories) => returnAndThrowInDebug(""),
|
|
38
|
-
addContext: () => "",
|
|
39
|
-
removeContext: () => {
|
|
40
|
-
},
|
|
41
|
-
getDocumentsContext: (categories) => returnAndThrowInDebug([]),
|
|
42
|
-
addDocumentContext: () => returnAndThrowInDebug(""),
|
|
43
|
-
removeDocumentContext: () => {
|
|
44
|
-
},
|
|
45
|
-
copilotApiConfig: new class {
|
|
46
|
-
get chatApiEndpoint() {
|
|
47
|
-
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
|
|
48
|
-
}
|
|
49
|
-
get chatApiEndpointV2() {
|
|
50
|
-
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
|
|
51
|
-
}
|
|
52
|
-
get headers() {
|
|
53
|
-
return {};
|
|
54
|
-
}
|
|
55
|
-
get body() {
|
|
56
|
-
return {};
|
|
57
|
-
}
|
|
58
|
-
}()
|
|
59
|
-
};
|
|
60
|
-
var CopilotContext = React.createContext(emptyCopilotContext);
|
|
61
|
-
function returnAndThrowInDebug(value) {
|
|
62
|
-
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
|
|
63
|
-
return value;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// src/hooks/use-make-copilot-readable.ts
|
|
67
|
-
function useMakeCopilotReadable(information, parentId, categories) {
|
|
68
|
-
const { addContext, removeContext } = useContext(CopilotContext);
|
|
69
|
-
const idRef = useRef();
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
const id = addContext(information, parentId, categories);
|
|
72
|
-
idRef.current = id;
|
|
73
|
-
return () => {
|
|
74
|
-
removeContext(id);
|
|
75
|
-
};
|
|
76
|
-
}, [information, parentId, addContext, removeContext]);
|
|
77
|
-
return idRef.current;
|
|
78
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
useMakeCopilotReadable
|
|
3
|
+
} from "../chunk-EABGYUTZ.mjs";
|
|
4
|
+
import "../chunk-KIKHLN4X.mjs";
|
|
5
|
+
import "../chunk-MRXNTQOX.mjs";
|
|
79
6
|
export {
|
|
80
7
|
useMakeCopilotReadable
|
|
81
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|