@copilotkit/react-core 0.25.0-function-calling-fixes.1 → 0.25.0-mme-cloud.0
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 +216 -230
- package/CHANGELOG.md +3 -14
- package/dist/{chunk-BGB5G33N.mjs → chunk-4E2RCCQB.mjs} +2 -2
- package/dist/{chunk-AEUR5JBT.mjs → chunk-APVNN5QF.mjs} +3 -4
- package/dist/chunk-APVNN5QF.mjs.map +1 -0
- package/dist/{chunk-3WKJ25L3.mjs → chunk-CGT3AVYT.mjs} +3 -3
- package/dist/chunk-CGT3AVYT.mjs.map +1 -0
- package/dist/{chunk-KIKHLN4X.mjs → chunk-GH7QK2AZ.mjs} +3 -1
- package/dist/chunk-GH7QK2AZ.mjs.map +1 -0
- package/dist/{chunk-AHS4FVZS.mjs → chunk-KMTE4NLW.mjs} +21 -14
- package/dist/chunk-KMTE4NLW.mjs.map +1 -0
- package/dist/{chunk-KJQZ2VEU.mjs → chunk-M7JUS6OQ.mjs} +2 -2
- package/dist/{chunk-IVFY4G5O.mjs → chunk-O2GQ2XK7.mjs} +3 -3
- package/dist/{chunk-UA7HTIWR.mjs → chunk-PYBBWHNC.mjs} +3 -3
- package/dist/{chunk-4SFSYDB7.mjs → chunk-SPLPX72P.mjs} +11 -7
- package/dist/chunk-SPLPX72P.mjs.map +1 -0
- package/dist/{chunk-75RLNHDB.mjs → chunk-TEI34ZF5.mjs} +5 -5
- package/dist/chunk-TEI34ZF5.mjs.map +1 -0
- package/dist/{chunk-H6V2C2AN.mjs → chunk-YKHUBROO.mjs} +2 -2
- package/dist/components/copilot-provider/copilotkit-props.d.ts +12 -0
- package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.d.ts +0 -17
- package/dist/components/copilot-provider/copilotkit.js +19 -17
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +3 -4
- package/dist/components/copilot-provider/index.js +19 -17
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +3 -4
- package/dist/components/index.js +19 -17
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +3 -4
- package/dist/context/copilot-context.d.ts +15 -2
- package/dist/context/copilot-context.js +2 -0
- package/dist/context/copilot-context.js.map +1 -1
- package/dist/context/copilot-context.mjs +1 -1
- package/dist/context/index.js +2 -0
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/hooks/index.js +14 -14
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +10 -12
- package/dist/hooks/use-chat.d.ts +8 -2
- package/dist/hooks/use-chat.js +3 -4
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +2 -2
- package/dist/hooks/use-copilot-action.d.ts +1 -1
- package/dist/hooks/use-copilot-action.js +4 -9
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +2 -3
- package/dist/hooks/use-copilot-chat.js +12 -7
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +6 -7
- package/dist/hooks/use-make-copilot-actionable.js +2 -0
- package/dist/hooks/use-make-copilot-actionable.js.map +1 -1
- package/dist/hooks/use-make-copilot-actionable.mjs +2 -2
- package/dist/hooks/use-make-copilot-document-readable.js +2 -0
- package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
- package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
- package/dist/hooks/use-make-copilot-readable.js +2 -0
- package/dist/hooks/use-make-copilot-readable.js.map +1 -1
- package/dist/hooks/use-make-copilot-readable.mjs +2 -2
- package/dist/index.js +31 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -17
- package/dist/lib/copilot-task.js +2 -2
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +5 -6
- package/dist/lib/index.js +2 -2
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +5 -6
- package/dist/openai-assistants/hooks/index.js +2 -0
- package/dist/openai-assistants/hooks/index.js.map +1 -1
- package/dist/openai-assistants/hooks/index.mjs +4 -5
- package/dist/openai-assistants/hooks/use-copilot-chat-v2.js +2 -0
- package/dist/openai-assistants/hooks/use-copilot-chat-v2.js.map +1 -1
- package/dist/openai-assistants/hooks/use-copilot-chat-v2.mjs +4 -5
- package/dist/openai-assistants/index.js +2 -0
- package/dist/openai-assistants/index.js.map +1 -1
- package/dist/openai-assistants/index.mjs +4 -5
- package/dist/utils/fetch-chat-completion.js +2 -2
- package/dist/utils/fetch-chat-completion.js.map +1 -1
- package/dist/utils/fetch-chat-completion.mjs +1 -1
- package/package.json +4 -4
- package/src/components/copilot-provider/copilotkit-props.tsx +14 -0
- package/src/components/copilot-provider/copilotkit.tsx +21 -25
- package/src/context/copilot-context.tsx +19 -1
- package/src/hooks/use-chat.ts +9 -4
- package/src/hooks/use-copilot-action.ts +58 -10
- package/src/hooks/use-copilot-chat.ts +5 -1
- package/src/utils/fetch-chat-completion.ts +1 -0
- package/dist/chunk-3WKJ25L3.mjs.map +0 -1
- package/dist/chunk-4SFSYDB7.mjs.map +0 -1
- package/dist/chunk-75RLNHDB.mjs.map +0 -1
- package/dist/chunk-AEUR5JBT.mjs.map +0 -1
- package/dist/chunk-AHS4FVZS.mjs.map +0 -1
- package/dist/chunk-F2JIAPZQ.mjs +0 -14
- package/dist/chunk-F2JIAPZQ.mjs.map +0 -1
- package/dist/chunk-ISKBWE4O.mjs +0 -13
- package/dist/chunk-ISKBWE4O.mjs.map +0 -1
- package/dist/chunk-KIKHLN4X.mjs.map +0 -1
- package/dist/components/copilot-provider/standard-copilot-api-config.d.ts +0 -23
- package/dist/components/copilot-provider/standard-copilot-api-config.js +0 -38
- package/dist/components/copilot-provider/standard-copilot-api-config.js.map +0 -1
- package/dist/components/copilot-provider/standard-copilot-api-config.mjs +0 -8
- package/dist/components/copilot-provider/standard-copilot-api-config.mjs.map +0 -1
- package/dist/hooks/use-copilot-action-implementation.d.ts +0 -7
- package/dist/hooks/use-copilot-action-implementation.js +0 -140
- package/dist/hooks/use-copilot-action-implementation.js.map +0 -1
- package/dist/hooks/use-copilot-action-implementation.mjs +0 -9
- package/dist/hooks/use-copilot-action-implementation.mjs.map +0 -1
- package/src/components/copilot-provider/standard-copilot-api-config.tsx +0 -28
- package/src/hooks/use-copilot-action-implementation.ts +0 -60
- /package/dist/{chunk-BGB5G33N.mjs.map → chunk-4E2RCCQB.mjs.map} +0 -0
- /package/dist/{chunk-KJQZ2VEU.mjs.map → chunk-M7JUS6OQ.mjs.map} +0 -0
- /package/dist/{chunk-IVFY4G5O.mjs.map → chunk-O2GQ2XK7.mjs.map} +0 -0
- /package/dist/{chunk-UA7HTIWR.mjs.map → chunk-PYBBWHNC.mjs.map} +0 -0
- /package/dist/{chunk-H6V2C2AN.mjs.map → chunk-YKHUBROO.mjs.map} +0 -0
package/dist/chunk-F2JIAPZQ.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// src/components/copilot-provider/standard-copilot-api-config.tsx
|
|
2
|
-
var StandardCopilotApiConfig = class {
|
|
3
|
-
constructor(chatApiEndpoint, chatApiEndpointV2, headers, body) {
|
|
4
|
-
this.chatApiEndpoint = chatApiEndpoint;
|
|
5
|
-
this.chatApiEndpointV2 = chatApiEndpointV2;
|
|
6
|
-
this.headers = headers;
|
|
7
|
-
this.body = body;
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
StandardCopilotApiConfig
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=chunk-F2JIAPZQ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/copilot-provider/standard-copilot-api-config.tsx"],"sourcesContent":["import { CopilotApiConfig } from \"../../context/copilot-context\";\n\n/**\n * A standard implementation of the CopilotApiConfig interface.\n *\n * Pass in the base URL of the chat API, the headers to be sent with each request, and the body to be sent with each request.\n * The rest of the CopilotApiConfig interface is implemented by default.\n *\n */\n\nexport class StandardCopilotApiConfig implements CopilotApiConfig {\n chatApiEndpoint: string;\n chatApiEndpointV2: string;\n headers: Record<string, string>;\n body: Record<string, any>;\n\n constructor(\n chatApiEndpoint: string,\n chatApiEndpointV2: string,\n headers: Record<string, string>,\n body: Record<string, any>,\n ) {\n this.chatApiEndpoint = chatApiEndpoint;\n this.chatApiEndpointV2 = chatApiEndpointV2;\n this.headers = headers;\n this.body = body;\n }\n}\n"],"mappings":";AAUO,IAAM,2BAAN,MAA2D;AAAA,EAMhE,YACE,iBACA,mBACA,SACA,MACA;AACA,SAAK,kBAAkB;AACvB,SAAK,oBAAoB;AACzB,SAAK,UAAU;AACf,SAAK,OAAO;AAAA,EACd;AACF;","names":[]}
|
package/dist/chunk-ISKBWE4O.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useCopilotActionImplementation
|
|
3
|
-
} from "./chunk-75RLNHDB.mjs";
|
|
4
|
-
|
|
5
|
-
// src/hooks/use-copilot-action.ts
|
|
6
|
-
function useCopilotAction(action, dependencies) {
|
|
7
|
-
return useCopilotActionImplementation(action, dependencies);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
useCopilotAction
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=chunk-ISKBWE4O.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/use-copilot-action.ts"],"sourcesContent":["import { Parameter } from \"@copilotkit/shared\";\nimport { FrontendAction } from \"../types/frontend-action\";\nimport { useCopilotActionImplementation } from \"./use-copilot-action-implementation\";\n\n // Prettier chokes on the `const` in the function signature\n // To have the main implementation checked by prettier, we split \n // this into a separate file\n // prettier-ignore\nexport function useCopilotAction<const T extends Parameter[] | [] = []>(action: FrontendAction<T>, dependencies?: any[]): void {\n return useCopilotActionImplementation(action, dependencies);\n}\n\n// Usage Example:\n// useCopilotAction({\n// name: \"myAction\",\n// parameters: [\n// { name: \"arg1\", type: \"string\", enum: [\"option1\", \"option2\", \"option3\"], required: false },\n// { name: \"arg2\", type: \"number\" },\n// {\n// name: \"arg3\",\n// type: \"object\",\n// attributes: [\n// { name: \"nestedArg1\", type: \"boolean\" },\n// { name: \"xyz\", required: false },\n// ],\n// },\n// { name: \"arg4\", type: \"number[]\" },\n// ],\n// handler: ({ arg1, arg2, arg3, arg4 }) => {\n// const x = arg3.nestedArg1;\n// const z = arg3.xyz;\n// console.log(arg1, arg2, arg3);\n// },\n// });\n\n// useCopilotAction({\n// name: \"myAction\",\n// handler: () => {\n// console.log(\"No parameters provided.\");\n// },\n// });\n\n// https://community.openai.com/t/function-call-complex-arrays-as-parameters/295648/3\n"],"mappings":";;;;;AAQO,SAAS,iBAAwD,QAA2B,cAA4B;AAC7H,SAAO,+BAA+B,QAAQ,YAAY;AAC5D;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/context/copilot-context.tsx"],"sourcesContent":["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":";;;;;AAEA,OAAO,WAAoB;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,MAAM,cAAoC,mBAAmB;AAEpF,SAAS,oBAA0C;AACxD,SAAO,MAAM,WAAW,cAAc;AACxC;AAEA,SAAS,sBAAyB,OAAa;AAC7C,QAAM,IAAI,MAAM,uEAAuE;AACvF,SAAO;AACT;","names":[]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CopilotApiConfig } from '../../context/copilot-context.js';
|
|
2
|
-
import '@copilotkit/shared';
|
|
3
|
-
import '../../types/frontend-action.js';
|
|
4
|
-
import 'react';
|
|
5
|
-
import '../../hooks/use-tree.js';
|
|
6
|
-
import '../../types/document-pointer.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* A standard implementation of the CopilotApiConfig interface.
|
|
10
|
-
*
|
|
11
|
-
* Pass in the base URL of the chat API, the headers to be sent with each request, and the body to be sent with each request.
|
|
12
|
-
* The rest of the CopilotApiConfig interface is implemented by default.
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
declare class StandardCopilotApiConfig implements CopilotApiConfig {
|
|
16
|
-
chatApiEndpoint: string;
|
|
17
|
-
chatApiEndpointV2: string;
|
|
18
|
-
headers: Record<string, string>;
|
|
19
|
-
body: Record<string, any>;
|
|
20
|
-
constructor(chatApiEndpoint: string, chatApiEndpointV2: string, headers: Record<string, string>, body: Record<string, any>);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { StandardCopilotApiConfig };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/components/copilot-provider/standard-copilot-api-config.tsx
|
|
21
|
-
var standard_copilot_api_config_exports = {};
|
|
22
|
-
__export(standard_copilot_api_config_exports, {
|
|
23
|
-
StandardCopilotApiConfig: () => StandardCopilotApiConfig
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(standard_copilot_api_config_exports);
|
|
26
|
-
var StandardCopilotApiConfig = class {
|
|
27
|
-
constructor(chatApiEndpoint, chatApiEndpointV2, headers, body) {
|
|
28
|
-
this.chatApiEndpoint = chatApiEndpoint;
|
|
29
|
-
this.chatApiEndpointV2 = chatApiEndpointV2;
|
|
30
|
-
this.headers = headers;
|
|
31
|
-
this.body = body;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
-
0 && (module.exports = {
|
|
36
|
-
StandardCopilotApiConfig
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=standard-copilot-api-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/copilot-provider/standard-copilot-api-config.tsx"],"sourcesContent":["import { CopilotApiConfig } from \"../../context/copilot-context\";\n\n/**\n * A standard implementation of the CopilotApiConfig interface.\n *\n * Pass in the base URL of the chat API, the headers to be sent with each request, and the body to be sent with each request.\n * The rest of the CopilotApiConfig interface is implemented by default.\n *\n */\n\nexport class StandardCopilotApiConfig implements CopilotApiConfig {\n chatApiEndpoint: string;\n chatApiEndpointV2: string;\n headers: Record<string, string>;\n body: Record<string, any>;\n\n constructor(\n chatApiEndpoint: string,\n chatApiEndpointV2: string,\n headers: Record<string, string>,\n body: Record<string, any>,\n ) {\n this.chatApiEndpoint = chatApiEndpoint;\n this.chatApiEndpointV2 = chatApiEndpointV2;\n this.headers = headers;\n this.body = body;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,IAAM,2BAAN,MAA2D;AAAA,EAMhE,YACE,iBACA,mBACA,SACA,MACA;AACA,SAAK,kBAAkB;AACvB,SAAK,oBAAoB;AACzB,SAAK,UAAU;AACf,SAAK,OAAO;AAAA,EACd;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FrontendAction } from '../types/frontend-action.js';
|
|
2
|
-
import '@copilotkit/shared';
|
|
3
|
-
import 'react';
|
|
4
|
-
|
|
5
|
-
declare function useCopilotActionImplementation<T extends Array<any> = []>(action: FrontendAction<T>, dependencies?: any[]): void;
|
|
6
|
-
|
|
7
|
-
export { useCopilotActionImplementation };
|
|
@@ -1,140 +0,0 @@
|
|
|
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-action-implementation.ts
|
|
51
|
-
var use_copilot_action_implementation_exports = {};
|
|
52
|
-
__export(use_copilot_action_implementation_exports, {
|
|
53
|
-
useCopilotActionImplementation: () => useCopilotActionImplementation
|
|
54
|
-
});
|
|
55
|
-
module.exports = __toCommonJS(use_copilot_action_implementation_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-action-implementation.ts
|
|
100
|
-
var import_nanoid = require("nanoid");
|
|
101
|
-
function useCopilotActionImplementation(action, dependencies) {
|
|
102
|
-
const { setEntryPoint, removeEntryPoint, entryPoints, chatComponentsCache } = (0, import_react2.useContext)(CopilotContext);
|
|
103
|
-
const idRef = (0, import_react2.useRef)((0, import_nanoid.nanoid)());
|
|
104
|
-
if (dependencies === void 0) {
|
|
105
|
-
if (entryPoints[idRef.current]) {
|
|
106
|
-
entryPoints[idRef.current].handler = action.handler;
|
|
107
|
-
if (typeof action.render === "function") {
|
|
108
|
-
if (chatComponentsCache.current !== null) {
|
|
109
|
-
chatComponentsCache.current[action.name] = action.render;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
(0, import_react2.useEffect)(() => {
|
|
115
|
-
setEntryPoint(idRef.current, action);
|
|
116
|
-
if (chatComponentsCache.current !== null && action.render !== void 0) {
|
|
117
|
-
chatComponentsCache.current[action.name] = action.render;
|
|
118
|
-
}
|
|
119
|
-
return () => {
|
|
120
|
-
removeEntryPoint(idRef.current);
|
|
121
|
-
};
|
|
122
|
-
}, [
|
|
123
|
-
setEntryPoint,
|
|
124
|
-
removeEntryPoint,
|
|
125
|
-
action.description,
|
|
126
|
-
action.name,
|
|
127
|
-
// This should be faster than deep equality checking
|
|
128
|
-
// In addition, all major JS engines guarantee the order of object keys
|
|
129
|
-
JSON.stringify(action.parameters),
|
|
130
|
-
// include render only if it's a string
|
|
131
|
-
typeof action.render === "string" ? action.render : void 0,
|
|
132
|
-
// dependencies set by the developer
|
|
133
|
-
...dependencies || []
|
|
134
|
-
]);
|
|
135
|
-
}
|
|
136
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
137
|
-
0 && (module.exports = {
|
|
138
|
-
useCopilotActionImplementation
|
|
139
|
-
});
|
|
140
|
-
//# sourceMappingURL=use-copilot-action-implementation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/use-copilot-action-implementation.ts","../../src/context/copilot-context.tsx"],"sourcesContent":["import { useRef, useContext, useEffect } from \"react\";\nimport { FrontendAction } from \"../types/frontend-action\";\nimport { CopilotContext } from \"../context/copilot-context\";\nimport { nanoid } from \"nanoid\";\n\n// We implement useCopilotActionImplementation dependency handling so that\n// the developer has the option to not provide any dependencies.\n// In this case, we assume they want to update the handler on each rerender.\n// To avoid getting stuck in an infinite loop, we update the handler directly,\n// skipping React state updates.\n// This is ok in this case, because the handler is not part of any UI that\n// needs to be updated.\n// useCallback, useMemo or other memoization techniques are not suitable here,\n// because they will cause a infinite rerender loop.\nexport function useCopilotActionImplementation<T extends Array<any> = []>(\n action: FrontendAction<T>,\n dependencies?: any[],\n): void {\n const { setEntryPoint, removeEntryPoint, entryPoints, chatComponentsCache } =\n useContext(CopilotContext);\n const idRef = useRef<string>(nanoid());\n\n // If the developer doesn't provide dependencies, we assume they want to\n // update handler and render function when the action object changes.\n // This ensures that any captured variables in the handler are up to date.\n if (dependencies === undefined) {\n if (entryPoints[idRef.current]) {\n entryPoints[idRef.current].handler = action.handler;\n if (typeof action.render === \"function\") {\n if (chatComponentsCache.current !== null) {\n chatComponentsCache.current[action.name] = action.render;\n }\n }\n }\n }\n\n useEffect(() => {\n setEntryPoint(idRef.current, action);\n if (chatComponentsCache.current !== null && action.render !== undefined) {\n chatComponentsCache.current[action.name] = action.render;\n }\n return () => {\n // NOTE: For now, we don't remove the chatComponentsCache entry when the action is removed.\n // This is because we currently don't have access to the messages array in CopilotContext.\n removeEntryPoint(idRef.current);\n };\n }, [\n setEntryPoint,\n removeEntryPoint,\n action.description,\n action.name,\n // This should be faster than deep equality checking\n // In addition, all major JS engines guarantee the order of object keys\n JSON.stringify(action.parameters),\n // include render only if it's a string\n typeof action.render === \"string\" ? action.render : undefined,\n // dependencies set by the developer\n ...(dependencies || []),\n ]);\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;;;AD5HA,oBAAuB;AAWhB,SAAS,+BACd,QACA,cACM;AACN,QAAM,EAAE,eAAe,kBAAkB,aAAa,oBAAoB,QACxE,0BAAW,cAAc;AAC3B,QAAM,YAAQ,0BAAe,sBAAO,CAAC;AAKrC,MAAI,iBAAiB,QAAW;AAC9B,QAAI,YAAY,MAAM,OAAO,GAAG;AAC9B,kBAAY,MAAM,OAAO,EAAE,UAAU,OAAO;AAC5C,UAAI,OAAO,OAAO,WAAW,YAAY;AACvC,YAAI,oBAAoB,YAAY,MAAM;AACxC,8BAAoB,QAAQ,OAAO,IAAI,IAAI,OAAO;AAAA,QACpD;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,+BAAU,MAAM;AACd,kBAAc,MAAM,SAAS,MAAM;AACnC,QAAI,oBAAoB,YAAY,QAAQ,OAAO,WAAW,QAAW;AACvE,0BAAoB,QAAQ,OAAO,IAAI,IAAI,OAAO;AAAA,IACpD;AACA,WAAO,MAAM;AAGX,uBAAiB,MAAM,OAAO;AAAA,IAChC;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,OAAO;AAAA;AAAA;AAAA,IAGP,KAAK,UAAU,OAAO,UAAU;AAAA;AAAA,IAEhC,OAAO,OAAO,WAAW,WAAW,OAAO,SAAS;AAAA;AAAA,IAEpD,GAAI,gBAAgB,CAAC;AAAA,EACvB,CAAC;AACH;","names":["import_react","React"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { CopilotApiConfig } from "../../context/copilot-context";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A standard implementation of the CopilotApiConfig interface.
|
|
5
|
-
*
|
|
6
|
-
* Pass in the base URL of the chat API, the headers to be sent with each request, and the body to be sent with each request.
|
|
7
|
-
* The rest of the CopilotApiConfig interface is implemented by default.
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export class StandardCopilotApiConfig implements CopilotApiConfig {
|
|
12
|
-
chatApiEndpoint: string;
|
|
13
|
-
chatApiEndpointV2: string;
|
|
14
|
-
headers: Record<string, string>;
|
|
15
|
-
body: Record<string, any>;
|
|
16
|
-
|
|
17
|
-
constructor(
|
|
18
|
-
chatApiEndpoint: string,
|
|
19
|
-
chatApiEndpointV2: string,
|
|
20
|
-
headers: Record<string, string>,
|
|
21
|
-
body: Record<string, any>,
|
|
22
|
-
) {
|
|
23
|
-
this.chatApiEndpoint = chatApiEndpoint;
|
|
24
|
-
this.chatApiEndpointV2 = chatApiEndpointV2;
|
|
25
|
-
this.headers = headers;
|
|
26
|
-
this.body = body;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { useRef, useContext, useEffect } from "react";
|
|
2
|
-
import { FrontendAction } from "../types/frontend-action";
|
|
3
|
-
import { CopilotContext } from "../context/copilot-context";
|
|
4
|
-
import { nanoid } from "nanoid";
|
|
5
|
-
|
|
6
|
-
// We implement useCopilotActionImplementation dependency handling so that
|
|
7
|
-
// the developer has the option to not provide any dependencies.
|
|
8
|
-
// In this case, we assume they want to update the handler on each rerender.
|
|
9
|
-
// To avoid getting stuck in an infinite loop, we update the handler directly,
|
|
10
|
-
// skipping React state updates.
|
|
11
|
-
// This is ok in this case, because the handler is not part of any UI that
|
|
12
|
-
// needs to be updated.
|
|
13
|
-
// useCallback, useMemo or other memoization techniques are not suitable here,
|
|
14
|
-
// because they will cause a infinite rerender loop.
|
|
15
|
-
export function useCopilotActionImplementation<T extends Array<any> = []>(
|
|
16
|
-
action: FrontendAction<T>,
|
|
17
|
-
dependencies?: any[],
|
|
18
|
-
): void {
|
|
19
|
-
const { setEntryPoint, removeEntryPoint, entryPoints, chatComponentsCache } =
|
|
20
|
-
useContext(CopilotContext);
|
|
21
|
-
const idRef = useRef<string>(nanoid());
|
|
22
|
-
|
|
23
|
-
// If the developer doesn't provide dependencies, we assume they want to
|
|
24
|
-
// update handler and render function when the action object changes.
|
|
25
|
-
// This ensures that any captured variables in the handler are up to date.
|
|
26
|
-
if (dependencies === undefined) {
|
|
27
|
-
if (entryPoints[idRef.current]) {
|
|
28
|
-
entryPoints[idRef.current].handler = action.handler;
|
|
29
|
-
if (typeof action.render === "function") {
|
|
30
|
-
if (chatComponentsCache.current !== null) {
|
|
31
|
-
chatComponentsCache.current[action.name] = action.render;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
setEntryPoint(idRef.current, action);
|
|
39
|
-
if (chatComponentsCache.current !== null && action.render !== undefined) {
|
|
40
|
-
chatComponentsCache.current[action.name] = action.render;
|
|
41
|
-
}
|
|
42
|
-
return () => {
|
|
43
|
-
// NOTE: For now, we don't remove the chatComponentsCache entry when the action is removed.
|
|
44
|
-
// This is because we currently don't have access to the messages array in CopilotContext.
|
|
45
|
-
removeEntryPoint(idRef.current);
|
|
46
|
-
};
|
|
47
|
-
}, [
|
|
48
|
-
setEntryPoint,
|
|
49
|
-
removeEntryPoint,
|
|
50
|
-
action.description,
|
|
51
|
-
action.name,
|
|
52
|
-
// This should be faster than deep equality checking
|
|
53
|
-
// In addition, all major JS engines guarantee the order of object keys
|
|
54
|
-
JSON.stringify(action.parameters),
|
|
55
|
-
// include render only if it's a string
|
|
56
|
-
typeof action.render === "string" ? action.render : undefined,
|
|
57
|
-
// dependencies set by the developer
|
|
58
|
-
...(dependencies || []),
|
|
59
|
-
]);
|
|
60
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|