@copilotkit/react-core 0.16.0 → 0.17.0-alpha.1
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 +168 -134
- package/CHANGELOG.md +12 -0
- package/dist/chunk-5UGLWBZJ.mjs +3 -0
- package/dist/{chunk-YGJFU4ZP.mjs → chunk-6A4PCNMZ.mjs} +2 -12
- package/dist/chunk-6A4PCNMZ.mjs.map +1 -0
- package/dist/chunk-6SOQYBNX.mjs +44 -0
- package/dist/chunk-6SOQYBNX.mjs.map +1 -0
- package/dist/{chunk-RFZQHCNS.mjs → chunk-7P4OYNP3.mjs} +2 -2
- package/dist/{chunk-WL2MC3E2.mjs → chunk-FP4EXCGS.mjs} +2 -2
- package/dist/{chunk-PF7LXYPO.mjs → chunk-HW5IH6PV.mjs} +2 -2
- package/dist/chunk-PUFR5OAI.mjs +3 -0
- package/dist/{chunk-EV26IMLL.mjs → chunk-QTET3FBV.mjs} +5 -5
- package/dist/chunk-QTET3FBV.mjs.map +1 -0
- package/dist/{chunk-DE37LEZJ.mjs → chunk-SM3XH2NJ.mjs} +10 -12
- package/dist/chunk-SM3XH2NJ.mjs.map +1 -0
- package/dist/chunk-TDH7XE4X.mjs +104 -0
- package/dist/chunk-TDH7XE4X.mjs.map +1 -0
- package/dist/chunk-TKXPMMND.mjs +177 -0
- package/dist/chunk-TKXPMMND.mjs.map +1 -0
- package/dist/{chunk-IF64NU27.mjs → chunk-TU4DNDO7.mjs} +4 -4
- package/dist/chunk-TU4DNDO7.mjs.map +1 -0
- package/dist/chunk-VK25FIML.mjs +144 -0
- package/dist/chunk-VK25FIML.mjs.map +1 -0
- package/dist/chunk-VNRDQJXW.mjs +3 -0
- package/dist/chunk-VNRDQJXW.mjs.map +1 -0
- package/dist/components/copilot-provider/copilot-provider-props.d.ts +3 -3
- package/dist/components/copilot-provider/copilot-provider.d.ts +3 -3
- package/dist/components/copilot-provider/copilot-provider.mjs +2 -2
- package/dist/components/copilot-provider/index.d.ts +3 -3
- package/dist/components/copilot-provider/index.mjs +2 -2
- package/dist/components/copilot-provider/standard-copilot-api-config.d.ts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.mjs +2 -2
- package/dist/context/copilot-context.d.ts +4 -8
- package/dist/context/copilot-context.mjs +1 -1
- package/dist/context/index.d.ts +4 -4
- package/dist/context/index.mjs +2 -2
- package/dist/hooks/index.d.ts +6 -1
- package/dist/hooks/index.mjs +10 -7
- package/dist/hooks/use-chat.d.ts +84 -0
- package/dist/hooks/use-chat.mjs +6 -0
- package/dist/hooks/use-chat.mjs.map +1 -0
- package/dist/hooks/use-copilot-chat.d.ts +10 -3
- package/dist/hooks/use-copilot-chat.mjs +6 -3
- package/dist/hooks/use-make-copilot-actionable.mjs +2 -2
- package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
- package/dist/hooks/use-make-copilot-readable.mjs +2 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.mjs +15 -10
- package/dist/openai/chat-completion-client.d.ts +52 -0
- package/dist/openai/chat-completion-client.mjs +5 -0
- package/dist/openai/chat-completion-client.mjs.map +1 -0
- package/dist/openai/chat-completion-stream.d.ts +21 -0
- package/dist/openai/chat-completion-stream.mjs +5 -0
- package/dist/openai/chat-completion-stream.mjs.map +1 -0
- package/dist/openai/chat-completion-transport.d.ts +38 -0
- package/dist/openai/chat-completion-transport.mjs +4 -0
- package/dist/openai/chat-completion-transport.mjs.map +1 -0
- package/dist/openai/index.d.ts +10 -0
- package/dist/openai/index.mjs +6 -0
- package/dist/openai/index.mjs.map +1 -0
- package/dist/openai-assistants/hooks/index.mjs +4 -4
- package/dist/openai-assistants/hooks/use-copilot-chat-v2.mjs +4 -4
- package/dist/openai-assistants/index.mjs +4 -4
- package/dist/types/base.d.ts +56 -0
- package/dist/types/base.mjs +3 -0
- package/dist/types/base.mjs.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/message.d.ts +2 -0
- package/dist/types/message.mjs +3 -0
- package/dist/types/message.mjs.map +1 -0
- package/package.json +2 -2
- package/src/components/copilot-provider/copilot-provider.tsx +4 -5
- package/src/context/copilot-context.tsx +1 -12
- package/src/context/index.ts +0 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-chat.ts +197 -0
- package/src/hooks/use-copilot-chat.ts +10 -22
- package/src/index.tsx +1 -0
- package/src/openai/chat-completion-client.ts +229 -0
- package/src/openai/chat-completion-stream.ts +54 -0
- package/src/openai/chat-completion-transport.ts +186 -0
- package/src/openai/index.tsx +5 -0
- package/src/openai-assistants/hooks/use-copilot-chat-v2.ts +2 -2
- package/src/types/base.ts +61 -0
- package/src/types/index.ts +1 -0
- package/src/types/message.ts +0 -0
- package/dist/chunk-DE37LEZJ.mjs.map +0 -1
- package/dist/chunk-EV26IMLL.mjs.map +0 -1
- package/dist/chunk-IF64NU27.mjs.map +0 -1
- package/dist/chunk-QACD2U6P.mjs +0 -3
- package/dist/chunk-YGJFU4ZP.mjs.map +0 -1
- package/dist/chunk-YPSGKPDA.mjs +0 -3
- /package/dist/{chunk-QACD2U6P.mjs.map → chunk-5UGLWBZJ.mjs.map} +0 -0
- /package/dist/{chunk-RFZQHCNS.mjs.map → chunk-7P4OYNP3.mjs.map} +0 -0
- /package/dist/{chunk-WL2MC3E2.mjs.map → chunk-FP4EXCGS.mjs.map} +0 -0
- /package/dist/{chunk-PF7LXYPO.mjs.map → chunk-HW5IH6PV.mjs.map} +0 -0
- /package/dist/{chunk-YPSGKPDA.mjs.map → chunk-PUFR5OAI.mjs.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import '../../chunk-SPCZTZCY.mjs';
|
|
2
|
-
export { CopilotProvider, defaultCopilotContextCategories } from '../../chunk-
|
|
2
|
+
export { CopilotProvider, defaultCopilotContextCategories } from '../../chunk-QTET3FBV.mjs';
|
|
3
3
|
import '../../chunk-F2JIAPZQ.mjs';
|
|
4
4
|
import '../../chunk-VUY2K2DI.mjs';
|
|
5
|
+
import '../../chunk-6A4PCNMZ.mjs';
|
|
5
6
|
import '../../chunk-YULKJPY3.mjs';
|
|
6
|
-
import '../../chunk-YGJFU4ZP.mjs';
|
|
7
7
|
import '../../chunk-MRXNTQOX.mjs';
|
|
8
8
|
//# sourceMappingURL=out.js.map
|
|
9
9
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CopilotApiConfig } from '../../context/copilot-context.js';
|
|
2
|
-
import '
|
|
2
|
+
import '../../types/annotated-function.js';
|
|
3
|
+
import '../../types/document-pointer.js';
|
|
4
|
+
import '../../types/base.js';
|
|
3
5
|
import 'react';
|
|
4
6
|
import '../../hooks/use-tree.js';
|
|
5
|
-
import '../../types/annotated-function.js';
|
|
6
7
|
import 'openai/resources/chat';
|
|
7
|
-
import '../../types/document-pointer.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* A standard implementation of the CopilotApiConfig interface.
|
|
@@ -2,8 +2,8 @@ export { CopilotProvider, defaultCopilotContextCategories } from './copilot-prov
|
|
|
2
2
|
export { CopilotProviderApiConfigProps, CopilotProviderApiEndpointProps, CopilotProviderProps } from './copilot-provider/copilot-provider-props.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import '../context/copilot-context.js';
|
|
5
|
-
import 'ai';
|
|
6
|
-
import '../hooks/use-tree.js';
|
|
7
5
|
import '../types/annotated-function.js';
|
|
8
|
-
import 'openai/resources/chat';
|
|
9
6
|
import '../types/document-pointer.js';
|
|
7
|
+
import '../types/base.js';
|
|
8
|
+
import '../hooks/use-tree.js';
|
|
9
|
+
import 'openai/resources/chat';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import '../chunk-JD7BAH7U.mjs';
|
|
2
2
|
import '../chunk-SPCZTZCY.mjs';
|
|
3
|
-
export { CopilotProvider, defaultCopilotContextCategories } from '../chunk-
|
|
3
|
+
export { CopilotProvider, defaultCopilotContextCategories } from '../chunk-QTET3FBV.mjs';
|
|
4
4
|
import '../chunk-F2JIAPZQ.mjs';
|
|
5
5
|
import '../chunk-VUY2K2DI.mjs';
|
|
6
|
+
import '../chunk-6A4PCNMZ.mjs';
|
|
6
7
|
import '../chunk-YULKJPY3.mjs';
|
|
7
|
-
import '../chunk-YGJFU4ZP.mjs';
|
|
8
8
|
import '../chunk-MRXNTQOX.mjs';
|
|
9
9
|
//# sourceMappingURL=out.js.map
|
|
10
10
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnnotatedFunction } from '../types/annotated-function.js';
|
|
2
|
+
import { DocumentPointer } from '../types/document-pointer.js';
|
|
3
|
+
import { FunctionCallHandler } from '../types/base.js';
|
|
2
4
|
import React from 'react';
|
|
3
5
|
import { TreeNodeId } from '../hooks/use-tree.js';
|
|
4
|
-
import { AnnotatedFunction } from '../types/annotated-function.js';
|
|
5
6
|
import { ChatCompletionCreateParams } from 'openai/resources/chat';
|
|
6
|
-
import { DocumentPointer } from '../types/document-pointer.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Interface for the configuration of the Copilot API.
|
|
@@ -40,10 +40,6 @@ interface CopilotApiConfig {
|
|
|
40
40
|
*/
|
|
41
41
|
body: Record<string, any>;
|
|
42
42
|
}
|
|
43
|
-
declare function copilotApiConfigExtrapolator(config: CopilotApiConfig): {
|
|
44
|
-
readonly chatApiEndpoint: string;
|
|
45
|
-
readonly chatApiEndpointV2: string;
|
|
46
|
-
};
|
|
47
43
|
interface CopilotContextParams {
|
|
48
44
|
entryPoints: Record<string, AnnotatedFunction<any[]>>;
|
|
49
45
|
setEntryPoint: (id: string, entryPoint: AnnotatedFunction<any[]>) => void;
|
|
@@ -60,4 +56,4 @@ interface CopilotContextParams {
|
|
|
60
56
|
}
|
|
61
57
|
declare const CopilotContext: React.Context<CopilotContextParams>;
|
|
62
58
|
|
|
63
|
-
export { CopilotApiConfig, CopilotContext, CopilotContextParams
|
|
59
|
+
export { CopilotApiConfig, CopilotContext, CopilotContextParams };
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { CopilotApiConfig, CopilotContext, CopilotContextParams
|
|
2
|
-
import '
|
|
1
|
+
export { CopilotApiConfig, CopilotContext, CopilotContextParams } from './copilot-context.js';
|
|
2
|
+
import '../types/annotated-function.js';
|
|
3
|
+
import '../types/document-pointer.js';
|
|
4
|
+
import '../types/base.js';
|
|
3
5
|
import 'react';
|
|
4
6
|
import '../hooks/use-tree.js';
|
|
5
|
-
import '../types/annotated-function.js';
|
|
6
7
|
import 'openai/resources/chat';
|
|
7
|
-
import '../types/document-pointer.js';
|
package/dist/context/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import '../chunk-
|
|
2
|
-
export { CopilotContext
|
|
1
|
+
import '../chunk-VNRDQJXW.mjs';
|
|
2
|
+
export { CopilotContext } from '../chunk-6A4PCNMZ.mjs';
|
|
3
3
|
import '../chunk-MRXNTQOX.mjs';
|
|
4
4
|
//# sourceMappingURL=out.js.map
|
|
5
5
|
//# sourceMappingURL=index.mjs.map
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ export { UseCopilotChatOptions, UseCopilotChatReturn, useCopilotChat } from './u
|
|
|
2
2
|
export { useMakeCopilotActionable } from './use-make-copilot-actionable.js';
|
|
3
3
|
export { useMakeCopilotReadable } from './use-make-copilot-readable.js';
|
|
4
4
|
export { useMakeCopilotDocumentReadable } from './use-make-copilot-document-readable.js';
|
|
5
|
-
|
|
5
|
+
export { UseChatHelpers } from './use-chat.js';
|
|
6
|
+
import '../types/base.js';
|
|
7
|
+
import '../context/copilot-context.js';
|
|
6
8
|
import '../types/annotated-function.js';
|
|
7
9
|
import '../types/document-pointer.js';
|
|
10
|
+
import 'react';
|
|
11
|
+
import './use-tree.js';
|
|
12
|
+
import 'openai/resources/chat';
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import '../chunk-
|
|
2
|
-
export {
|
|
1
|
+
import '../chunk-5UGLWBZJ.mjs';
|
|
2
|
+
export { useMakeCopilotActionable } from '../chunk-FP4EXCGS.mjs';
|
|
3
|
+
export { useMakeCopilotDocumentReadable } from '../chunk-7P4OYNP3.mjs';
|
|
4
|
+
export { useMakeCopilotReadable } from '../chunk-HW5IH6PV.mjs';
|
|
5
|
+
export { useCopilotChat } from '../chunk-SM3XH2NJ.mjs';
|
|
3
6
|
import '../chunk-JD7BAH7U.mjs';
|
|
4
7
|
import '../chunk-SPCZTZCY.mjs';
|
|
5
|
-
import '../chunk-
|
|
8
|
+
import '../chunk-QTET3FBV.mjs';
|
|
6
9
|
import '../chunk-F2JIAPZQ.mjs';
|
|
7
10
|
import '../chunk-VUY2K2DI.mjs';
|
|
11
|
+
import '../chunk-6A4PCNMZ.mjs';
|
|
12
|
+
import '../chunk-TDH7XE4X.mjs';
|
|
13
|
+
import '../chunk-TKXPMMND.mjs';
|
|
14
|
+
import '../chunk-VK25FIML.mjs';
|
|
8
15
|
import '../chunk-YULKJPY3.mjs';
|
|
9
|
-
export { useMakeCopilotActionable } from '../chunk-WL2MC3E2.mjs';
|
|
10
|
-
export { useMakeCopilotDocumentReadable } from '../chunk-RFZQHCNS.mjs';
|
|
11
|
-
export { useMakeCopilotReadable } from '../chunk-PF7LXYPO.mjs';
|
|
12
|
-
import '../chunk-YGJFU4ZP.mjs';
|
|
13
16
|
import '../chunk-MRXNTQOX.mjs';
|
|
14
17
|
//# sourceMappingURL=out.js.map
|
|
15
18
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Message, FunctionCallHandler, Function } from '../types/base.js';
|
|
2
|
+
import { CopilotApiConfig } from '../context/copilot-context.js';
|
|
3
|
+
import '../types/annotated-function.js';
|
|
4
|
+
import '../types/document-pointer.js';
|
|
5
|
+
import 'react';
|
|
6
|
+
import './use-tree.js';
|
|
7
|
+
import 'openai/resources/chat';
|
|
8
|
+
|
|
9
|
+
type UseChatOptions = {
|
|
10
|
+
/**
|
|
11
|
+
* The API endpoint that accepts a `{ messages: Message[] }` object and returns
|
|
12
|
+
* a stream of tokens of the AI chat response. Defaults to `/api/chat`.
|
|
13
|
+
*/
|
|
14
|
+
api?: string;
|
|
15
|
+
/**
|
|
16
|
+
* A unique identifier for the chat. If not provided, a random one will be
|
|
17
|
+
* generated. When provided, the `useChat` hook with the same `id` will
|
|
18
|
+
* have shared states across components.
|
|
19
|
+
*/
|
|
20
|
+
id?: string;
|
|
21
|
+
/**
|
|
22
|
+
* System messages of the chat. Defaults to an empty array.
|
|
23
|
+
*/
|
|
24
|
+
initialMessages?: Message[];
|
|
25
|
+
/**
|
|
26
|
+
* Callback function to be called when a function call is received.
|
|
27
|
+
* If the function returns a `ChatRequest` object, the request will be sent
|
|
28
|
+
* automatically to the API and will be used to update the chat.
|
|
29
|
+
*/
|
|
30
|
+
onFunctionCall?: FunctionCallHandler;
|
|
31
|
+
/**
|
|
32
|
+
* HTTP headers to be sent with the API request.
|
|
33
|
+
*/
|
|
34
|
+
headers?: Record<string, string> | Headers;
|
|
35
|
+
/**
|
|
36
|
+
* Extra body object to be sent with the API request.
|
|
37
|
+
* @example
|
|
38
|
+
* Send a `sessionId` to the API along with the messages.
|
|
39
|
+
* ```js
|
|
40
|
+
* useChat({
|
|
41
|
+
* body: {
|
|
42
|
+
* sessionId: '123',
|
|
43
|
+
* }
|
|
44
|
+
* })
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
body?: object;
|
|
48
|
+
/**
|
|
49
|
+
* Function definitions to be sent to the API.
|
|
50
|
+
*/
|
|
51
|
+
functions?: Function[];
|
|
52
|
+
};
|
|
53
|
+
type UseChatHelpers = {
|
|
54
|
+
/** Current messages in the chat */
|
|
55
|
+
messages: Message[];
|
|
56
|
+
/**
|
|
57
|
+
* Append a user message to the chat list. This triggers the API call to fetch
|
|
58
|
+
* the assistant's response.
|
|
59
|
+
* @param message The message to append
|
|
60
|
+
*/
|
|
61
|
+
append: (message: Message) => Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Reload the last AI chat response for the given chat history. If the last
|
|
64
|
+
* message isn't from the assistant, it will request the API to generate a
|
|
65
|
+
* new response.
|
|
66
|
+
*/
|
|
67
|
+
reload: () => Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Abort the current request immediately, keep the generated tokens if any.
|
|
70
|
+
*/
|
|
71
|
+
stop: () => void;
|
|
72
|
+
/** The current value of the input */
|
|
73
|
+
input: string;
|
|
74
|
+
/** setState-powered method to update the input value */
|
|
75
|
+
setInput: React.Dispatch<React.SetStateAction<string>>;
|
|
76
|
+
/** Whether the API request is in progress */
|
|
77
|
+
isLoading: boolean;
|
|
78
|
+
};
|
|
79
|
+
type UseChatOptionsWithCopilotConfig = UseChatOptions & {
|
|
80
|
+
copilotConfig: CopilotApiConfig;
|
|
81
|
+
};
|
|
82
|
+
declare function useChat(options: UseChatOptionsWithCopilotConfig): UseChatHelpers;
|
|
83
|
+
|
|
84
|
+
export { UseChatHelpers, UseChatOptions, UseChatOptionsWithCopilotConfig, useChat };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Message } from '../types/base.js';
|
|
2
|
+
import { UseChatOptions } from './use-chat.js';
|
|
3
|
+
import '../context/copilot-context.js';
|
|
4
|
+
import '../types/annotated-function.js';
|
|
5
|
+
import '../types/document-pointer.js';
|
|
6
|
+
import 'react';
|
|
7
|
+
import './use-tree.js';
|
|
8
|
+
import 'openai/resources/chat';
|
|
2
9
|
|
|
3
10
|
interface UseCopilotChatOptions extends UseChatOptions {
|
|
4
11
|
makeSystemMessage?: (contextString: string) => string;
|
|
5
12
|
}
|
|
6
13
|
interface UseCopilotChatReturn {
|
|
7
14
|
visibleMessages: Message[];
|
|
8
|
-
append: (message: Message
|
|
9
|
-
reload: (
|
|
15
|
+
append: (message: Message) => Promise<void>;
|
|
16
|
+
reload: () => Promise<void>;
|
|
10
17
|
stop: () => void;
|
|
11
18
|
isLoading: boolean;
|
|
12
19
|
input: string;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
export { defaultSystemMessage, useCopilotChat } from '../chunk-
|
|
1
|
+
export { defaultSystemMessage, useCopilotChat } from '../chunk-SM3XH2NJ.mjs';
|
|
2
2
|
import '../chunk-JD7BAH7U.mjs';
|
|
3
3
|
import '../chunk-SPCZTZCY.mjs';
|
|
4
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-QTET3FBV.mjs';
|
|
5
5
|
import '../chunk-F2JIAPZQ.mjs';
|
|
6
6
|
import '../chunk-VUY2K2DI.mjs';
|
|
7
|
+
import '../chunk-6A4PCNMZ.mjs';
|
|
8
|
+
import '../chunk-TDH7XE4X.mjs';
|
|
9
|
+
import '../chunk-TKXPMMND.mjs';
|
|
10
|
+
import '../chunk-VK25FIML.mjs';
|
|
7
11
|
import '../chunk-YULKJPY3.mjs';
|
|
8
|
-
import '../chunk-YGJFU4ZP.mjs';
|
|
9
12
|
import '../chunk-MRXNTQOX.mjs';
|
|
10
13
|
//# sourceMappingURL=out.js.map
|
|
11
14
|
//# sourceMappingURL=use-copilot-chat.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { useMakeCopilotActionable } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { useMakeCopilotActionable } from '../chunk-FP4EXCGS.mjs';
|
|
2
|
+
import '../chunk-6A4PCNMZ.mjs';
|
|
3
3
|
import '../chunk-MRXNTQOX.mjs';
|
|
4
4
|
//# sourceMappingURL=out.js.map
|
|
5
5
|
//# sourceMappingURL=use-make-copilot-actionable.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { useMakeCopilotDocumentReadable } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { useMakeCopilotDocumentReadable } from '../chunk-7P4OYNP3.mjs';
|
|
2
|
+
import '../chunk-6A4PCNMZ.mjs';
|
|
3
3
|
import '../chunk-MRXNTQOX.mjs';
|
|
4
4
|
//# sourceMappingURL=out.js.map
|
|
5
5
|
//# sourceMappingURL=use-make-copilot-document-readable.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { useMakeCopilotReadable } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { useMakeCopilotReadable } from '../chunk-HW5IH6PV.mjs';
|
|
2
|
+
import '../chunk-6A4PCNMZ.mjs';
|
|
3
3
|
import '../chunk-MRXNTQOX.mjs';
|
|
4
4
|
//# sourceMappingURL=out.js.map
|
|
5
5
|
//# sourceMappingURL=use-make-copilot-readable.mjs.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
export { CopilotProvider, defaultCopilotContextCategories } from './components/copilot-provider/copilot-provider.js';
|
|
2
2
|
export { CopilotProviderApiConfigProps, CopilotProviderApiEndpointProps, CopilotProviderProps } from './components/copilot-provider/copilot-provider-props.js';
|
|
3
|
-
export { CopilotApiConfig, CopilotContext, CopilotContextParams
|
|
3
|
+
export { CopilotApiConfig, CopilotContext, CopilotContextParams } from './context/copilot-context.js';
|
|
4
4
|
export { UseCopilotChatOptions, UseCopilotChatReturn, useCopilotChat } from './hooks/use-copilot-chat.js';
|
|
5
5
|
export { useMakeCopilotActionable } from './hooks/use-make-copilot-actionable.js';
|
|
6
6
|
export { useMakeCopilotReadable } from './hooks/use-make-copilot-readable.js';
|
|
7
7
|
export { useMakeCopilotDocumentReadable } from './hooks/use-make-copilot-document-readable.js';
|
|
8
|
+
export { UseChatHelpers } from './hooks/use-chat.js';
|
|
8
9
|
export { AnnotatedFunction, AnnotatedFunctionArgument } from './types/annotated-function.js';
|
|
9
10
|
export { DocumentPointer } from './types/document-pointer.js';
|
|
11
|
+
export { Function, FunctionCall, FunctionCallHandler, Message, Role } from './types/base.js';
|
|
10
12
|
export { AssistantStatus, RequestForwardingOptions, UseCopilotChatOptionsV2, UseCopilotChatV2Result, useCopilotChatV2 } from './openai-assistants/hooks/use-copilot-chat-v2.js';
|
|
11
13
|
export { processMessageStream } from './openai-assistants/utils/process-message-stream.js';
|
|
14
|
+
export { ChatCompletionStream, ChatCompletionStreamConfiguration } from './openai/chat-completion-stream.js';
|
|
15
|
+
export { ChatCompletionTransportFetchParams } from './openai/chat-completion-transport.js';
|
|
12
16
|
import 'react';
|
|
13
|
-
import 'ai';
|
|
14
17
|
import './hooks/use-tree.js';
|
|
15
18
|
import 'openai/resources/chat';
|
|
16
19
|
import '@copilotkit/shared';
|
|
20
|
+
import 'eventemitter3';
|
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
|
+
import './chunk-PUFR5OAI.mjs';
|
|
2
|
+
import './chunk-EFZPSZWO.mjs';
|
|
1
3
|
import './chunk-7GFKOIO7.mjs';
|
|
2
4
|
import './chunk-BABVSMJR.mjs';
|
|
3
|
-
export { useCopilotChatV2 } from './chunk-
|
|
5
|
+
export { useCopilotChatV2 } from './chunk-TU4DNDO7.mjs';
|
|
4
6
|
import './chunk-FRAKUJWH.mjs';
|
|
5
7
|
export { processMessageStream } from './chunk-MZ5UN3BY.mjs';
|
|
6
|
-
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
9
|
-
export {
|
|
8
|
+
export { ChatCompletionStream } from './chunk-6SOQYBNX.mjs';
|
|
9
|
+
import './chunk-VNRDQJXW.mjs';
|
|
10
|
+
import './chunk-5UGLWBZJ.mjs';
|
|
11
|
+
export { useMakeCopilotActionable } from './chunk-FP4EXCGS.mjs';
|
|
12
|
+
export { useMakeCopilotDocumentReadable } from './chunk-7P4OYNP3.mjs';
|
|
13
|
+
export { useMakeCopilotReadable } from './chunk-HW5IH6PV.mjs';
|
|
14
|
+
export { useCopilotChat } from './chunk-SM3XH2NJ.mjs';
|
|
10
15
|
import './chunk-JD7BAH7U.mjs';
|
|
11
16
|
import './chunk-SPCZTZCY.mjs';
|
|
12
|
-
export { CopilotProvider, defaultCopilotContextCategories } from './chunk-
|
|
17
|
+
export { CopilotProvider, defaultCopilotContextCategories } from './chunk-QTET3FBV.mjs';
|
|
13
18
|
import './chunk-F2JIAPZQ.mjs';
|
|
14
19
|
import './chunk-VUY2K2DI.mjs';
|
|
20
|
+
export { CopilotContext } from './chunk-6A4PCNMZ.mjs';
|
|
21
|
+
import './chunk-TDH7XE4X.mjs';
|
|
22
|
+
import './chunk-TKXPMMND.mjs';
|
|
23
|
+
import './chunk-VK25FIML.mjs';
|
|
15
24
|
import './chunk-YULKJPY3.mjs';
|
|
16
|
-
export { useMakeCopilotActionable } from './chunk-WL2MC3E2.mjs';
|
|
17
|
-
export { useMakeCopilotDocumentReadable } from './chunk-RFZQHCNS.mjs';
|
|
18
|
-
export { useMakeCopilotReadable } from './chunk-PF7LXYPO.mjs';
|
|
19
|
-
export { CopilotContext, copilotApiConfigExtrapolator } from './chunk-YGJFU4ZP.mjs';
|
|
20
25
|
import './chunk-MRXNTQOX.mjs';
|
|
21
26
|
//# sourceMappingURL=out.js.map
|
|
22
27
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
import { Role, Message } from '../types/base.js';
|
|
3
|
+
import { ChatCompletionTransportFetchParams } from './chat-completion-transport.js';
|
|
4
|
+
import '../context/copilot-context.js';
|
|
5
|
+
import '../types/annotated-function.js';
|
|
6
|
+
import '../types/document-pointer.js';
|
|
7
|
+
import 'react';
|
|
8
|
+
import '../hooks/use-tree.js';
|
|
9
|
+
import 'openai/resources/chat';
|
|
10
|
+
|
|
11
|
+
interface ChatCompletionClientConfiguration {
|
|
12
|
+
}
|
|
13
|
+
interface ChatCompletionClientEvents {
|
|
14
|
+
content: string;
|
|
15
|
+
partial: [string, string];
|
|
16
|
+
error: any;
|
|
17
|
+
function: {
|
|
18
|
+
name: string;
|
|
19
|
+
arguments: any;
|
|
20
|
+
};
|
|
21
|
+
end: void;
|
|
22
|
+
}
|
|
23
|
+
interface ChatCompletionChunk {
|
|
24
|
+
choices: {
|
|
25
|
+
delta: {
|
|
26
|
+
role: Role;
|
|
27
|
+
content?: string | null;
|
|
28
|
+
function_call?: {
|
|
29
|
+
name?: string;
|
|
30
|
+
arguments?: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
}[];
|
|
34
|
+
}
|
|
35
|
+
declare class ChatCompletionClient extends EventEmitter<ChatCompletionClientEvents> {
|
|
36
|
+
private chatCompletionTransport;
|
|
37
|
+
private mode;
|
|
38
|
+
private functionCallName;
|
|
39
|
+
private functionCallArguments;
|
|
40
|
+
constructor(params: ChatCompletionClientConfiguration);
|
|
41
|
+
fetch(params: ChatCompletionTransportFetchParams): Promise<void>;
|
|
42
|
+
private buildPrompt;
|
|
43
|
+
private runPrompt;
|
|
44
|
+
private onData;
|
|
45
|
+
private onError;
|
|
46
|
+
private onEnd;
|
|
47
|
+
private tryFlushFunctionCall;
|
|
48
|
+
private cleanup;
|
|
49
|
+
countTokens(message: Message): number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { ChatCompletionChunk, ChatCompletionClient };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ChatCompletionTransportFetchParams } from './chat-completion-transport.js';
|
|
2
|
+
import 'eventemitter3';
|
|
3
|
+
import '../types/base.js';
|
|
4
|
+
import '../context/copilot-context.js';
|
|
5
|
+
import '../types/annotated-function.js';
|
|
6
|
+
import '../types/document-pointer.js';
|
|
7
|
+
import 'react';
|
|
8
|
+
import '../hooks/use-tree.js';
|
|
9
|
+
import 'openai/resources/chat';
|
|
10
|
+
|
|
11
|
+
interface ChatCompletionStreamConfiguration {
|
|
12
|
+
url: string;
|
|
13
|
+
model?: string;
|
|
14
|
+
}
|
|
15
|
+
declare class ChatCompletionStream {
|
|
16
|
+
private url;
|
|
17
|
+
constructor(params: ChatCompletionStreamConfiguration);
|
|
18
|
+
fetch(params: ChatCompletionTransportFetchParams): Promise<ReadableStream<string>>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { ChatCompletionStream, ChatCompletionStreamConfiguration };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
import { Message, Function } from '../types/base.js';
|
|
3
|
+
import { CopilotApiConfig } from '../context/copilot-context.js';
|
|
4
|
+
import '../types/annotated-function.js';
|
|
5
|
+
import '../types/document-pointer.js';
|
|
6
|
+
import 'react';
|
|
7
|
+
import '../hooks/use-tree.js';
|
|
8
|
+
import 'openai/resources/chat';
|
|
9
|
+
|
|
10
|
+
interface ChatCompletionTransportConfiguration {
|
|
11
|
+
}
|
|
12
|
+
interface ChatCompletionTransportEvents {
|
|
13
|
+
end: void;
|
|
14
|
+
data: any;
|
|
15
|
+
error: any;
|
|
16
|
+
}
|
|
17
|
+
interface ChatCompletionTransportFetchParams {
|
|
18
|
+
copilotConfig: CopilotApiConfig;
|
|
19
|
+
model?: string;
|
|
20
|
+
messages: Message[];
|
|
21
|
+
functions?: Function[];
|
|
22
|
+
temperature?: number;
|
|
23
|
+
maxTokens?: number;
|
|
24
|
+
headers?: Record<string, string> | Headers;
|
|
25
|
+
body?: object;
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
}
|
|
28
|
+
declare class ChatCompletionTransport extends EventEmitter<ChatCompletionTransportEvents> {
|
|
29
|
+
private buffer;
|
|
30
|
+
private bodyReader;
|
|
31
|
+
constructor(params: ChatCompletionTransportConfiguration);
|
|
32
|
+
private cleanup;
|
|
33
|
+
fetch({ copilotConfig, model, messages, functions, temperature, headers, body, signal, }: ChatCompletionTransportFetchParams): Promise<void>;
|
|
34
|
+
private streamBody;
|
|
35
|
+
private processData;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { ChatCompletionTransport, ChatCompletionTransportConfiguration, ChatCompletionTransportFetchParams };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { ChatCompletionStream, ChatCompletionStreamConfiguration } from './chat-completion-stream.js';
|
|
2
|
+
export { ChatCompletionTransportFetchParams } from './chat-completion-transport.js';
|
|
3
|
+
import 'eventemitter3';
|
|
4
|
+
import '../types/base.js';
|
|
5
|
+
import '../context/copilot-context.js';
|
|
6
|
+
import '../types/annotated-function.js';
|
|
7
|
+
import '../types/document-pointer.js';
|
|
8
|
+
import 'react';
|
|
9
|
+
import '../hooks/use-tree.js';
|
|
10
|
+
import 'openai/resources/chat';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import '../../chunk-BABVSMJR.mjs';
|
|
2
|
-
export { useCopilotChatV2 } from '../../chunk-
|
|
2
|
+
export { useCopilotChatV2 } from '../../chunk-TU4DNDO7.mjs';
|
|
3
3
|
import '../../chunk-FRAKUJWH.mjs';
|
|
4
4
|
import '../../chunk-MZ5UN3BY.mjs';
|
|
5
|
-
import '../../chunk-
|
|
5
|
+
import '../../chunk-VNRDQJXW.mjs';
|
|
6
6
|
import '../../chunk-JD7BAH7U.mjs';
|
|
7
7
|
import '../../chunk-SPCZTZCY.mjs';
|
|
8
|
-
import '../../chunk-
|
|
8
|
+
import '../../chunk-QTET3FBV.mjs';
|
|
9
9
|
import '../../chunk-F2JIAPZQ.mjs';
|
|
10
10
|
import '../../chunk-VUY2K2DI.mjs';
|
|
11
|
+
import '../../chunk-6A4PCNMZ.mjs';
|
|
11
12
|
import '../../chunk-YULKJPY3.mjs';
|
|
12
|
-
import '../../chunk-YGJFU4ZP.mjs';
|
|
13
13
|
import '../../chunk-MRXNTQOX.mjs';
|
|
14
14
|
//# sourceMappingURL=out.js.map
|
|
15
15
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { defaultSystemMessage, useCopilotChatV2 } from '../../chunk-
|
|
1
|
+
export { defaultSystemMessage, useCopilotChatV2 } from '../../chunk-TU4DNDO7.mjs';
|
|
2
2
|
import '../../chunk-FRAKUJWH.mjs';
|
|
3
3
|
import '../../chunk-MZ5UN3BY.mjs';
|
|
4
|
-
import '../../chunk-
|
|
4
|
+
import '../../chunk-VNRDQJXW.mjs';
|
|
5
5
|
import '../../chunk-JD7BAH7U.mjs';
|
|
6
6
|
import '../../chunk-SPCZTZCY.mjs';
|
|
7
|
-
import '../../chunk-
|
|
7
|
+
import '../../chunk-QTET3FBV.mjs';
|
|
8
8
|
import '../../chunk-F2JIAPZQ.mjs';
|
|
9
9
|
import '../../chunk-VUY2K2DI.mjs';
|
|
10
|
+
import '../../chunk-6A4PCNMZ.mjs';
|
|
10
11
|
import '../../chunk-YULKJPY3.mjs';
|
|
11
|
-
import '../../chunk-YGJFU4ZP.mjs';
|
|
12
12
|
import '../../chunk-MRXNTQOX.mjs';
|
|
13
13
|
//# sourceMappingURL=out.js.map
|
|
14
14
|
//# sourceMappingURL=use-copilot-chat-v2.mjs.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import '../chunk-7GFKOIO7.mjs';
|
|
2
2
|
import '../chunk-BABVSMJR.mjs';
|
|
3
|
-
export { useCopilotChatV2 } from '../chunk-
|
|
3
|
+
export { useCopilotChatV2 } from '../chunk-TU4DNDO7.mjs';
|
|
4
4
|
import '../chunk-FRAKUJWH.mjs';
|
|
5
5
|
export { processMessageStream } from '../chunk-MZ5UN3BY.mjs';
|
|
6
|
-
import '../chunk-
|
|
6
|
+
import '../chunk-VNRDQJXW.mjs';
|
|
7
7
|
import '../chunk-JD7BAH7U.mjs';
|
|
8
8
|
import '../chunk-SPCZTZCY.mjs';
|
|
9
|
-
import '../chunk-
|
|
9
|
+
import '../chunk-QTET3FBV.mjs';
|
|
10
10
|
import '../chunk-F2JIAPZQ.mjs';
|
|
11
11
|
import '../chunk-VUY2K2DI.mjs';
|
|
12
|
+
import '../chunk-6A4PCNMZ.mjs';
|
|
12
13
|
import '../chunk-YULKJPY3.mjs';
|
|
13
|
-
import '../chunk-YGJFU4ZP.mjs';
|
|
14
14
|
import '../chunk-MRXNTQOX.mjs';
|
|
15
15
|
//# sourceMappingURL=out.js.map
|
|
16
16
|
//# sourceMappingURL=index.mjs.map
|