vpschatbotwidget 1.2.1 → 1.2.3
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/README.md +56 -16
- package/dist-lib/types/chatbot/api/chatbot-types.d.ts +8 -1
- package/dist-lib/types/chatbot/core/AgentReasoning.d.ts +4 -1
- package/dist-lib/types/chatbot/core/ChatContext.d.ts +5 -1
- package/dist-lib/types/chatbot/core/ChatHeader.d.ts +2 -0
- package/dist-lib/types/chatbot/core/ChatInlineCitation.d.ts +5 -0
- package/dist-lib/types/chatbot/core/ChatInput.d.ts +5 -0
- package/dist-lib/types/chatbot/core/ChatMarkdown.d.ts +4 -1
- package/dist-lib/types/chatbot/core/ChatMessage.d.ts +1 -0
- package/dist-lib/types/chatbot/core/ChatMessageActions.d.ts +7 -0
- package/dist-lib/types/chatbot/core/ChatMessageList.d.ts +3 -1
- package/dist-lib/types/chatbot/core/ChatProvider.d.ts +2 -2
- package/dist-lib/types/chatbot/core/GroundedSources.d.ts +5 -0
- package/dist-lib/types/chatbot/embedded/EmbeddedChatbot.d.ts +2 -2
- package/dist-lib/types/chatbot/hooks/useCopyText.d.ts +4 -0
- package/dist-lib/types/chatbot/hooks/useResponseSound.d.ts +6 -0
- package/dist-lib/types/chatbot/index.d.ts +1 -1
- package/dist-lib/types/chatbot/widget/ChatbotWidget.d.ts +2 -2
- package/dist-lib/types/components/ai-elements/inline-citation.d.ts +52 -0
- package/dist-lib/types/components/ai-elements/reasoning.d.ts +21 -0
- package/dist-lib/types/components/ai-elements/suggestion.d.ts +9 -0
- package/dist-lib/types/components/ui/bubble.d.ts +6 -0
- package/dist-lib/types/components/ui/button.d.ts +8 -0
- package/dist-lib/types/components/ui/hover-card.d.ts +5 -0
- package/dist-lib/types/components/ui/input-group.d.ts +5 -0
- package/dist-lib/types/components/ui/marker.d.ts +6 -0
- package/dist-lib/types/components/ui/message.d.ts +8 -0
- package/dist-lib/types/components/ui/trace.d.ts +19 -0
- package/dist-lib/types/lib/safeHref.d.ts +1 -0
- package/dist-lib/vps-chatbot.cjs +110 -29
- package/dist-lib/vps-chatbot.js +9540 -1654
- package/package.json +6 -2
- package/src/chatbot/api/chatbot-api.ts +1 -0
- package/src/chatbot/api/chatbot-types.ts +9 -1
- package/src/chatbot/chatbot.test.tsx +125 -7
- package/src/chatbot/core/AgentReasoning.tsx +68 -36
- package/src/chatbot/core/ChatContext.tsx +5 -0
- package/src/chatbot/core/ChatEmptyState.tsx +14 -13
- package/src/chatbot/core/ChatError.tsx +20 -12
- package/src/chatbot/core/ChatHeader.tsx +17 -1
- package/src/chatbot/core/ChatInlineCitation.tsx +63 -0
- package/src/chatbot/core/ChatInput.tsx +73 -51
- package/src/chatbot/core/ChatMarkdown.tsx +70 -24
- package/src/chatbot/core/ChatMessage.tsx +77 -88
- package/src/chatbot/core/ChatMessageActions.tsx +51 -0
- package/src/chatbot/core/ChatMessageList.tsx +15 -7
- package/src/chatbot/core/ChatPanel.tsx +19 -7
- package/src/chatbot/core/ChatProvider.tsx +58 -10
- package/src/chatbot/core/ChatSuggestions.tsx +14 -34
- package/src/chatbot/core/GroundedSources.tsx +113 -90
- package/src/chatbot/core/grounding.test.tsx +111 -4
- package/src/chatbot/embedded/EmbeddedChatbot.tsx +2 -2
- package/src/chatbot/hooks/useCopyText.ts +23 -0
- package/src/chatbot/hooks/useResponseSound.ts +74 -0
- package/src/chatbot/index.ts +1 -0
- package/src/chatbot/widget/ChatbotWidget.tsx +2 -2
- package/src/components/ai-elements/inline-citation.tsx +299 -0
- package/src/components/ai-elements/reasoning.tsx +126 -0
- package/src/components/ai-elements/suggestion.tsx +42 -0
- package/src/components/ui/bubble.tsx +18 -0
- package/src/components/ui/button.tsx +43 -0
- package/src/components/ui/hover-card.tsx +43 -0
- package/src/components/ui/input-group.tsx +18 -0
- package/src/components/ui/marker.tsx +18 -0
- package/src/components/ui/message.tsx +26 -0
- package/src/components/ui/trace.tsx +68 -0
- package/src/index.css +579 -272
- package/src/lib/safeHref.ts +6 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { cn } from "../../lib/cn";
|
|
3
|
+
|
|
4
|
+
export function InputGroup({ className, ...props }: ComponentProps<"div">) {
|
|
5
|
+
return <div {...props} data-slot="input-group" className={cn("chat-input-group", className)} />;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function InputGroupTextarea({ className, ...props }: ComponentProps<"textarea">) {
|
|
9
|
+
return <textarea {...props} data-slot="input-group-textarea" className={cn("chat-textarea", className)} />;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function InputGroupAddon({ className, ...props }: ComponentProps<"div">) {
|
|
13
|
+
return <div {...props} data-slot="input-group-addon" className={cn("chat-input-actions", className)} />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function InputGroupButton({ className, ...props }: ComponentProps<"button">) {
|
|
17
|
+
return <button type="button" {...props} data-slot="input-group-button" className={cn("chat-send-btn", className)} />;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { cn } from "../../lib/cn";
|
|
3
|
+
|
|
4
|
+
export function Marker({
|
|
5
|
+
className,
|
|
6
|
+
variant = "default",
|
|
7
|
+
...props
|
|
8
|
+
}: ComponentProps<"div"> & { variant?: "default" | "border" | "separator" }) {
|
|
9
|
+
return <div {...props} data-slot="marker" data-variant={variant} className={cn("chat-marker", className)} />;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function MarkerIcon({ className, ...props }: ComponentProps<"span">) {
|
|
13
|
+
return <span {...props} data-slot="marker-icon" className={cn("chat-marker-icon", className)} aria-hidden="true" />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function MarkerContent({ className, ...props }: ComponentProps<"span">) {
|
|
17
|
+
return <span {...props} data-slot="marker-content" className={cn("chat-marker-content", className)} />;
|
|
18
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { cn } from "../../lib/cn";
|
|
3
|
+
|
|
4
|
+
export function Message({
|
|
5
|
+
align = "start",
|
|
6
|
+
className,
|
|
7
|
+
...props
|
|
8
|
+
}: ComponentProps<"div"> & { align?: "start" | "end" }) {
|
|
9
|
+
return <div {...props} data-slot="message" data-align={align} className={cn("chat-message", className)} />;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function MessageAvatar({ className, ...props }: ComponentProps<"div">) {
|
|
13
|
+
return <div {...props} data-slot="message-avatar" className={cn("chat-message-avatar", className)} />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function MessageContent({ className, ...props }: ComponentProps<"div">) {
|
|
17
|
+
return <div {...props} data-slot="message-content" className={cn("chat-message-content", className)} />;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function MessageHeader({ className, ...props }: ComponentProps<"div">) {
|
|
21
|
+
return <div {...props} data-slot="message-header" className={cn("chat-message-header", className)} />;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function MessageFooter({ className, ...props }: ComponentProps<"div">) {
|
|
25
|
+
return <div {...props} data-slot="message-footer" className={cn("chat-message-footer", className)} />;
|
|
26
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { Collapsible } from "@base-ui/react/collapsible";
|
|
3
|
+
import { ChevronRight } from "lucide-react";
|
|
4
|
+
import { cn } from "../../lib/cn";
|
|
5
|
+
|
|
6
|
+
export function Trace({ className, ...props }: ComponentProps<"div">) {
|
|
7
|
+
return <div data-slot="trace" className={cn("trace", className)} {...props} />;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function TraceLine({
|
|
11
|
+
className,
|
|
12
|
+
status,
|
|
13
|
+
...props
|
|
14
|
+
}: ComponentProps<"span"> & { status?: "running" | "error" | "pending" }) {
|
|
15
|
+
return (
|
|
16
|
+
<span data-slot="trace-line" data-status={status} className={cn("trace-line", className)} {...props} />
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function TraceIcon({ className, ...props }: ComponentProps<"span">) {
|
|
21
|
+
return <span data-slot="trace-icon" className={cn("trace-icon", className)} {...props} aria-hidden="true" />;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function TraceTitle({ className, ...props }: ComponentProps<"span">) {
|
|
25
|
+
return <span data-slot="trace-title" className={cn("trace-title", className)} {...props} />;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function TraceDescription({ className, ...props }: ComponentProps<"span">) {
|
|
29
|
+
return <span data-slot="trace-description" className={cn("trace-description", className)} {...props} />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function TraceCollapsible(props: Omit<Collapsible.Root.Props, "className" | "onOpenChange"> & {
|
|
33
|
+
className?: string;
|
|
34
|
+
onOpenChange?: (open: boolean) => void;
|
|
35
|
+
}) {
|
|
36
|
+
return <Collapsible.Root data-slot="trace-collapsible" {...props} />;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function TraceCollapsibleTrigger({
|
|
40
|
+
children,
|
|
41
|
+
className,
|
|
42
|
+
...props
|
|
43
|
+
}: Omit<Collapsible.Trigger.Props, "className"> & { className?: string }) {
|
|
44
|
+
return (
|
|
45
|
+
<Collapsible.Trigger
|
|
46
|
+
type="button"
|
|
47
|
+
data-slot="trace-collapsible-trigger"
|
|
48
|
+
className={cn("trace-trigger", className)}
|
|
49
|
+
{...props}
|
|
50
|
+
>
|
|
51
|
+
{children}
|
|
52
|
+
<TraceIcon className="trace-chevron"><ChevronRight size={13} /></TraceIcon>
|
|
53
|
+
</Collapsible.Trigger>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function TraceCollapsibleContent({
|
|
58
|
+
className,
|
|
59
|
+
...props
|
|
60
|
+
}: Omit<Collapsible.Panel.Props, "className"> & { className?: string }) {
|
|
61
|
+
return (
|
|
62
|
+
<Collapsible.Panel
|
|
63
|
+
{...props}
|
|
64
|
+
data-slot="trace-collapsible-content"
|
|
65
|
+
className={cn("trace-content", className)}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
}
|