@bdocs/plugin-ask-ai 0.3.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/LICENSE +21 -0
- package/dist/client/index.d.mts +64 -0
- package/dist/client/index.mjs +776 -0
- package/dist/node/index.d.mts +143 -0
- package/dist/node/index.mjs +387 -0
- package/dist/server/index.d.mts +49 -0
- package/dist/server/index.mjs +103 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Boltdocs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as _$react from "react";
|
|
2
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/client/use-ask-ai.d.ts
|
|
5
|
+
type MessageStatus = 'reading' | 'streaming' | 'done' | 'error';
|
|
6
|
+
interface Message {
|
|
7
|
+
role: 'user' | 'assistant';
|
|
8
|
+
content: string;
|
|
9
|
+
status?: MessageStatus;
|
|
10
|
+
contextChip?: {
|
|
11
|
+
page: string;
|
|
12
|
+
chars: number;
|
|
13
|
+
elapsedMs?: number;
|
|
14
|
+
missing?: boolean;
|
|
15
|
+
};
|
|
16
|
+
usage?: {
|
|
17
|
+
promptTokens: number;
|
|
18
|
+
completionTokens: number;
|
|
19
|
+
totalTokens: number;
|
|
20
|
+
model: string;
|
|
21
|
+
provider: string;
|
|
22
|
+
elapsedMs: number;
|
|
23
|
+
};
|
|
24
|
+
errorMessage?: string;
|
|
25
|
+
}
|
|
26
|
+
interface UseAskAiOptions {
|
|
27
|
+
endpoint?: string;
|
|
28
|
+
currentPage?: string;
|
|
29
|
+
}
|
|
30
|
+
declare function useAskAi(options?: UseAskAiOptions): {
|
|
31
|
+
messages: Message[];
|
|
32
|
+
input: string;
|
|
33
|
+
setInput: _$react.Dispatch<_$react.SetStateAction<string>>;
|
|
34
|
+
isLoading: boolean;
|
|
35
|
+
submitQuestion: (text: string) => Promise<void>;
|
|
36
|
+
stopStreaming: () => void;
|
|
37
|
+
clearChat: () => void;
|
|
38
|
+
isOpen: boolean;
|
|
39
|
+
setIsOpen: _$react.Dispatch<_$react.SetStateAction<boolean>>;
|
|
40
|
+
devMode: boolean;
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/client/components/ask-ai-bubble.d.ts
|
|
44
|
+
declare function AskAiBubble(): _$react_jsx_runtime0.JSX.Element;
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/client/components/ask-ai-dialog.d.ts
|
|
47
|
+
declare function AskAiDialog(): _$react_jsx_runtime0.JSX.Element | null;
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/client/render-markdown.d.ts
|
|
50
|
+
interface MarkdownRendererProps {
|
|
51
|
+
content: string;
|
|
52
|
+
className?: string;
|
|
53
|
+
parseIncompleteMarkdown?: boolean;
|
|
54
|
+
}
|
|
55
|
+
declare function MarkdownRenderer({
|
|
56
|
+
content,
|
|
57
|
+
className,
|
|
58
|
+
parseIncompleteMarkdown
|
|
59
|
+
}: MarkdownRendererProps): _$react_jsx_runtime0.JSX.Element | null;
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/client/index.d.ts
|
|
62
|
+
declare const _default: any;
|
|
63
|
+
//#endregion
|
|
64
|
+
export { AskAiBubble, AskAiDialog, MarkdownRenderer, type Message, type MessageStatus, type UseAskAiOptions, _default as default, useAskAi };
|