open-ask-ai 0.6.2 → 0.6.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/dist/cjs/index.js +9 -11
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/styles.css +8 -9
- package/dist/esm/ask-ai.js +9 -11
- package/dist/esm/ask-ai.js.map +1 -1
- package/dist/esm/styles.css +8 -9
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -530,7 +530,7 @@ function Widget(props) {
|
|
|
530
530
|
})) : (jsxRuntime.jsx(Trigger, { onClick: handleOpen, text: texts?.triggerButtonText, ariaLabel: texts?.triggerButtonAriaLabel })), jsxRuntime.jsx(Drawer, { isOpen: isOpen, onClose: handleClose, onNewSession: handleNewSession, hasMessages: messages.length > 0, position: drawerPosition, width: drawerWidth, expandedWidth: drawerExpandedWidth, title: texts?.drawerTitle, closeAriaLabel: texts?.drawerCloseAriaLabel, newSessionAriaLabel: texts?.drawerNewSessionAriaLabel, theme: theme, children: (isOpen || componentsLoaded) && (jsxRuntime.jsx(React__namespace.Suspense, { fallback: jsxRuntime.jsx(lucideReact.Loader2, { className: styles$1.spinning }), children: jsxRuntime.jsx(ChatContainer$2, { texts: texts, exampleQuestions: exampleQuestions, onMessage: onMessage, onError: onError, messages: messages, isStreaming: isStreaming, error: error, sendMessage: sendMessage, input: input, setInput: setInput }) })) })] }));
|
|
531
531
|
}
|
|
532
532
|
|
|
533
|
-
var styles = {"container":"container_FRFCj","messagesArea":"messagesArea_Hi-49","welcomeScreen":"welcomeScreen_fJ8-E","welcomeMessage":"welcomeMessage_unMIK","exampleQuestionsContainer":"exampleQuestionsContainer_RBWq6","exampleQuestionsTitle":"exampleQuestionsTitle_Vurj8","exampleButton":"exampleButton_6sOzR","messageWrapper":"messageWrapper_nsQr8","user":"user_s1Gzu","assistant":"assistant_xU0-H","message":"message_jxpo4","messageText":"messageText_neW3m","markdown":"markdown_mNC3q","textPart":"textPart_efb3b","reasoningPart":"reasoningPart_JD-Cg","reasoningLabel":"reasoningLabel_Qbv7v","reasoningContent":"reasoningContent_pBYq2","toolPart":"toolPart_jy7Rq","toolCallsContainer":"toolCallsContainer_1nUsV","toolCall":"toolCall_gEKn0","tool-completed":"tool-completed_5Utl8","tool-pending":"tool-pending_hifHC","tool-running":"tool-running_D0dCg","pulse":"pulse_STM-e","tool-error":"tool-error_eqjRM","codeBlockWrapper":"codeBlockWrapper_rOz7-","copyButton":"copyButton_Ry43q","cursor":"cursor_9Dhwg","blink":"blink_-4y-x","error":"error_uFX9a","inputForm":"inputForm_nC0l-","inputWrapper":"inputWrapper_zGeKy","input":"input_7lMOc","submitButton":"submitButton_2XrPY"};
|
|
533
|
+
var styles = {"container":"container_FRFCj","messagesArea":"messagesArea_Hi-49","welcomeScreen":"welcomeScreen_fJ8-E","welcomeMessage":"welcomeMessage_unMIK","exampleQuestionsContainer":"exampleQuestionsContainer_RBWq6","exampleQuestionsTitle":"exampleQuestionsTitle_Vurj8","exampleButton":"exampleButton_6sOzR","messageWrapper":"messageWrapper_nsQr8","user":"user_s1Gzu","assistant":"assistant_xU0-H","message":"message_jxpo4","messageText":"messageText_neW3m","markdown":"markdown_mNC3q","textPart":"textPart_efb3b","reasoningPart":"reasoningPart_JD-Cg","reasoningLabel":"reasoningLabel_Qbv7v","reasoningContent":"reasoningContent_pBYq2","toolPart":"toolPart_jy7Rq","toolCallsContainer":"toolCallsContainer_1nUsV","toolCall":"toolCall_gEKn0","tool-completed":"tool-completed_5Utl8","reasoning-streaming":"reasoning-streaming_gj-ZD","tool-pending":"tool-pending_hifHC","tool-running":"tool-running_D0dCg","pulse":"pulse_STM-e","tool-error":"tool-error_eqjRM","codeBlockWrapper":"codeBlockWrapper_rOz7-","copyButton":"copyButton_Ry43q","cursor":"cursor_9Dhwg","blink":"blink_-4y-x","error":"error_uFX9a","inputForm":"inputForm_nC0l-","inputWrapper":"inputWrapper_zGeKy","input":"input_7lMOc","submitButton":"submitButton_2XrPY"};
|
|
534
534
|
|
|
535
535
|
function ChatContainer({ texts, exampleQuestions, onMessage, onError, messages, isStreaming, error, sendMessage, input, setInput, }) {
|
|
536
536
|
const textareaRef = React__namespace.useRef(null);
|
|
@@ -669,15 +669,15 @@ function ChatContainer({ texts, exampleQuestions, onMessage, onError, messages,
|
|
|
669
669
|
// Render a single message part
|
|
670
670
|
const renderMessagePart = (part, index) => {
|
|
671
671
|
if (part.type === 'text') {
|
|
672
|
-
return (jsxRuntime.
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
672
|
+
return (jsxRuntime.jsx("div", { className: styles.textPart, children: jsxRuntime.jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [[rehypeHighlight, {
|
|
673
|
+
languages: lowlight.common,
|
|
674
|
+
prefix: 'hljs-'
|
|
675
|
+
}]], components: {
|
|
676
|
+
code: CodeBlock
|
|
677
|
+
}, children: part.text }) }, index));
|
|
678
678
|
}
|
|
679
679
|
if (part.type === 'reasoning') {
|
|
680
|
-
return (jsxRuntime.jsxs("div", { className: styles.reasoningPart
|
|
680
|
+
return (jsxRuntime.jsxs("div", { className: `${styles.reasoningPart} ${styles[`reasoning-${part.state}`]}`, children: [jsxRuntime.jsx("div", { className: styles.reasoningLabel, children: "Thinking..." }), jsxRuntime.jsx("div", { className: styles.reasoningContent, children: part.text })] }, index));
|
|
681
681
|
}
|
|
682
682
|
if (isToolUIPart(part)) {
|
|
683
683
|
const status = part.state === 'output-available' ? 'completed' :
|
|
@@ -692,9 +692,7 @@ function ChatContainer({ texts, exampleQuestions, onMessage, onError, messages,
|
|
|
692
692
|
// Welcome Screen
|
|
693
693
|
jsxRuntime.jsxs("div", { className: styles.welcomeScreen, children: [jsxRuntime.jsx("p", { className: styles.welcomeMessage, children: welcomeMessage }), exampleQuestions && exampleQuestions.length > 0 && (jsxRuntime.jsxs("div", { className: styles.exampleQuestionsContainer, children: [jsxRuntime.jsx("p", { className: styles.exampleQuestionsTitle, children: exampleQuestionsTitle }), exampleQuestions.map((question, index) => (jsxRuntime.jsx("button", { onClick: () => handleExampleClick(question), className: styles.exampleButton, children: question }, index)))] }))] })) : (
|
|
694
694
|
// Messages
|
|
695
|
-
jsxRuntime.jsx(jsxRuntime.Fragment, { children: messages.map((message) => (jsxRuntime.jsx("div", { className: `${styles.messageWrapper} ${styles[message.role]}`, children: jsxRuntime.jsx("div", { className: `${styles.message} ${styles[message.role]}`, children: message.role === 'assistant' ? (jsxRuntime.
|
|
696
|
-
? message.parts.map((part, index) => renderMessagePart(part, index))
|
|
697
|
-
: renderMessagePart({ type: 'text', text: '', state: 'streaming' }, 0) /* Empty message fallback */ })) : (jsxRuntime.jsx("div", { className: styles.messageText, children: message.parts
|
|
695
|
+
jsxRuntime.jsx(jsxRuntime.Fragment, { children: messages.map((message, index) => (jsxRuntime.jsx("div", { className: `${styles.messageWrapper} ${styles[message.role]}`, children: jsxRuntime.jsx("div", { className: `${styles.message} ${styles[message.role]}`, children: message.role === 'assistant' ? (jsxRuntime.jsxs("div", { className: styles.markdown, children: [message.parts.map((part, index) => renderMessagePart(part, index)), isStreaming && index === messages.length - 1 && jsxRuntime.jsx("span", { className: styles.cursor })] })) : (jsxRuntime.jsx("div", { className: styles.messageText, children: message.parts
|
|
698
696
|
.filter(part => part.type === 'text')
|
|
699
697
|
.map(part => part.type === 'text' ? part.text : '')
|
|
700
698
|
.join('') })) }) }, message.id))) })), error && (jsxRuntime.jsx("div", { className: styles.error, children: error.message }))] }), jsxRuntime.jsx("form", { onSubmit: handleSubmit, className: styles.inputForm, children: jsxRuntime.jsxs("div", { className: styles.inputWrapper, children: [jsxRuntime.jsx("textarea", { ref: textareaRef, value: input, onChange: handleInputChange, onKeyDown: handleKeyDown, placeholder: inputPlaceholder, className: styles.input, rows: 1 }), jsxRuntime.jsx("button", { type: "submit", disabled: !input.trim() || isStreaming, className: styles.submitButton, children: jsxRuntime.jsx(lucideReact.ArrowUp, {}) })] }) })] }));
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/core/api/client.ts","../../src/core/hooks/useSSE.ts","../../src/core/hooks/useChat.ts","../../src/components/ui/Button.tsx","../../src/components/widget/Trigger.tsx","../../src/components/widget/Drawer.tsx","../../src/components/widget/Widget.tsx","../../src/components/chat/ChatContainer.tsx"],"sourcesContent":["import type { UIMessage } from '../types/index.js';\n\n/**\n * API client for Ask AI widget\n * Supports AI SDK v6 UIMessage format with streaming responses\n */\nexport class APIClient {\n private apiUrl: string;\n private project?: string;\n\n constructor(apiUrl: string, project?: string) {\n this.apiUrl = apiUrl;\n this.project = project;\n }\n\n /**\n * Send messages and get UIMessageStream response\n */\n async sendMessages(\n messages: UIMessage[],\n signal?: AbortSignal\n ): Promise<Response> {\n const body: { messages: UIMessage[]; project?: string } = {\n messages,\n };\n\n if (this.project) {\n body.project = this.project;\n }\n\n const response = await fetch(this.apiUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(body),\n signal,\n });\n\n if (!response.ok) {\n throw new Error(`Failed to send messages: ${response.statusText}`);\n }\n\n return response;\n }\n}\n","import { useCallback } from 'react';\nimport type { UIMessage, UIMessageChunk } from '../types/index.js';\n\ninterface UseSSEOptions {\n onChunk?: (chunk: UIMessageChunk) => void;\n onError?: (error: Error) => void;\n}\n\ninterface UseSSEReturn {\n handleUIMessageStream: (response: Response, currentMessage: UIMessage) => Promise<void>;\n}\n\n/**\n * Parse SSE chunk format for UIMessageChunk stream\n * Supports both standard SSE format \"data: {...}\" and AI SDK v6 format \"0:{...}\"\n */\nfunction parseUIMessageChunk(line: string): UIMessageChunk | null {\n // Handle standard SSE format: \"data: {json}\"\n if (line.startsWith('data: ')) {\n const jsonStr = line.slice(6); // Remove \"data: \" prefix\n\n // Skip [DONE] marker\n if (jsonStr === '[DONE]') {\n return null;\n }\n\n try {\n return JSON.parse(jsonStr) as UIMessageChunk;\n } catch (err) {\n console.error('Failed to parse UIMessageChunk:', line, err);\n return null;\n }\n }\n\n return null;\n}\n\nexport function useSSE(options: UseSSEOptions = {}): UseSSEReturn {\n const { onChunk, onError } = options;\n\n const handleUIMessageStream = useCallback(\n async (response: Response, _currentMessage: UIMessage) => {\n const reader = response.body?.getReader();\n const decoder = new TextDecoder();\n\n if (!reader) {\n onError?.(new Error('No response body'));\n return;\n }\n\n let buffer = '';\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) {\n break;\n }\n\n buffer += decoder.decode(value, { stream: true });\n\n // Process complete lines\n const lines = buffer.split('\\n');\n\n // Keep the last incomplete line in the buffer\n buffer = lines.pop() || '';\n\n for (const line of lines) {\n if (!line.trim()) {\n continue;\n }\n\n const chunk = parseUIMessageChunk(line);\n if (chunk) {\n onChunk?.(chunk);\n }\n }\n }\n } catch (err) {\n // Don't report AbortError as it's an intentional cancellation\n if (err instanceof Error && err.name === 'AbortError') {\n return;\n }\n const error = err instanceof Error ? err : new Error('SSE stream error');\n onError?.(error);\n } finally {\n reader.releaseLock();\n }\n },\n [onChunk, onError]\n );\n\n return {\n handleUIMessageStream,\n };\n}\n","import { useState, useCallback, useRef } from 'react';\nimport { useSSE } from './useSSE.js';\nimport type { UIMessage, UIMessageChunk, WidgetTexts } from '../types/index.js';\nimport type { APIClient } from '../api/client.js';\n\ninterface UseChatOptions {\n apiClient: APIClient;\n texts?: WidgetTexts;\n}\n\ninterface UseChatReturn {\n messages: UIMessage[];\n isStreaming: boolean;\n error: Error | null;\n sendMessage: (text: string) => Promise<void>;\n resetChat: () => void;\n}\n\nlet idCounter = 0;\n\nfunction getMessageId() {\n idCounter += 1;\n return `msg-${idCounter}`;\n}\n\n/**\n * Apply a UIMessageChunk to update the current assistant message\n */\nfunction applyChunkToMessage(message: UIMessage, chunk: UIMessageChunk): UIMessage {\n const parts = [...message.parts];\n\n switch (chunk.type) {\n case 'text-start': {\n // Start a new text part\n parts.push({\n type: 'text',\n text: '',\n state: 'streaming',\n });\n break;\n }\n\n case 'text-delta': {\n // Find the last text part and append delta\n const lastTextIndex = parts.findLastIndex((p: any) => p.type === 'text');\n if (lastTextIndex >= 0) {\n const textPart = parts[lastTextIndex];\n if (textPart.type === 'text') {\n parts[lastTextIndex] = {\n ...textPart,\n text: textPart.text + chunk.delta,\n };\n }\n }\n break;\n }\n\n case 'text-end': {\n // Mark the last text part as done\n const lastTextIndex = parts.findLastIndex((p: any) => p.type === 'text');\n if (lastTextIndex >= 0) {\n const textPart = parts[lastTextIndex];\n if (textPart.type === 'text') {\n parts[lastTextIndex] = {\n ...textPart,\n state: 'done',\n };\n }\n }\n break;\n }\n\n case 'reasoning-start': {\n // Start a new reasoning part\n parts.push({\n type: 'reasoning',\n text: '',\n state: 'streaming',\n });\n break;\n }\n\n case 'reasoning-delta': {\n // Find the last reasoning part and append delta\n const lastReasoningIndex = parts.findLastIndex((p: any) => p.type === 'reasoning');\n if (lastReasoningIndex >= 0) {\n const reasoningPart = parts[lastReasoningIndex];\n if (reasoningPart.type === 'reasoning') {\n parts[lastReasoningIndex] = {\n ...reasoningPart,\n text: reasoningPart.text + chunk.delta,\n };\n }\n }\n break;\n }\n\n case 'reasoning-end': {\n // Mark the last reasoning part as done\n const lastReasoningIndex = parts.findLastIndex((p: any) => p.type === 'reasoning');\n if (lastReasoningIndex >= 0) {\n const reasoningPart = parts[lastReasoningIndex];\n if (reasoningPart.type === 'reasoning') {\n parts[lastReasoningIndex] = {\n ...reasoningPart,\n state: 'done',\n };\n }\n }\n break;\n }\n\n case 'tool-input-start': {\n // Start a new dynamic tool call\n parts.push({\n type: 'dynamic-tool',\n toolCallId: chunk.toolCallId,\n toolName: chunk.toolName,\n input: undefined,\n state: 'input-streaming',\n } as any);\n break;\n }\n\n case 'tool-input-available': {\n // Update tool call with input\n const toolIndex = parts.findIndex(\n (p: any) => p.type === 'dynamic-tool' && p.toolCallId === chunk.toolCallId\n );\n if (toolIndex >= 0) {\n const toolPart = parts[toolIndex] as any;\n parts[toolIndex] = {\n ...toolPart,\n input: chunk.input,\n state: 'input-available',\n };\n }\n break;\n }\n\n case 'tool-output-available': {\n // Update tool call with output\n const toolIndex = parts.findIndex(\n (p: any) => p.type === 'dynamic-tool' && p.toolCallId === chunk.toolCallId\n );\n if (toolIndex >= 0) {\n const toolPart = parts[toolIndex] as any;\n parts[toolIndex] = {\n ...toolPart,\n output: chunk.output,\n state: 'output-available',\n };\n }\n break;\n }\n\n case 'tool-output-error': {\n // Update tool call with error\n const toolIndex = parts.findIndex(\n (p: any) => p.type === 'dynamic-tool' && p.toolCallId === chunk.toolCallId\n );\n if (toolIndex >= 0) {\n const toolPart = parts[toolIndex] as any;\n parts[toolIndex] = {\n ...toolPart,\n errorText: chunk.errorText,\n state: 'error',\n };\n }\n break;\n }\n\n case 'error': {\n // Handle error chunk - could add error state to message\n console.error('Stream error:', chunk.errorText);\n break;\n }\n\n // Add other chunk types as needed\n default:\n // Ignore unknown chunk types\n break;\n }\n\n return {\n ...message,\n parts,\n };\n}\n\nexport function useChat({ apiClient }: UseChatOptions): UseChatReturn {\n const [messages, setMessages] = useState<UIMessage[]>([]);\n const [isStreaming, setIsStreaming] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const abortControllerRef = useRef<AbortController | null>(null);\n\n const { handleUIMessageStream } = useSSE({\n onChunk: (chunk) => {\n if (chunk.type === 'error') {\n setError(new Error(chunk.errorText));\n setIsStreaming(false);\n return;\n }\n\n // Update the last assistant message with the chunk\n setMessages((prev) => {\n const lastMessage = prev[prev.length - 1];\n if (lastMessage && lastMessage.role === 'assistant') {\n const updatedMessage = applyChunkToMessage(lastMessage, chunk);\n return [...prev.slice(0, -1), updatedMessage];\n }\n return prev;\n });\n },\n onError: (err) => {\n setError(err);\n setIsStreaming(false);\n // Remove the failed assistant message\n setMessages((prev) => {\n const lastMessage = prev[prev.length - 1];\n if (lastMessage && lastMessage.role === 'assistant' && lastMessage.parts.length === 0) {\n return prev.slice(0, -1);\n }\n return prev;\n });\n },\n });\n\n const sendMessage = useCallback(\n async (text: string) => {\n if (!text.trim()) {\n return;\n }\n\n // Abort any ongoing request\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n }\n\n // Create new AbortController for this request\n const abortController = new AbortController();\n abortControllerRef.current = abortController;\n\n setError(null);\n setIsStreaming(true);\n\n // Add user message immediately (optimistic UI)\n const userMessage: UIMessage = {\n id: getMessageId(),\n role: 'user',\n parts: [\n {\n type: 'text',\n text,\n },\n ],\n };\n\n // Add placeholder for assistant response\n const assistantMessage: UIMessage = {\n id: getMessageId(),\n role: 'assistant',\n parts: [],\n };\n\n const newMessages = [...messages, userMessage];\n setMessages([...newMessages, assistantMessage]);\n\n try {\n const response = await apiClient.sendMessages(\n newMessages,\n abortController.signal\n );\n await handleUIMessageStream(response, assistantMessage);\n setIsStreaming(false);\n } catch (err) {\n // Don't treat aborted requests as errors\n if (err instanceof Error && err.name === 'AbortError') {\n return;\n }\n\n const error = err instanceof Error ? err : new Error('Failed to send message');\n setError(error);\n setIsStreaming(false);\n\n // Remove the failed messages\n setMessages((prev) => prev.slice(0, -2));\n } finally {\n // Clear the abort controller reference if this was the current one\n if (abortControllerRef.current === abortController) {\n abortControllerRef.current = null;\n }\n }\n },\n [messages, apiClient, handleUIMessageStream]\n );\n\n const resetChat = useCallback(() => {\n // Abort any ongoing request\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n abortControllerRef.current = null;\n }\n\n setMessages([]);\n setError(null);\n setIsStreaming(false);\n }, []);\n\n return {\n messages,\n isStreaming,\n error,\n sendMessage,\n resetChat,\n };\n}\n","import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport styles from './Button.module.css';\n\ntype ButtonVariant = 'default' | 'outline' | 'ghost' | 'icon';\ntype ButtonSize = 'default' | 'sm' | 'lg' | 'icon';\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n variant?: ButtonVariant;\n size?: ButtonSize;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant = 'default', size = 'default', asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button';\n\n const classNames = [\n styles.button,\n styles[`variant-${variant}`],\n styles[`size-${size}`],\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <Comp\n className={classNames}\n ref={ref}\n {...props}\n />\n );\n }\n);\n\nButton.displayName = 'Button';\n\nexport { Button };\n","import { Sparkles, Loader2 } from 'lucide-react';\nimport { Button } from '../ui/Button.js';\nimport styles from './Trigger.module.css';\n\ninterface TriggerProps {\n onClick: () => void;\n text?: string;\n ariaLabel?: string;\n className?: string;\n isLoading?: boolean;\n}\n\nexport function Trigger({\n onClick,\n text = 'Ask AI',\n ariaLabel = 'Open AI assistant',\n className,\n isLoading = false,\n}: TriggerProps) {\n const classNames = [styles.trigger, className].filter(Boolean).join(' ');\n\n return (\n <Button\n onClick={onClick}\n variant=\"outline\"\n aria-label={ariaLabel}\n className={classNames}\n disabled={isLoading}\n >\n {isLoading ? (\n <Loader2 className={`${styles.icon} ${styles.spinning}`} />\n ) : (\n <Sparkles className={styles.icon} />\n )}\n {text && <span>{text}</span>}\n </Button>\n );\n}\n","import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Sparkles, X, EraserIcon, Maximize2, Minimize2 } from 'lucide-react';\nimport { Button } from '../ui/Button.js';\nimport styles from './Drawer.module.css';\n\ninterface DrawerProps {\n isOpen: boolean;\n onClose: () => void;\n onNewSession?: () => void;\n hasMessages?: boolean;\n position?: 'right' | 'left';\n width?: number | string;\n expandedWidth?: number | string;\n title?: string;\n closeAriaLabel?: string;\n newSessionAriaLabel?: string;\n children?: React.ReactNode;\n theme?: 'light' | 'dark';\n}\n\nexport function Drawer({\n isOpen,\n onClose,\n onNewSession,\n hasMessages,\n position = 'right',\n width = 600,\n expandedWidth = 920,\n title = 'Ask AI',\n closeAriaLabel = 'Close',\n newSessionAriaLabel = 'New session',\n children,\n theme = 'light',\n}: DrawerProps) {\n const [isExpanded, setIsExpanded] = React.useState(false);\n\n const maxWidth = isExpanded ? expandedWidth : width;\n\n const contentClasses = [\n styles.content,\n styles[`position-${position}`],\n ].join(' ');\n\n // Create a portal container that inherits theme from the nearest .ask-ai ancestor\n const [portalContainer, setPortalContainer] = React.useState<HTMLElement | null>(null);\n\n React.useEffect(() => {\n if (typeof document === 'undefined') return;\n\n // Create a portal container with ask-ai class\n const container = document.createElement('div');\n container.className = `ask-ai${theme === 'dark' ? ' dark' : ''}`;\n document.body.appendChild(container);\n setPortalContainer(container);\n\n return () => {\n document.body.removeChild(container);\n };\n }, [theme]);\n\n return (\n <DialogPrimitive.Root open={isOpen} onOpenChange={(open) => !open && onClose()}>\n <DialogPrimitive.Portal container={portalContainer}>\n {/* Overlay */}\n <DialogPrimitive.Overlay className={styles.overlay} />\n\n {/* Drawer Content */}\n <DialogPrimitive.Content\n className={contentClasses}\n style={{ maxWidth }}\n >\n {/* Header */}\n <div className={styles.header}>\n <DialogPrimitive.Title className={styles.title}>\n <Sparkles className={styles.icon} />\n {title}\n </DialogPrimitive.Title>\n <div className={styles.headerActions}>\n {onNewSession && hasMessages && (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={newSessionAriaLabel}\n className={styles.newSessionButton}\n onClick={onNewSession}\n >\n <EraserIcon className={styles.newSessionIcon} />\n </Button>\n )}\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={isExpanded ? 'Shrink' : 'Expand'}\n className={styles.expandButton}\n onClick={() => setIsExpanded(!isExpanded)}\n >\n {isExpanded ? (\n <Minimize2 className={styles.expandIcon} />\n ) : (\n <Maximize2 className={styles.expandIcon} />\n )}\n </Button>\n <DialogPrimitive.Close asChild>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={closeAriaLabel}\n className={styles.closeButton}\n >\n <X className={styles.closeIcon} />\n </Button>\n </DialogPrimitive.Close>\n </div>\n </div>\n\n {/* Content */}\n <div className={styles.body}>\n {children}\n </div>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n}\n","import * as React from 'react';\nimport { Loader2 } from 'lucide-react';\nimport { APIClient } from '../../core/api/client.js';\nimport { useChat } from '../../core/hooks/useChat.js';\nimport type { WidgetProps } from '../../core/types/index.js';\nimport { Trigger } from './Trigger.js';\nimport { Drawer } from './Drawer.js';\nimport styles from './Widget.module.css';\n\n// Lazy load heavy components\nconst ChatContainer = React.lazy(() => import('../chat/ChatContainer.js').then(m => ({ default: m.ChatContainer })));\n\nexport function Widget(props: WidgetProps) {\n const {\n apiUrl,\n project,\n drawerPosition = 'right',\n drawerWidth = 600,\n drawerExpandedWidth = 920,\n theme = 'light',\n texts,\n exampleQuestions,\n hotkey,\n enableHotkey = true,\n onOpen,\n onClose,\n onMessage,\n onError,\n className,\n style,\n children,\n } = props;\n\n const [isOpen, setIsOpen] = React.useState(false);\n const [componentsLoaded, setComponentsLoaded] = React.useState(false);\n const [apiClient] = React.useState(() => new APIClient(apiUrl, project));\n\n // Lift chat state to Widget level to persist across drawer open/close\n const { messages, isStreaming, error, sendMessage, resetChat } = useChat({ apiClient, texts });\n\n // Input state also needs to persist\n const [input, setInput] = React.useState('');\n\n // Preload components\n const preloadComponents = React.useCallback(async () => {\n if (componentsLoaded) return;\n\n try {\n // Trigger lazy loading by importing the modules\n await import('../chat/ChatContainer.js');\n setComponentsLoaded(true);\n } catch (error) {\n console.error('Failed to preload components:', error);\n }\n }, [componentsLoaded]);\n\n // Handle drawer open\n const handleOpen = React.useCallback(async () => {\n preloadComponents();\n setIsOpen(true);\n onOpen?.();\n }, [preloadComponents, onOpen]);\n\n // Handle drawer close\n const handleClose = React.useCallback(() => {\n setIsOpen(false);\n onClose?.();\n }, [onClose]);\n\n // Handle new session\n const handleNewSession = React.useCallback(() => {\n setInput('');\n resetChat();\n }, [resetChat]);\n\n // Handle keyboard shortcut\n React.useEffect(() => {\n if (!enableHotkey || !hotkey) return;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n const keys = hotkey.toLowerCase().split('+');\n const ctrl = keys.includes('ctrl') || keys.includes('control');\n const cmd = keys.includes('cmd') || keys.includes('command') || keys.includes('meta');\n const shift = keys.includes('shift');\n const alt = keys.includes('alt');\n const key = keys[keys.length - 1];\n\n const ctrlPressed = ctrl && (e.ctrlKey || e.metaKey);\n const cmdPressed = cmd && (e.metaKey || e.ctrlKey);\n const shiftPressed = !shift || e.shiftKey;\n const altPressed = !alt || e.altKey;\n\n if ((ctrlPressed || cmdPressed) && shiftPressed && altPressed && e.key.toLowerCase() === key) {\n e.preventDefault();\n setIsOpen((prev) => !prev);\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [enableHotkey, hotkey]);\n\n return (\n <div className={`ask-ai ${className || ''} ${theme === 'dark' ? 'dark' : ''}`} style={style}>\n {/* Trigger Button - Custom or Default */}\n {children && React.isValidElement(children) ? (\n React.cloneElement(children, {\n ...children.props,\n onClick: (e: React.MouseEvent) => {\n // Call existing onClick if present\n const existingOnClick = children.props?.onClick;\n if (existingOnClick) {\n existingOnClick(e);\n }\n // Then call our handleOpen\n handleOpen();\n },\n })\n ) : (\n <Trigger\n onClick={handleOpen}\n text={texts?.triggerButtonText}\n ariaLabel={texts?.triggerButtonAriaLabel}\n />\n )}\n\n {/* Drawer with Chat */}\n <Drawer\n isOpen={isOpen}\n onClose={handleClose}\n onNewSession={handleNewSession}\n hasMessages={messages.length > 0}\n position={drawerPosition}\n width={drawerWidth}\n expandedWidth={drawerExpandedWidth}\n title={texts?.drawerTitle}\n closeAriaLabel={texts?.drawerCloseAriaLabel}\n newSessionAriaLabel={texts?.drawerNewSessionAriaLabel}\n theme={theme}\n >\n {/* Chat - Lazy loaded with Suspense */}\n {(isOpen || componentsLoaded) && (\n <React.Suspense fallback={\n <Loader2 className={styles.spinning} />\n }>\n <ChatContainer\n texts={texts}\n exampleQuestions={exampleQuestions}\n onMessage={onMessage}\n onError={onError}\n messages={messages}\n isStreaming={isStreaming}\n error={error}\n sendMessage={sendMessage}\n input={input}\n setInput={setInput}\n />\n </React.Suspense>\n )}\n </Drawer>\n </div>\n );\n}\n","import * as React from 'react';\nimport ReactMarkdown from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport rehypeHighlight from 'rehype-highlight';\nimport { common } from 'lowlight';\nimport type { WidgetTexts, UIMessage } from '../../core/types/index.js';\nimport styles from './ChatContainer.module.css';\nimport { ArrowUp, Copy, Check } from 'lucide-react';\nimport type { DynamicToolUIPart, ToolUIPart, UIDataTypes, UIMessagePart, UITools } from 'ai';\n\ninterface ChatContainerProps {\n texts?: WidgetTexts;\n exampleQuestions?: string[];\n onMessage?: (message: any) => void;\n onError?: (error: Error) => void;\n // Lifted state from parent\n messages: UIMessage[];\n isStreaming: boolean;\n error: Error | null;\n sendMessage: (text: string) => Promise<void>;\n input: string;\n setInput: React.Dispatch<React.SetStateAction<string>>;\n}\n\nexport function ChatContainer({\n texts,\n exampleQuestions,\n onMessage,\n onError,\n messages,\n isStreaming,\n error,\n sendMessage,\n input,\n setInput,\n}: ChatContainerProps) {\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const messagesAreaRef = React.useRef<HTMLDivElement>(null);\n const shouldAutoScrollRef = React.useRef(true); // Track if auto-scroll is enabled\n\n // Check if user is at the bottom of the messages area\n const isAtBottom = React.useCallback(() => {\n const messagesArea = messagesAreaRef.current;\n if (!messagesArea) return true;\n\n const threshold = 50; // pixels from bottom to consider \"at bottom\"\n const scrollBottom = messagesArea.scrollHeight - messagesArea.scrollTop - messagesArea.clientHeight;\n return scrollBottom < threshold;\n }, []);\n\n // Scroll to bottom of messages area\n const scrollToBottom = React.useCallback(() => {\n const messagesArea = messagesAreaRef.current;\n if (messagesArea) {\n messagesArea.scrollTop = messagesArea.scrollHeight;\n }\n }, []);\n\n // Handle user scroll events\n const handleScroll = React.useCallback(() => {\n const atBottom = isAtBottom();\n shouldAutoScrollRef.current = atBottom;\n }, [isAtBottom]);\n\n // Auto-scroll when messages change (if enabled)\n React.useEffect(() => {\n if (shouldAutoScrollRef.current) {\n scrollToBottom();\n }\n }, [messages, scrollToBottom]);\n\n // Auto-resize textarea based on content\n const adjustTextareaHeight = React.useCallback(() => {\n const textarea = textareaRef.current;\n if (textarea) {\n textarea.style.height = 'auto';\n textarea.style.height = `${textarea.scrollHeight}px`;\n }\n }, []);\n\n // Call onError callback when error occurs\n React.useEffect(() => {\n if (error && onError) {\n onError(error);\n }\n }, [error, onError]);\n\n // Call onMessage callback when new message arrives\n React.useEffect(() => {\n if (messages.length > 0 && onMessage) {\n onMessage(messages[messages.length - 1]);\n }\n }, [messages, onMessage]);\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n const inputValue = input.trim();\n if (!inputValue || isStreaming) return;\n\n // Enable auto-scroll for new user message\n shouldAutoScrollRef.current = true;\n\n setInput('');\n await sendMessage(inputValue);\n // Reset textarea height after submission\n setTimeout(() => {\n if (textareaRef.current) {\n textareaRef.current.style.height = 'auto';\n }\n }, 0);\n };\n\n const handleInputChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setInput(e.target.value);\n adjustTextareaHeight();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n // Submit on Enter (without Shift)\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n if (input.trim() && !isStreaming) {\n handleSubmit(e as any);\n }\n }\n // Allow Shift+Enter for new line (default textarea behavior)\n };\n\n const handleExampleClick = async (question: string) => {\n if (isStreaming) return;\n // Enable auto-scroll for new user message\n shouldAutoScrollRef.current = true;\n await sendMessage(question);\n };\n\n const inputPlaceholder = texts?.inputPlaceholder || 'Ask a question...';\n const welcomeMessage = texts?.welcomeMessage || 'Hi! How can I help you today?';\n const exampleQuestionsTitle = texts?.exampleQuestionsTitle || 'Example questions:';\n\n // Custom code block component with copy button\n const CodeBlock = ({ children, className, ...props }: any) => {\n const [copied, setCopied] = React.useState(false);\n const match = /language-(\\w+)/.exec(className || '');\n const isCodeBlock = match;\n\n const handleCopy = async () => {\n // Recursively extract text content from React elements\n const getTextContent = (node: any): string => {\n if (typeof node === 'string') return node;\n if (typeof node === 'number') return String(node);\n if (Array.isArray(node)) return node.map(getTextContent).join('');\n if (node?.props?.children) return getTextContent(node.props.children);\n return '';\n };\n\n const code = getTextContent(children).replace(/\\n$/, '');\n try {\n await navigator.clipboard.writeText(code);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n } catch (err) {\n console.error('Failed to copy:', err);\n }\n };\n\n if (isCodeBlock) {\n return (\n <div className={styles.codeBlockWrapper}>\n <button\n onClick={handleCopy}\n className={styles.copyButton}\n aria-label=\"Copy code\"\n >\n {copied ? <Check size={14} /> : <Copy size={14} />}\n </button>\n <code className={className} {...props}>\n {children}\n </code>\n </div>\n );\n }\n\n return <code className={className} {...props}>{children}</code>;\n };\n\n // Helper function to format tool name\n const getToolDisplayName = (toolName: string) => {\n if (toolName.toLowerCase() === 'readFile') {\n return 'Reading docs';\n }\n if (toolName.toLowerCase() === 'bash') {\n return 'Exploring docs';\n }\n return 'Searching docs';\n };\n\n // Render a single message part\n const renderMessagePart = (part: UIMessagePart<UIDataTypes, UITools>, index: number) => {\n if (part.type === 'text') {\n return (\n <div key={index} className={styles.textPart}>\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n rehypePlugins={[[rehypeHighlight, {\n languages: common,\n prefix: 'hljs-'\n }]]}\n components={{\n code: CodeBlock\n }}\n >\n {part.text}\n </ReactMarkdown>\n {part.state === 'streaming' && (\n <span className={styles.cursor} />\n )}\n </div>\n );\n }\n\n if (part.type === 'reasoning') {\n return (\n <div key={index} className={styles.reasoningPart}>\n <div className={styles.reasoningLabel}>Reasoning:</div>\n <div className={styles.reasoningContent}>\n {part.text}\n {part.state === 'streaming' && (\n <span className={styles.cursor} />\n )}\n </div>\n </div>\n );\n }\n\n if (isToolUIPart(part)) {\n const status = part.state === 'output-available' ? 'completed' :\n part.state === 'output-error' ? 'error' :\n part.state === 'input-streaming' ? 'running' : 'pending';\n\n return (\n <div key={index} className={styles.toolPart}>\n <span className={`${styles.toolCall} ${styles[`tool-${status}`]}`}>\n {getToolDisplayName(part.type === 'dynamic-tool' ? part.toolName : part.type.replace('tool-', ''))}\n {(status === 'completed' || status === 'error') ? '' : '...'}\n </span>\n </div>\n );\n }\n\n // Handle other part types if needed\n return null;\n };\n\n return (\n <div className={styles.container}>\n {/* Messages Area */}\n <div\n ref={messagesAreaRef}\n onScroll={handleScroll}\n className={styles.messagesArea}\n >\n {messages.length === 0 ? (\n // Welcome Screen\n <div className={styles.welcomeScreen}>\n <p className={styles.welcomeMessage}>\n {welcomeMessage}\n </p>\n\n {exampleQuestions && exampleQuestions.length > 0 && (\n <div className={styles.exampleQuestionsContainer}>\n <p className={styles.exampleQuestionsTitle}>\n {exampleQuestionsTitle}\n </p>\n {exampleQuestions.map((question, index) => (\n <button\n key={index}\n onClick={() => handleExampleClick(question)}\n className={styles.exampleButton}\n >\n {question}\n </button>\n ))}\n </div>\n )}\n </div>\n ) : (\n // Messages\n <>\n {messages.map((message) => (\n <div\n key={message.id}\n className={`${styles.messageWrapper} ${styles[message.role]}`}\n >\n <div className={`${styles.message} ${styles[message.role]}`}>\n {message.role === 'assistant' ? (\n <div className={styles.markdown}>\n {/* Render each part in order */}\n {message.parts.length > 0\n ? message.parts.map((part, index) => renderMessagePart(part, index))\n : renderMessagePart({ type: 'text', text: '', state: 'streaming' }, 0) /* Empty message fallback */}\n </div>\n ) : (\n <div className={styles.messageText}>\n {/* For user messages, extract and display text */}\n {message.parts\n .filter(part => part.type === 'text')\n .map(part => part.type === 'text' ? part.text : '')\n .join('')}\n </div>\n )}\n </div>\n </div>\n ))}\n </>\n )}\n\n {error && (\n <div className={styles.error}>\n {error.message}\n </div>\n )}\n </div>\n\n {/* Input Area */}\n <form onSubmit={handleSubmit} className={styles.inputForm}>\n <div className={styles.inputWrapper}>\n <textarea\n ref={textareaRef}\n value={input}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n placeholder={inputPlaceholder}\n className={styles.input}\n rows={1}\n />\n <button\n type=\"submit\"\n disabled={!input.trim() || isStreaming}\n className={styles.submitButton}\n >\n <ArrowUp />\n </button>\n </div>\n </form>\n </div>\n );\n}\n\nfunction isToolUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is DynamicToolUIPart | ToolUIPart {\n return part.type === 'dynamic-tool' || part.type.startsWith('tool-');\n}"],"names":["useCallback","useState","useRef","React","Slot","styles","_jsx","_jsxs","Loader2","Sparkles","DialogPrimitive","EraserIcon","Minimize2","Maximize2","X","ChatContainer","Check","Copy","common","_Fragment","ArrowUp"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;AAGG;MACU,SAAS,CAAA;IAIpB,WAAA,CAAY,MAAc,EAAE,OAAgB,EAAA;AAHpC,QAAA,MAAA,CAAA,cAAA,CAAA,IAAA,EAAA,QAAA,EAAA;;;;;AAAe,SAAA,CAAA;AACf,QAAA,MAAA,CAAA,cAAA,CAAA,IAAA,EAAA,SAAA,EAAA;;;;;AAAiB,SAAA,CAAA;AAGvB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;AACpB,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;IACxB;AAEA;;AAEG;AACH,IAAA,MAAM,YAAY,CAChB,QAAqB,EACrB,MAAoB,EAAA;AAEpB,QAAA,MAAM,IAAI,GAAgD;YACxD,QAAQ;SACT;AAED,QAAA,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,YAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO;QAC7B;QAEA,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;AACxC,YAAA,MAAM,EAAE,MAAM;AACd,YAAA,OAAO,EAAE;AACP,gBAAA,cAAc,EAAE,kBAAkB;AACnC,a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EAAE,MAAM,CAAC,KAAK,EACvB,IAAI,EAAE,CAAC,EAAA,CACP,EACFA,cAAA,CAAA,QAAA,EAAA,EACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,WAAW,EACtC,SAAS,EAAE,MAAM,CAAC,YAAY,EAAA,QAAA,EAE9BA,cAAA,CAACc,mBAAO,EAAA,EAAA,CAAG,EAAA,CACJ,CAAA,EAAA,CACL,EAAA,CACD,CAAA,EAAA,CACH;AAEV;AAEA,SAAS,YAAY,CAAC,IAAyC,EAAA;AAC7D,IAAA,OAAO,IAAI,CAAC,IAAI,KAAK,cAAc,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;AACtE;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/core/api/client.ts","../../src/core/hooks/useSSE.ts","../../src/core/hooks/useChat.ts","../../src/components/ui/Button.tsx","../../src/components/widget/Trigger.tsx","../../src/components/widget/Drawer.tsx","../../src/components/widget/Widget.tsx","../../src/components/chat/ChatContainer.tsx"],"sourcesContent":["import type { UIMessage } from '../types/index.js';\n\n/**\n * API client for Ask AI widget\n * Supports AI SDK v6 UIMessage format with streaming responses\n */\nexport class APIClient {\n private apiUrl: string;\n private project?: string;\n\n constructor(apiUrl: string, project?: string) {\n this.apiUrl = apiUrl;\n this.project = project;\n }\n\n /**\n * Send messages and get UIMessageStream response\n */\n async sendMessages(\n messages: UIMessage[],\n signal?: AbortSignal\n ): Promise<Response> {\n const body: { messages: UIMessage[]; project?: string } = {\n messages,\n };\n\n if (this.project) {\n body.project = this.project;\n }\n\n const response = await fetch(this.apiUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(body),\n signal,\n });\n\n if (!response.ok) {\n throw new Error(`Failed to send messages: ${response.statusText}`);\n }\n\n return response;\n }\n}\n","import { useCallback } from 'react';\nimport type { UIMessage, UIMessageChunk } from '../types/index.js';\n\ninterface UseSSEOptions {\n onChunk?: (chunk: UIMessageChunk) => void;\n onError?: (error: Error) => void;\n}\n\ninterface UseSSEReturn {\n handleUIMessageStream: (response: Response, currentMessage: UIMessage) => Promise<void>;\n}\n\n/**\n * Parse SSE chunk format for UIMessageChunk stream\n * Supports both standard SSE format \"data: {...}\" and AI SDK v6 format \"0:{...}\"\n */\nfunction parseUIMessageChunk(line: string): UIMessageChunk | null {\n // Handle standard SSE format: \"data: {json}\"\n if (line.startsWith('data: ')) {\n const jsonStr = line.slice(6); // Remove \"data: \" prefix\n\n // Skip [DONE] marker\n if (jsonStr === '[DONE]') {\n return null;\n }\n\n try {\n return JSON.parse(jsonStr) as UIMessageChunk;\n } catch (err) {\n console.error('Failed to parse UIMessageChunk:', line, err);\n return null;\n }\n }\n\n return null;\n}\n\nexport function useSSE(options: UseSSEOptions = {}): UseSSEReturn {\n const { onChunk, onError } = options;\n\n const handleUIMessageStream = useCallback(\n async (response: Response, _currentMessage: UIMessage) => {\n const reader = response.body?.getReader();\n const decoder = new TextDecoder();\n\n if (!reader) {\n onError?.(new Error('No response body'));\n return;\n }\n\n let buffer = '';\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) {\n break;\n }\n\n buffer += decoder.decode(value, { stream: true });\n\n // Process complete lines\n const lines = buffer.split('\\n');\n\n // Keep the last incomplete line in the buffer\n buffer = lines.pop() || '';\n\n for (const line of lines) {\n if (!line.trim()) {\n continue;\n }\n\n const chunk = parseUIMessageChunk(line);\n if (chunk) {\n onChunk?.(chunk);\n }\n }\n }\n } catch (err) {\n // Don't report AbortError as it's an intentional cancellation\n if (err instanceof Error && err.name === 'AbortError') {\n return;\n }\n const error = err instanceof Error ? err : new Error('SSE stream error');\n onError?.(error);\n } finally {\n reader.releaseLock();\n }\n },\n [onChunk, onError]\n );\n\n return {\n handleUIMessageStream,\n };\n}\n","import { useState, useCallback, useRef } from 'react';\nimport { useSSE } from './useSSE.js';\nimport type { UIMessage, UIMessageChunk, WidgetTexts } from '../types/index.js';\nimport type { APIClient } from '../api/client.js';\n\ninterface UseChatOptions {\n apiClient: APIClient;\n texts?: WidgetTexts;\n}\n\ninterface UseChatReturn {\n messages: UIMessage[];\n isStreaming: boolean;\n error: Error | null;\n sendMessage: (text: string) => Promise<void>;\n resetChat: () => void;\n}\n\nlet idCounter = 0;\n\nfunction getMessageId() {\n idCounter += 1;\n return `msg-${idCounter}`;\n}\n\n/**\n * Apply a UIMessageChunk to update the current assistant message\n */\nfunction applyChunkToMessage(message: UIMessage, chunk: UIMessageChunk): UIMessage {\n const parts = [...message.parts];\n\n switch (chunk.type) {\n case 'text-start': {\n // Start a new text part\n parts.push({\n type: 'text',\n text: '',\n state: 'streaming',\n });\n break;\n }\n\n case 'text-delta': {\n // Find the last text part and append delta\n const lastTextIndex = parts.findLastIndex((p: any) => p.type === 'text');\n if (lastTextIndex >= 0) {\n const textPart = parts[lastTextIndex];\n if (textPart.type === 'text') {\n parts[lastTextIndex] = {\n ...textPart,\n text: textPart.text + chunk.delta,\n };\n }\n }\n break;\n }\n\n case 'text-end': {\n // Mark the last text part as done\n const lastTextIndex = parts.findLastIndex((p: any) => p.type === 'text');\n if (lastTextIndex >= 0) {\n const textPart = parts[lastTextIndex];\n if (textPart.type === 'text') {\n parts[lastTextIndex] = {\n ...textPart,\n state: 'done',\n };\n }\n }\n break;\n }\n\n case 'reasoning-start': {\n // Start a new reasoning part\n parts.push({\n type: 'reasoning',\n text: '',\n state: 'streaming',\n });\n break;\n }\n\n case 'reasoning-delta': {\n // Find the last reasoning part and append delta\n const lastReasoningIndex = parts.findLastIndex((p: any) => p.type === 'reasoning');\n if (lastReasoningIndex >= 0) {\n const reasoningPart = parts[lastReasoningIndex];\n if (reasoningPart.type === 'reasoning') {\n parts[lastReasoningIndex] = {\n ...reasoningPart,\n text: reasoningPart.text + chunk.delta,\n };\n }\n }\n break;\n }\n\n case 'reasoning-end': {\n // Mark the last reasoning part as done\n const lastReasoningIndex = parts.findLastIndex((p: any) => p.type === 'reasoning');\n if (lastReasoningIndex >= 0) {\n const reasoningPart = parts[lastReasoningIndex];\n if (reasoningPart.type === 'reasoning') {\n parts[lastReasoningIndex] = {\n ...reasoningPart,\n state: 'done',\n };\n }\n }\n break;\n }\n\n case 'tool-input-start': {\n // Start a new dynamic tool call\n parts.push({\n type: 'dynamic-tool',\n toolCallId: chunk.toolCallId,\n toolName: chunk.toolName,\n input: undefined,\n state: 'input-streaming',\n } as any);\n break;\n }\n\n case 'tool-input-available': {\n // Update tool call with input\n const toolIndex = parts.findIndex(\n (p: any) => p.type === 'dynamic-tool' && p.toolCallId === chunk.toolCallId\n );\n if (toolIndex >= 0) {\n const toolPart = parts[toolIndex] as any;\n parts[toolIndex] = {\n ...toolPart,\n input: chunk.input,\n state: 'input-available',\n };\n }\n break;\n }\n\n case 'tool-output-available': {\n // Update tool call with output\n const toolIndex = parts.findIndex(\n (p: any) => p.type === 'dynamic-tool' && p.toolCallId === chunk.toolCallId\n );\n if (toolIndex >= 0) {\n const toolPart = parts[toolIndex] as any;\n parts[toolIndex] = {\n ...toolPart,\n output: chunk.output,\n state: 'output-available',\n };\n }\n break;\n }\n\n case 'tool-output-error': {\n // Update tool call with error\n const toolIndex = parts.findIndex(\n (p: any) => p.type === 'dynamic-tool' && p.toolCallId === chunk.toolCallId\n );\n if (toolIndex >= 0) {\n const toolPart = parts[toolIndex] as any;\n parts[toolIndex] = {\n ...toolPart,\n errorText: chunk.errorText,\n state: 'error',\n };\n }\n break;\n }\n\n case 'error': {\n // Handle error chunk - could add error state to message\n console.error('Stream error:', chunk.errorText);\n break;\n }\n\n // Add other chunk types as needed\n default:\n // Ignore unknown chunk types\n break;\n }\n\n return {\n ...message,\n parts,\n };\n}\n\nexport function useChat({ apiClient }: UseChatOptions): UseChatReturn {\n const [messages, setMessages] = useState<UIMessage[]>([]);\n const [isStreaming, setIsStreaming] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const abortControllerRef = useRef<AbortController | null>(null);\n\n const { handleUIMessageStream } = useSSE({\n onChunk: (chunk) => {\n if (chunk.type === 'error') {\n setError(new Error(chunk.errorText));\n setIsStreaming(false);\n return;\n }\n\n // Update the last assistant message with the chunk\n setMessages((prev) => {\n const lastMessage = prev[prev.length - 1];\n if (lastMessage && lastMessage.role === 'assistant') {\n const updatedMessage = applyChunkToMessage(lastMessage, chunk);\n return [...prev.slice(0, -1), updatedMessage];\n }\n return prev;\n });\n },\n onError: (err) => {\n setError(err);\n setIsStreaming(false);\n // Remove the failed assistant message\n setMessages((prev) => {\n const lastMessage = prev[prev.length - 1];\n if (lastMessage && lastMessage.role === 'assistant' && lastMessage.parts.length === 0) {\n return prev.slice(0, -1);\n }\n return prev;\n });\n },\n });\n\n const sendMessage = useCallback(\n async (text: string) => {\n if (!text.trim()) {\n return;\n }\n\n // Abort any ongoing request\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n }\n\n // Create new AbortController for this request\n const abortController = new AbortController();\n abortControllerRef.current = abortController;\n\n setError(null);\n setIsStreaming(true);\n\n // Add user message immediately (optimistic UI)\n const userMessage: UIMessage = {\n id: getMessageId(),\n role: 'user',\n parts: [\n {\n type: 'text',\n text,\n },\n ],\n };\n\n // Add placeholder for assistant response\n const assistantMessage: UIMessage = {\n id: getMessageId(),\n role: 'assistant',\n parts: [],\n };\n\n const newMessages = [...messages, userMessage];\n setMessages([...newMessages, assistantMessage]);\n\n try {\n const response = await apiClient.sendMessages(\n newMessages,\n abortController.signal\n );\n await handleUIMessageStream(response, assistantMessage);\n setIsStreaming(false);\n } catch (err) {\n // Don't treat aborted requests as errors\n if (err instanceof Error && err.name === 'AbortError') {\n return;\n }\n\n const error = err instanceof Error ? err : new Error('Failed to send message');\n setError(error);\n setIsStreaming(false);\n\n // Remove the failed messages\n setMessages((prev) => prev.slice(0, -2));\n } finally {\n // Clear the abort controller reference if this was the current one\n if (abortControllerRef.current === abortController) {\n abortControllerRef.current = null;\n }\n }\n },\n [messages, apiClient, handleUIMessageStream]\n );\n\n const resetChat = useCallback(() => {\n // Abort any ongoing request\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n abortControllerRef.current = null;\n }\n\n setMessages([]);\n setError(null);\n setIsStreaming(false);\n }, []);\n\n return {\n messages,\n isStreaming,\n error,\n sendMessage,\n resetChat,\n };\n}\n","import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport styles from './Button.module.css';\n\ntype ButtonVariant = 'default' | 'outline' | 'ghost' | 'icon';\ntype ButtonSize = 'default' | 'sm' | 'lg' | 'icon';\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n variant?: ButtonVariant;\n size?: ButtonSize;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant = 'default', size = 'default', asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button';\n\n const classNames = [\n styles.button,\n styles[`variant-${variant}`],\n styles[`size-${size}`],\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <Comp\n className={classNames}\n ref={ref}\n {...props}\n />\n );\n }\n);\n\nButton.displayName = 'Button';\n\nexport { Button };\n","import { Sparkles, Loader2 } from 'lucide-react';\nimport { Button } from '../ui/Button.js';\nimport styles from './Trigger.module.css';\n\ninterface TriggerProps {\n onClick: () => void;\n text?: string;\n ariaLabel?: string;\n className?: string;\n isLoading?: boolean;\n}\n\nexport function Trigger({\n onClick,\n text = 'Ask AI',\n ariaLabel = 'Open AI assistant',\n className,\n isLoading = false,\n}: TriggerProps) {\n const classNames = [styles.trigger, className].filter(Boolean).join(' ');\n\n return (\n <Button\n onClick={onClick}\n variant=\"outline\"\n aria-label={ariaLabel}\n className={classNames}\n disabled={isLoading}\n >\n {isLoading ? (\n <Loader2 className={`${styles.icon} ${styles.spinning}`} />\n ) : (\n <Sparkles className={styles.icon} />\n )}\n {text && <span>{text}</span>}\n </Button>\n );\n}\n","import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Sparkles, X, EraserIcon, Maximize2, Minimize2 } from 'lucide-react';\nimport { Button } from '../ui/Button.js';\nimport styles from './Drawer.module.css';\n\ninterface DrawerProps {\n isOpen: boolean;\n onClose: () => void;\n onNewSession?: () => void;\n hasMessages?: boolean;\n position?: 'right' | 'left';\n width?: number | string;\n expandedWidth?: number | string;\n title?: string;\n closeAriaLabel?: string;\n newSessionAriaLabel?: string;\n children?: React.ReactNode;\n theme?: 'light' | 'dark';\n}\n\nexport function Drawer({\n isOpen,\n onClose,\n onNewSession,\n hasMessages,\n position = 'right',\n width = 600,\n expandedWidth = 920,\n title = 'Ask AI',\n closeAriaLabel = 'Close',\n newSessionAriaLabel = 'New session',\n children,\n theme = 'light',\n}: DrawerProps) {\n const [isExpanded, setIsExpanded] = React.useState(false);\n\n const maxWidth = isExpanded ? expandedWidth : width;\n\n const contentClasses = [\n styles.content,\n styles[`position-${position}`],\n ].join(' ');\n\n // Create a portal container that inherits theme from the nearest .ask-ai ancestor\n const [portalContainer, setPortalContainer] = React.useState<HTMLElement | null>(null);\n\n React.useEffect(() => {\n if (typeof document === 'undefined') return;\n\n // Create a portal container with ask-ai class\n const container = document.createElement('div');\n container.className = `ask-ai${theme === 'dark' ? ' dark' : ''}`;\n document.body.appendChild(container);\n setPortalContainer(container);\n\n return () => {\n document.body.removeChild(container);\n };\n }, [theme]);\n\n return (\n <DialogPrimitive.Root open={isOpen} onOpenChange={(open) => !open && onClose()}>\n <DialogPrimitive.Portal container={portalContainer}>\n {/* Overlay */}\n <DialogPrimitive.Overlay className={styles.overlay} />\n\n {/* Drawer Content */}\n <DialogPrimitive.Content\n className={contentClasses}\n style={{ maxWidth }}\n >\n {/* Header */}\n <div className={styles.header}>\n <DialogPrimitive.Title className={styles.title}>\n <Sparkles className={styles.icon} />\n {title}\n </DialogPrimitive.Title>\n <div className={styles.headerActions}>\n {onNewSession && hasMessages && (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={newSessionAriaLabel}\n className={styles.newSessionButton}\n onClick={onNewSession}\n >\n <EraserIcon className={styles.newSessionIcon} />\n </Button>\n )}\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={isExpanded ? 'Shrink' : 'Expand'}\n className={styles.expandButton}\n onClick={() => setIsExpanded(!isExpanded)}\n >\n {isExpanded ? (\n <Minimize2 className={styles.expandIcon} />\n ) : (\n <Maximize2 className={styles.expandIcon} />\n )}\n </Button>\n <DialogPrimitive.Close asChild>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={closeAriaLabel}\n className={styles.closeButton}\n >\n <X className={styles.closeIcon} />\n </Button>\n </DialogPrimitive.Close>\n </div>\n </div>\n\n {/* Content */}\n <div className={styles.body}>\n {children}\n </div>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n}\n","import * as React from 'react';\nimport { Loader2 } from 'lucide-react';\nimport { APIClient } from '../../core/api/client.js';\nimport { useChat } from '../../core/hooks/useChat.js';\nimport type { WidgetProps } from '../../core/types/index.js';\nimport { Trigger } from './Trigger.js';\nimport { Drawer } from './Drawer.js';\nimport styles from './Widget.module.css';\n\n// Lazy load heavy components\nconst ChatContainer = React.lazy(() => import('../chat/ChatContainer.js').then(m => ({ default: m.ChatContainer })));\n\nexport function Widget(props: WidgetProps) {\n const {\n apiUrl,\n project,\n drawerPosition = 'right',\n drawerWidth = 600,\n drawerExpandedWidth = 920,\n theme = 'light',\n texts,\n exampleQuestions,\n hotkey,\n enableHotkey = true,\n onOpen,\n onClose,\n onMessage,\n onError,\n className,\n style,\n children,\n } = props;\n\n const [isOpen, setIsOpen] = React.useState(false);\n const [componentsLoaded, setComponentsLoaded] = React.useState(false);\n const [apiClient] = React.useState(() => new APIClient(apiUrl, project));\n\n // Lift chat state to Widget level to persist across drawer open/close\n const { messages, isStreaming, error, sendMessage, resetChat } = useChat({ apiClient, texts });\n\n // Input state also needs to persist\n const [input, setInput] = React.useState('');\n\n // Preload components\n const preloadComponents = React.useCallback(async () => {\n if (componentsLoaded) return;\n\n try {\n // Trigger lazy loading by importing the modules\n await import('../chat/ChatContainer.js');\n setComponentsLoaded(true);\n } catch (error) {\n console.error('Failed to preload components:', error);\n }\n }, [componentsLoaded]);\n\n // Handle drawer open\n const handleOpen = React.useCallback(async () => {\n preloadComponents();\n setIsOpen(true);\n onOpen?.();\n }, [preloadComponents, onOpen]);\n\n // Handle drawer close\n const handleClose = React.useCallback(() => {\n setIsOpen(false);\n onClose?.();\n }, [onClose]);\n\n // Handle new session\n const handleNewSession = React.useCallback(() => {\n setInput('');\n resetChat();\n }, [resetChat]);\n\n // Handle keyboard shortcut\n React.useEffect(() => {\n if (!enableHotkey || !hotkey) return;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n const keys = hotkey.toLowerCase().split('+');\n const ctrl = keys.includes('ctrl') || keys.includes('control');\n const cmd = keys.includes('cmd') || keys.includes('command') || keys.includes('meta');\n const shift = keys.includes('shift');\n const alt = keys.includes('alt');\n const key = keys[keys.length - 1];\n\n const ctrlPressed = ctrl && (e.ctrlKey || e.metaKey);\n const cmdPressed = cmd && (e.metaKey || e.ctrlKey);\n const shiftPressed = !shift || e.shiftKey;\n const altPressed = !alt || e.altKey;\n\n if ((ctrlPressed || cmdPressed) && shiftPressed && altPressed && e.key.toLowerCase() === key) {\n e.preventDefault();\n setIsOpen((prev) => !prev);\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [enableHotkey, hotkey]);\n\n return (\n <div className={`ask-ai ${className || ''} ${theme === 'dark' ? 'dark' : ''}`} style={style}>\n {/* Trigger Button - Custom or Default */}\n {children && React.isValidElement(children) ? (\n React.cloneElement(children, {\n ...children.props,\n onClick: (e: React.MouseEvent) => {\n // Call existing onClick if present\n const existingOnClick = children.props?.onClick;\n if (existingOnClick) {\n existingOnClick(e);\n }\n // Then call our handleOpen\n handleOpen();\n },\n })\n ) : (\n <Trigger\n onClick={handleOpen}\n text={texts?.triggerButtonText}\n ariaLabel={texts?.triggerButtonAriaLabel}\n />\n )}\n\n {/* Drawer with Chat */}\n <Drawer\n isOpen={isOpen}\n onClose={handleClose}\n onNewSession={handleNewSession}\n hasMessages={messages.length > 0}\n position={drawerPosition}\n width={drawerWidth}\n expandedWidth={drawerExpandedWidth}\n title={texts?.drawerTitle}\n closeAriaLabel={texts?.drawerCloseAriaLabel}\n newSessionAriaLabel={texts?.drawerNewSessionAriaLabel}\n theme={theme}\n >\n {/* Chat - Lazy loaded with Suspense */}\n {(isOpen || componentsLoaded) && (\n <React.Suspense fallback={\n <Loader2 className={styles.spinning} />\n }>\n <ChatContainer\n texts={texts}\n exampleQuestions={exampleQuestions}\n onMessage={onMessage}\n onError={onError}\n messages={messages}\n isStreaming={isStreaming}\n error={error}\n sendMessage={sendMessage}\n input={input}\n setInput={setInput}\n />\n </React.Suspense>\n )}\n </Drawer>\n </div>\n );\n}\n","import * as React from 'react';\nimport ReactMarkdown from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport rehypeHighlight from 'rehype-highlight';\nimport { common } from 'lowlight';\nimport type { WidgetTexts, UIMessage } from '../../core/types/index.js';\nimport styles from './ChatContainer.module.css';\nimport { ArrowUp, Copy, Check } from 'lucide-react';\nimport type { DynamicToolUIPart, ToolUIPart, UIDataTypes, UIMessagePart, UITools } from 'ai';\n\ninterface ChatContainerProps {\n texts?: WidgetTexts;\n exampleQuestions?: string[];\n onMessage?: (message: any) => void;\n onError?: (error: Error) => void;\n // Lifted state from parent\n messages: UIMessage[];\n isStreaming: boolean;\n error: Error | null;\n sendMessage: (text: string) => Promise<void>;\n input: string;\n setInput: React.Dispatch<React.SetStateAction<string>>;\n}\n\nexport function ChatContainer({\n texts,\n exampleQuestions,\n onMessage,\n onError,\n messages,\n isStreaming,\n error,\n sendMessage,\n input,\n setInput,\n}: ChatContainerProps) {\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const messagesAreaRef = React.useRef<HTMLDivElement>(null);\n const shouldAutoScrollRef = React.useRef(true); // Track if auto-scroll is enabled\n\n // Check if user is at the bottom of the messages area\n const isAtBottom = React.useCallback(() => {\n const messagesArea = messagesAreaRef.current;\n if (!messagesArea) return true;\n\n const threshold = 50; // pixels from bottom to consider \"at bottom\"\n const scrollBottom = messagesArea.scrollHeight - messagesArea.scrollTop - messagesArea.clientHeight;\n return scrollBottom < threshold;\n }, []);\n\n // Scroll to bottom of messages area\n const scrollToBottom = React.useCallback(() => {\n const messagesArea = messagesAreaRef.current;\n if (messagesArea) {\n messagesArea.scrollTop = messagesArea.scrollHeight;\n }\n }, []);\n\n // Handle user scroll events\n const handleScroll = React.useCallback(() => {\n const atBottom = isAtBottom();\n shouldAutoScrollRef.current = atBottom;\n }, [isAtBottom]);\n\n // Auto-scroll when messages change (if enabled)\n React.useEffect(() => {\n if (shouldAutoScrollRef.current) {\n scrollToBottom();\n }\n }, [messages, scrollToBottom]);\n\n // Auto-resize textarea based on content\n const adjustTextareaHeight = React.useCallback(() => {\n const textarea = textareaRef.current;\n if (textarea) {\n textarea.style.height = 'auto';\n textarea.style.height = `${textarea.scrollHeight}px`;\n }\n }, []);\n\n // Call onError callback when error occurs\n React.useEffect(() => {\n if (error && onError) {\n onError(error);\n }\n }, [error, onError]);\n\n // Call onMessage callback when new message arrives\n React.useEffect(() => {\n if (messages.length > 0 && onMessage) {\n onMessage(messages[messages.length - 1]);\n }\n }, [messages, onMessage]);\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n const inputValue = input.trim();\n if (!inputValue || isStreaming) return;\n\n // Enable auto-scroll for new user message\n shouldAutoScrollRef.current = true;\n\n setInput('');\n await sendMessage(inputValue);\n // Reset textarea height after submission\n setTimeout(() => {\n if (textareaRef.current) {\n textareaRef.current.style.height = 'auto';\n }\n }, 0);\n };\n\n const handleInputChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setInput(e.target.value);\n adjustTextareaHeight();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n // Submit on Enter (without Shift)\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n if (input.trim() && !isStreaming) {\n handleSubmit(e as any);\n }\n }\n // Allow Shift+Enter for new line (default textarea behavior)\n };\n\n const handleExampleClick = async (question: string) => {\n if (isStreaming) return;\n // Enable auto-scroll for new user message\n shouldAutoScrollRef.current = true;\n await sendMessage(question);\n };\n\n const inputPlaceholder = texts?.inputPlaceholder || 'Ask a question...';\n const welcomeMessage = texts?.welcomeMessage || 'Hi! How can I help you today?';\n const exampleQuestionsTitle = texts?.exampleQuestionsTitle || 'Example questions:';\n\n // Custom code block component with copy button\n const CodeBlock = ({ children, className, ...props }: any) => {\n const [copied, setCopied] = React.useState(false);\n const match = /language-(\\w+)/.exec(className || '');\n const isCodeBlock = match;\n\n const handleCopy = async () => {\n // Recursively extract text content from React elements\n const getTextContent = (node: any): string => {\n if (typeof node === 'string') return node;\n if (typeof node === 'number') return String(node);\n if (Array.isArray(node)) return node.map(getTextContent).join('');\n if (node?.props?.children) return getTextContent(node.props.children);\n return '';\n };\n\n const code = getTextContent(children).replace(/\\n$/, '');\n try {\n await navigator.clipboard.writeText(code);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n } catch (err) {\n console.error('Failed to copy:', err);\n }\n };\n\n if (isCodeBlock) {\n return (\n <div className={styles.codeBlockWrapper}>\n <button\n onClick={handleCopy}\n className={styles.copyButton}\n aria-label=\"Copy code\"\n >\n {copied ? <Check size={14} /> : <Copy size={14} />}\n </button>\n <code className={className} {...props}>\n {children}\n </code>\n </div>\n );\n }\n\n return <code className={className} {...props}>{children}</code>;\n };\n\n // Helper function to format tool name\n const getToolDisplayName = (toolName: string) => {\n if (toolName.toLowerCase() === 'readFile') {\n return 'Reading docs';\n }\n if (toolName.toLowerCase() === 'bash') {\n return 'Exploring docs';\n }\n return 'Searching docs';\n };\n\n // Render a single message part\n const renderMessagePart = (part: UIMessagePart<UIDataTypes, UITools>, index: number) => {\n if (part.type === 'text') {\n return (\n <div key={index} className={styles.textPart}>\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n rehypePlugins={[[rehypeHighlight, {\n languages: common,\n prefix: 'hljs-'\n }]]}\n components={{\n code: CodeBlock\n }}\n >\n {part.text}\n </ReactMarkdown>\n </div>\n );\n }\n\n if (part.type === 'reasoning') {\n return (\n <div key={index} className={`${styles.reasoningPart} ${styles[`reasoning-${part.state}`]}`}>\n <div className={styles.reasoningLabel}>Thinking...</div>\n <div className={styles.reasoningContent}>\n {part.text}\n </div>\n </div>\n );\n }\n\n if (isToolUIPart(part)) {\n const status = part.state === 'output-available' ? 'completed' :\n part.state === 'output-error' ? 'error' :\n part.state === 'input-streaming' ? 'running' : 'pending';\n\n return (\n <div key={index} className={styles.toolPart}>\n <span className={`${styles.toolCall} ${styles[`tool-${status}`]}`}>\n {getToolDisplayName(part.type === 'dynamic-tool' ? part.toolName : part.type.replace('tool-', ''))}\n {(status === 'completed' || status === 'error') ? '' : '...'}\n </span>\n </div>\n );\n }\n\n // Handle other part types if needed\n return null;\n };\n\n return (\n <div className={styles.container}>\n {/* Messages Area */}\n <div\n ref={messagesAreaRef}\n onScroll={handleScroll}\n className={styles.messagesArea}\n >\n {messages.length === 0 ? (\n // Welcome Screen\n <div className={styles.welcomeScreen}>\n <p className={styles.welcomeMessage}>\n {welcomeMessage}\n </p>\n\n {exampleQuestions && exampleQuestions.length > 0 && (\n <div className={styles.exampleQuestionsContainer}>\n <p className={styles.exampleQuestionsTitle}>\n {exampleQuestionsTitle}\n </p>\n {exampleQuestions.map((question, index) => (\n <button\n key={index}\n onClick={() => handleExampleClick(question)}\n className={styles.exampleButton}\n >\n {question}\n </button>\n ))}\n </div>\n )}\n </div>\n ) : (\n // Messages\n <>\n {messages.map((message, index) => (\n <div\n key={message.id}\n className={`${styles.messageWrapper} ${styles[message.role]}`}\n >\n <div className={`${styles.message} ${styles[message.role]}`}>\n {message.role === 'assistant' ? (\n <div className={styles.markdown}>\n {/* Render each part in order */}\n {message.parts.map((part, index) => renderMessagePart(part, index))}\n {isStreaming && index === messages.length -1 && <span className={styles.cursor} />}\n </div>\n ) : (\n <div className={styles.messageText}>\n {/* For user messages, extract and display text */}\n {message.parts\n .filter(part => part.type === 'text')\n .map(part => part.type === 'text' ? part.text : '')\n .join('')}\n </div>\n )}\n </div>\n </div>\n ))}\n </>\n )}\n\n {error && (\n <div className={styles.error}>\n {error.message}\n </div>\n )}\n </div>\n\n {/* Input Area */}\n <form onSubmit={handleSubmit} className={styles.inputForm}>\n <div className={styles.inputWrapper}>\n <textarea\n ref={textareaRef}\n value={input}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n placeholder={inputPlaceholder}\n className={styles.input}\n rows={1}\n />\n <button\n type=\"submit\"\n disabled={!input.trim() || isStreaming}\n className={styles.submitButton}\n >\n <ArrowUp />\n </button>\n </div>\n </form>\n </div>\n );\n}\n\nfunction isToolUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is DynamicToolUIPart | ToolUIPart {\n return part.type === 'dynamic-tool' || part.type.startsWith('tool-');\n}"],"names":["useCallback","useState","useRef","React","Slot","styles","_jsx","_jsxs","Loader2","Sparkles","DialogPrimitive","EraserIcon","Minimize2","Maximize2","X","ChatContainer","Check","Copy","common","_Fragment","ArrowUp"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;AAGG;MACU,SAAS,CAAA;IAIpB,WAAA,CAAY,MAAc,EAAE,OAAgB,EAAA;AAHpC,QAAA,MAAA,CAAA,cAAA,CAAA,IAAA,EAAA,QAAA,EAAA;;;;;AAAe,SAAA,CAAA;AACf,QAAA,MAAA,CAAA,cAAA,CAAA,IAAA,EAAA,SAAA,EAAA;;;;;AAAiB,SAAA,CAAA;AAGvB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;AACpB,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;IACxB;AAEA;;AAEG;AACH,IAAA,M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AA,EAAK,SAAS,EAAE,MAAM,CAAC,YAAY,EAAA,QAAA,EAAA,CACjCD,cAAA,CAAA,UAAA,EAAA,EACE,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,iBAAiB,EAC3B,SAAS,EAAE,aAAa,EACxB,WAAW,EAAE,gBAAgB,EAC7B,SAAS,EAAE,MAAM,CAAC,KAAK,EACvB,IAAI,EAAE,CAAC,EAAA,CACP,EACFA,cAAA,CAAA,QAAA,EAAA,EACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,WAAW,EACtC,SAAS,EAAE,MAAM,CAAC,YAAY,EAAA,QAAA,EAE9BA,cAAA,CAACc,mBAAO,EAAA,EAAA,CAAG,EAAA,CACJ,CAAA,EAAA,CACL,EAAA,CACD,CAAA,EAAA,CACH;AAEV;AAEA,SAAS,YAAY,CAAC,IAAyC,EAAA;AAC7D,IAAA,OAAO,IAAI,CAAC,IAAI,KAAK,cAAc,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;AACtE;;;;;;;;;;;;"}
|
package/dist/cjs/styles.css
CHANGED
|
@@ -124,25 +124,23 @@
|
|
|
124
124
|
|
|
125
125
|
.reasoningPart_JD-Cg {
|
|
126
126
|
margin: 12px 0;
|
|
127
|
-
padding:
|
|
128
|
-
|
|
129
|
-
border-radius: var(--ask-ai-radius-md);
|
|
130
|
-
border-left: 3px solid var(--ask-ai-primary);
|
|
127
|
+
padding: 8px 0 8px 16px;
|
|
128
|
+
border-left: 2px solid var(--ask-ai-border);
|
|
131
129
|
}
|
|
132
130
|
|
|
133
131
|
.reasoningLabel_Qbv7v {
|
|
134
132
|
font-size: 12px;
|
|
135
|
-
font-weight:
|
|
136
|
-
color: var(--ask-ai-
|
|
137
|
-
margin-bottom:
|
|
138
|
-
|
|
139
|
-
letter-spacing: 0.5px;
|
|
133
|
+
font-weight: 500;
|
|
134
|
+
color: var(--ask-ai-muted);
|
|
135
|
+
margin-bottom: 4px;
|
|
136
|
+
opacity: 0.8;
|
|
140
137
|
}
|
|
141
138
|
|
|
142
139
|
.reasoningContent_pBYq2 {
|
|
143
140
|
font-size: 13px;
|
|
144
141
|
color: var(--ask-ai-muted);
|
|
145
142
|
line-height: 1.6;
|
|
143
|
+
opacity: 0.7;
|
|
146
144
|
}
|
|
147
145
|
|
|
148
146
|
.toolPart_jy7Rq {
|
|
@@ -173,6 +171,7 @@
|
|
|
173
171
|
opacity: 0.7;
|
|
174
172
|
}
|
|
175
173
|
|
|
174
|
+
.reasoning-streaming_gj-ZD,
|
|
176
175
|
.toolCall_gEKn0.tool-pending_hifHC,
|
|
177
176
|
.toolCall_gEKn0.tool-running_D0dCg {
|
|
178
177
|
animation: pulse_STM-e 1.5s ease-in-out infinite;
|
package/dist/esm/ask-ai.js
CHANGED
|
@@ -6,7 +6,7 @@ import rehypeHighlight from 'rehype-highlight';
|
|
|
6
6
|
import { common } from 'lowlight';
|
|
7
7
|
import { ArrowUp, Check, Copy } from 'lucide-react';
|
|
8
8
|
|
|
9
|
-
var styles = {"container":"container_FRFCj","messagesArea":"messagesArea_Hi-49","welcomeScreen":"welcomeScreen_fJ8-E","welcomeMessage":"welcomeMessage_unMIK","exampleQuestionsContainer":"exampleQuestionsContainer_RBWq6","exampleQuestionsTitle":"exampleQuestionsTitle_Vurj8","exampleButton":"exampleButton_6sOzR","messageWrapper":"messageWrapper_nsQr8","user":"user_s1Gzu","assistant":"assistant_xU0-H","message":"message_jxpo4","messageText":"messageText_neW3m","markdown":"markdown_mNC3q","textPart":"textPart_efb3b","reasoningPart":"reasoningPart_JD-Cg","reasoningLabel":"reasoningLabel_Qbv7v","reasoningContent":"reasoningContent_pBYq2","toolPart":"toolPart_jy7Rq","toolCallsContainer":"toolCallsContainer_1nUsV","toolCall":"toolCall_gEKn0","tool-completed":"tool-completed_5Utl8","tool-pending":"tool-pending_hifHC","tool-running":"tool-running_D0dCg","pulse":"pulse_STM-e","tool-error":"tool-error_eqjRM","codeBlockWrapper":"codeBlockWrapper_rOz7-","copyButton":"copyButton_Ry43q","cursor":"cursor_9Dhwg","blink":"blink_-4y-x","error":"error_uFX9a","inputForm":"inputForm_nC0l-","inputWrapper":"inputWrapper_zGeKy","input":"input_7lMOc","submitButton":"submitButton_2XrPY"};
|
|
9
|
+
var styles = {"container":"container_FRFCj","messagesArea":"messagesArea_Hi-49","welcomeScreen":"welcomeScreen_fJ8-E","welcomeMessage":"welcomeMessage_unMIK","exampleQuestionsContainer":"exampleQuestionsContainer_RBWq6","exampleQuestionsTitle":"exampleQuestionsTitle_Vurj8","exampleButton":"exampleButton_6sOzR","messageWrapper":"messageWrapper_nsQr8","user":"user_s1Gzu","assistant":"assistant_xU0-H","message":"message_jxpo4","messageText":"messageText_neW3m","markdown":"markdown_mNC3q","textPart":"textPart_efb3b","reasoningPart":"reasoningPart_JD-Cg","reasoningLabel":"reasoningLabel_Qbv7v","reasoningContent":"reasoningContent_pBYq2","toolPart":"toolPart_jy7Rq","toolCallsContainer":"toolCallsContainer_1nUsV","toolCall":"toolCall_gEKn0","tool-completed":"tool-completed_5Utl8","reasoning-streaming":"reasoning-streaming_gj-ZD","tool-pending":"tool-pending_hifHC","tool-running":"tool-running_D0dCg","pulse":"pulse_STM-e","tool-error":"tool-error_eqjRM","codeBlockWrapper":"codeBlockWrapper_rOz7-","copyButton":"copyButton_Ry43q","cursor":"cursor_9Dhwg","blink":"blink_-4y-x","error":"error_uFX9a","inputForm":"inputForm_nC0l-","inputWrapper":"inputWrapper_zGeKy","input":"input_7lMOc","submitButton":"submitButton_2XrPY"};
|
|
10
10
|
|
|
11
11
|
function ChatContainer({ texts, exampleQuestions, onMessage, onError, messages, isStreaming, error, sendMessage, input, setInput, }) {
|
|
12
12
|
const textareaRef = React.useRef(null);
|
|
@@ -145,15 +145,15 @@ function ChatContainer({ texts, exampleQuestions, onMessage, onError, messages,
|
|
|
145
145
|
// Render a single message part
|
|
146
146
|
const renderMessagePart = (part, index) => {
|
|
147
147
|
if (part.type === 'text') {
|
|
148
|
-
return (
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
return (jsx("div", { className: styles.textPart, children: jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [[rehypeHighlight, {
|
|
149
|
+
languages: common,
|
|
150
|
+
prefix: 'hljs-'
|
|
151
|
+
}]], components: {
|
|
152
|
+
code: CodeBlock
|
|
153
|
+
}, children: part.text }) }, index));
|
|
154
154
|
}
|
|
155
155
|
if (part.type === 'reasoning') {
|
|
156
|
-
return (jsxs("div", { className: styles.reasoningPart
|
|
156
|
+
return (jsxs("div", { className: `${styles.reasoningPart} ${styles[`reasoning-${part.state}`]}`, children: [jsx("div", { className: styles.reasoningLabel, children: "Thinking..." }), jsx("div", { className: styles.reasoningContent, children: part.text })] }, index));
|
|
157
157
|
}
|
|
158
158
|
if (isToolUIPart(part)) {
|
|
159
159
|
const status = part.state === 'output-available' ? 'completed' :
|
|
@@ -168,9 +168,7 @@ function ChatContainer({ texts, exampleQuestions, onMessage, onError, messages,
|
|
|
168
168
|
// Welcome Screen
|
|
169
169
|
jsxs("div", { className: styles.welcomeScreen, children: [jsx("p", { className: styles.welcomeMessage, children: welcomeMessage }), exampleQuestions && exampleQuestions.length > 0 && (jsxs("div", { className: styles.exampleQuestionsContainer, children: [jsx("p", { className: styles.exampleQuestionsTitle, children: exampleQuestionsTitle }), exampleQuestions.map((question, index) => (jsx("button", { onClick: () => handleExampleClick(question), className: styles.exampleButton, children: question }, index)))] }))] })) : (
|
|
170
170
|
// Messages
|
|
171
|
-
jsx(Fragment, { children: messages.map((message) => (jsx("div", { className: `${styles.messageWrapper} ${styles[message.role]}`, children: jsx("div", { className: `${styles.message} ${styles[message.role]}`, children: message.role === 'assistant' ? (
|
|
172
|
-
? message.parts.map((part, index) => renderMessagePart(part, index))
|
|
173
|
-
: renderMessagePart({ type: 'text', text: '', state: 'streaming' }, 0) /* Empty message fallback */ })) : (jsx("div", { className: styles.messageText, children: message.parts
|
|
171
|
+
jsx(Fragment, { children: messages.map((message, index) => (jsx("div", { className: `${styles.messageWrapper} ${styles[message.role]}`, children: jsx("div", { className: `${styles.message} ${styles[message.role]}`, children: message.role === 'assistant' ? (jsxs("div", { className: styles.markdown, children: [message.parts.map((part, index) => renderMessagePart(part, index)), isStreaming && index === messages.length - 1 && jsx("span", { className: styles.cursor })] })) : (jsx("div", { className: styles.messageText, children: message.parts
|
|
174
172
|
.filter(part => part.type === 'text')
|
|
175
173
|
.map(part => part.type === 'text' ? part.text : '')
|
|
176
174
|
.join('') })) }) }, message.id))) })), error && (jsx("div", { className: styles.error, children: error.message }))] }), jsx("form", { onSubmit: handleSubmit, className: styles.inputForm, children: jsxs("div", { className: styles.inputWrapper, children: [jsx("textarea", { ref: textareaRef, value: input, onChange: handleInputChange, onKeyDown: handleKeyDown, placeholder: inputPlaceholder, className: styles.input, rows: 1 }), jsx("button", { type: "submit", disabled: !input.trim() || isStreaming, className: styles.submitButton, children: jsx(ArrowUp, {}) })] }) })] }));
|
package/dist/esm/ask-ai.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ask-ai.js","sources":["../../src/components/chat/ChatContainer.tsx"],"sourcesContent":["import * as React from 'react';\nimport ReactMarkdown from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport rehypeHighlight from 'rehype-highlight';\nimport { common } from 'lowlight';\nimport type { WidgetTexts, UIMessage } from '../../core/types/index.js';\nimport styles from './ChatContainer.module.css';\nimport { ArrowUp, Copy, Check } from 'lucide-react';\nimport type { DynamicToolUIPart, ToolUIPart, UIDataTypes, UIMessagePart, UITools } from 'ai';\n\ninterface ChatContainerProps {\n texts?: WidgetTexts;\n exampleQuestions?: string[];\n onMessage?: (message: any) => void;\n onError?: (error: Error) => void;\n // Lifted state from parent\n messages: UIMessage[];\n isStreaming: boolean;\n error: Error | null;\n sendMessage: (text: string) => Promise<void>;\n input: string;\n setInput: React.Dispatch<React.SetStateAction<string>>;\n}\n\nexport function ChatContainer({\n texts,\n exampleQuestions,\n onMessage,\n onError,\n messages,\n isStreaming,\n error,\n sendMessage,\n input,\n setInput,\n}: ChatContainerProps) {\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const messagesAreaRef = React.useRef<HTMLDivElement>(null);\n const shouldAutoScrollRef = React.useRef(true); // Track if auto-scroll is enabled\n\n // Check if user is at the bottom of the messages area\n const isAtBottom = React.useCallback(() => {\n const messagesArea = messagesAreaRef.current;\n if (!messagesArea) return true;\n\n const threshold = 50; // pixels from bottom to consider \"at bottom\"\n const scrollBottom = messagesArea.scrollHeight - messagesArea.scrollTop - messagesArea.clientHeight;\n return scrollBottom < threshold;\n }, []);\n\n // Scroll to bottom of messages area\n const scrollToBottom = React.useCallback(() => {\n const messagesArea = messagesAreaRef.current;\n if (messagesArea) {\n messagesArea.scrollTop = messagesArea.scrollHeight;\n }\n }, []);\n\n // Handle user scroll events\n const handleScroll = React.useCallback(() => {\n const atBottom = isAtBottom();\n shouldAutoScrollRef.current = atBottom;\n }, [isAtBottom]);\n\n // Auto-scroll when messages change (if enabled)\n React.useEffect(() => {\n if (shouldAutoScrollRef.current) {\n scrollToBottom();\n }\n }, [messages, scrollToBottom]);\n\n // Auto-resize textarea based on content\n const adjustTextareaHeight = React.useCallback(() => {\n const textarea = textareaRef.current;\n if (textarea) {\n textarea.style.height = 'auto';\n textarea.style.height = `${textarea.scrollHeight}px`;\n }\n }, []);\n\n // Call onError callback when error occurs\n React.useEffect(() => {\n if (error && onError) {\n onError(error);\n }\n }, [error, onError]);\n\n // Call onMessage callback when new message arrives\n React.useEffect(() => {\n if (messages.length > 0 && onMessage) {\n onMessage(messages[messages.length - 1]);\n }\n }, [messages, onMessage]);\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n const inputValue = input.trim();\n if (!inputValue || isStreaming) return;\n\n // Enable auto-scroll for new user message\n shouldAutoScrollRef.current = true;\n\n setInput('');\n await sendMessage(inputValue);\n // Reset textarea height after submission\n setTimeout(() => {\n if (textareaRef.current) {\n textareaRef.current.style.height = 'auto';\n }\n }, 0);\n };\n\n const handleInputChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setInput(e.target.value);\n adjustTextareaHeight();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n // Submit on Enter (without Shift)\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n if (input.trim() && !isStreaming) {\n handleSubmit(e as any);\n }\n }\n // Allow Shift+Enter for new line (default textarea behavior)\n };\n\n const handleExampleClick = async (question: string) => {\n if (isStreaming) return;\n // Enable auto-scroll for new user message\n shouldAutoScrollRef.current = true;\n await sendMessage(question);\n };\n\n const inputPlaceholder = texts?.inputPlaceholder || 'Ask a question...';\n const welcomeMessage = texts?.welcomeMessage || 'Hi! How can I help you today?';\n const exampleQuestionsTitle = texts?.exampleQuestionsTitle || 'Example questions:';\n\n // Custom code block component with copy button\n const CodeBlock = ({ children, className, ...props }: any) => {\n const [copied, setCopied] = React.useState(false);\n const match = /language-(\\w+)/.exec(className || '');\n const isCodeBlock = match;\n\n const handleCopy = async () => {\n // Recursively extract text content from React elements\n const getTextContent = (node: any): string => {\n if (typeof node === 'string') return node;\n if (typeof node === 'number') return String(node);\n if (Array.isArray(node)) return node.map(getTextContent).join('');\n if (node?.props?.children) return getTextContent(node.props.children);\n return '';\n };\n\n const code = getTextContent(children).replace(/\\n$/, '');\n try {\n await navigator.clipboard.writeText(code);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n } catch (err) {\n console.error('Failed to copy:', err);\n }\n };\n\n if (isCodeBlock) {\n return (\n <div className={styles.codeBlockWrapper}>\n <button\n onClick={handleCopy}\n className={styles.copyButton}\n aria-label=\"Copy code\"\n >\n {copied ? <Check size={14} /> : <Copy size={14} />}\n </button>\n <code className={className} {...props}>\n {children}\n </code>\n </div>\n );\n }\n\n return <code className={className} {...props}>{children}</code>;\n };\n\n // Helper function to format tool name\n const getToolDisplayName = (toolName: string) => {\n if (toolName.toLowerCase() === 'readFile') {\n return 'Reading docs';\n }\n if (toolName.toLowerCase() === 'bash') {\n return 'Exploring docs';\n }\n return 'Searching docs';\n };\n\n // Render a single message part\n const renderMessagePart = (part: UIMessagePart<UIDataTypes, UITools>, index: number) => {\n if (part.type === 'text') {\n return (\n <div key={index} className={styles.textPart}>\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n rehypePlugins={[[rehypeHighlight, {\n languages: common,\n prefix: 'hljs-'\n }]]}\n components={{\n code: CodeBlock\n }}\n >\n {part.text}\n </ReactMarkdown>\n {part.state === 'streaming' && (\n <span className={styles.cursor} />\n )}\n </div>\n );\n }\n\n if (part.type === 'reasoning') {\n return (\n <div key={index} className={styles.reasoningPart}>\n <div className={styles.reasoningLabel}>Reasoning:</div>\n <div className={styles.reasoningContent}>\n {part.text}\n {part.state === 'streaming' && (\n <span className={styles.cursor} />\n )}\n </div>\n </div>\n );\n }\n\n if (isToolUIPart(part)) {\n const status = part.state === 'output-available' ? 'completed' :\n part.state === 'output-error' ? 'error' :\n part.state === 'input-streaming' ? 'running' : 'pending';\n\n return (\n <div key={index} className={styles.toolPart}>\n <span className={`${styles.toolCall} ${styles[`tool-${status}`]}`}>\n {getToolDisplayName(part.type === 'dynamic-tool' ? part.toolName : part.type.replace('tool-', ''))}\n {(status === 'completed' || status === 'error') ? '' : '...'}\n </span>\n </div>\n );\n }\n\n // Handle other part types if needed\n return null;\n };\n\n return (\n <div className={styles.container}>\n {/* Messages Area */}\n <div\n ref={messagesAreaRef}\n onScroll={handleScroll}\n className={styles.messagesArea}\n >\n {messages.length === 0 ? (\n // Welcome Screen\n <div className={styles.welcomeScreen}>\n <p className={styles.welcomeMessage}>\n {welcomeMessage}\n </p>\n\n {exampleQuestions && exampleQuestions.length > 0 && (\n <div className={styles.exampleQuestionsContainer}>\n <p className={styles.exampleQuestionsTitle}>\n {exampleQuestionsTitle}\n </p>\n {exampleQuestions.map((question, index) => (\n <button\n key={index}\n onClick={() => handleExampleClick(question)}\n className={styles.exampleButton}\n >\n {question}\n </button>\n ))}\n </div>\n )}\n </div>\n ) : (\n // Messages\n <>\n {messages.map((message) => (\n <div\n key={message.id}\n className={`${styles.messageWrapper} ${styles[message.role]}`}\n >\n <div className={`${styles.message} ${styles[message.role]}`}>\n {message.role === 'assistant' ? (\n <div className={styles.markdown}>\n {/* Render each part in order */}\n {message.parts.length > 0\n ? message.parts.map((part, index) => renderMessagePart(part, index))\n : renderMessagePart({ type: 'text', text: '', state: 'streaming' }, 0) /* Empty message fallback */}\n </div>\n ) : (\n <div className={styles.messageText}>\n {/* For user messages, extract and display text */}\n {message.parts\n .filter(part => part.type === 'text')\n .map(part => part.type === 'text' ? part.text : '')\n .join('')}\n </div>\n )}\n </div>\n </div>\n ))}\n </>\n )}\n\n {error && (\n <div className={styles.error}>\n {error.message}\n </div>\n )}\n </div>\n\n {/* Input Area */}\n <form onSubmit={handleSubmit} className={styles.inputForm}>\n <div className={styles.inputWrapper}>\n <textarea\n ref={textareaRef}\n value={input}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n placeholder={inputPlaceholder}\n className={styles.input}\n rows={1}\n />\n <button\n type=\"submit\"\n disabled={!input.trim() || isStreaming}\n className={styles.submitButton}\n >\n <ArrowUp />\n </button>\n </div>\n </form>\n </div>\n );\n}\n\nfunction isToolUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is DynamicToolUIPart | ToolUIPart {\n return part.type === 'dynamic-tool' || part.type.startsWith('tool-');\n}"],"names":["_jsxs","_jsx","_Fragment"],"mappings":";;;;;;;;;;AAwBM,SAAU,aAAa,CAAC,EAC5B,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,OAAO,EACP,QAAQ,EACR,WAAW,EACX,KAAK,EACL,WAAW,EACX,KAAK,EACL,QAAQ,GACW,EAAA;IACnB,MAAM,WA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C,KAAK,EACvB,IAAI,EAAE,CAAC,EAAA,CACP,EACFA,GAAA,CAAA,QAAA,EAAA,EACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,WAAW,EACtC,SAAS,EAAE,MAAM,CAAC,YAAY,EAAA,QAAA,EAE9BA,GAAA,CAAC,OAAO,EAAA,EAAA,CAAG,EAAA,CACJ,CAAA,EAAA,CACL,EAAA,CACD,CAAA,EAAA,CACH;AAEV;AAEA,SAAS,YAAY,CAAC,IAAyC,EAAA;AAC7D,IAAA,OAAO,IAAI,CAAC,IAAI,KAAK,cAAc,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;AACtE;;;;"}
|
|
1
|
+
{"version":3,"file":"ask-ai.js","sources":["../../src/components/chat/ChatContainer.tsx"],"sourcesContent":["import * as React from 'react';\nimport ReactMarkdown from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport rehypeHighlight from 'rehype-highlight';\nimport { common } from 'lowlight';\nimport type { WidgetTexts, UIMessage } from '../../core/types/index.js';\nimport styles from './ChatContainer.module.css';\nimport { ArrowUp, Copy, Check } from 'lucide-react';\nimport type { DynamicToolUIPart, ToolUIPart, UIDataTypes, UIMessagePart, UITools } from 'ai';\n\ninterface ChatContainerProps {\n texts?: WidgetTexts;\n exampleQuestions?: string[];\n onMessage?: (message: any) => void;\n onError?: (error: Error) => void;\n // Lifted state from parent\n messages: UIMessage[];\n isStreaming: boolean;\n error: Error | null;\n sendMessage: (text: string) => Promise<void>;\n input: string;\n setInput: React.Dispatch<React.SetStateAction<string>>;\n}\n\nexport function ChatContainer({\n texts,\n exampleQuestions,\n onMessage,\n onError,\n messages,\n isStreaming,\n error,\n sendMessage,\n input,\n setInput,\n}: ChatContainerProps) {\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const messagesAreaRef = React.useRef<HTMLDivElement>(null);\n const shouldAutoScrollRef = React.useRef(true); // Track if auto-scroll is enabled\n\n // Check if user is at the bottom of the messages area\n const isAtBottom = React.useCallback(() => {\n const messagesArea = messagesAreaRef.current;\n if (!messagesArea) return true;\n\n const threshold = 50; // pixels from bottom to consider \"at bottom\"\n const scrollBottom = messagesArea.scrollHeight - messagesArea.scrollTop - messagesArea.clientHeight;\n return scrollBottom < threshold;\n }, []);\n\n // Scroll to bottom of messages area\n const scrollToBottom = React.useCallback(() => {\n const messagesArea = messagesAreaRef.current;\n if (messagesArea) {\n messagesArea.scrollTop = messagesArea.scrollHeight;\n }\n }, []);\n\n // Handle user scroll events\n const handleScroll = React.useCallback(() => {\n const atBottom = isAtBottom();\n shouldAutoScrollRef.current = atBottom;\n }, [isAtBottom]);\n\n // Auto-scroll when messages change (if enabled)\n React.useEffect(() => {\n if (shouldAutoScrollRef.current) {\n scrollToBottom();\n }\n }, [messages, scrollToBottom]);\n\n // Auto-resize textarea based on content\n const adjustTextareaHeight = React.useCallback(() => {\n const textarea = textareaRef.current;\n if (textarea) {\n textarea.style.height = 'auto';\n textarea.style.height = `${textarea.scrollHeight}px`;\n }\n }, []);\n\n // Call onError callback when error occurs\n React.useEffect(() => {\n if (error && onError) {\n onError(error);\n }\n }, [error, onError]);\n\n // Call onMessage callback when new message arrives\n React.useEffect(() => {\n if (messages.length > 0 && onMessage) {\n onMessage(messages[messages.length - 1]);\n }\n }, [messages, onMessage]);\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n const inputValue = input.trim();\n if (!inputValue || isStreaming) return;\n\n // Enable auto-scroll for new user message\n shouldAutoScrollRef.current = true;\n\n setInput('');\n await sendMessage(inputValue);\n // Reset textarea height after submission\n setTimeout(() => {\n if (textareaRef.current) {\n textareaRef.current.style.height = 'auto';\n }\n }, 0);\n };\n\n const handleInputChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setInput(e.target.value);\n adjustTextareaHeight();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n // Submit on Enter (without Shift)\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n if (input.trim() && !isStreaming) {\n handleSubmit(e as any);\n }\n }\n // Allow Shift+Enter for new line (default textarea behavior)\n };\n\n const handleExampleClick = async (question: string) => {\n if (isStreaming) return;\n // Enable auto-scroll for new user message\n shouldAutoScrollRef.current = true;\n await sendMessage(question);\n };\n\n const inputPlaceholder = texts?.inputPlaceholder || 'Ask a question...';\n const welcomeMessage = texts?.welcomeMessage || 'Hi! How can I help you today?';\n const exampleQuestionsTitle = texts?.exampleQuestionsTitle || 'Example questions:';\n\n // Custom code block component with copy button\n const CodeBlock = ({ children, className, ...props }: any) => {\n const [copied, setCopied] = React.useState(false);\n const match = /language-(\\w+)/.exec(className || '');\n const isCodeBlock = match;\n\n const handleCopy = async () => {\n // Recursively extract text content from React elements\n const getTextContent = (node: any): string => {\n if (typeof node === 'string') return node;\n if (typeof node === 'number') return String(node);\n if (Array.isArray(node)) return node.map(getTextContent).join('');\n if (node?.props?.children) return getTextContent(node.props.children);\n return '';\n };\n\n const code = getTextContent(children).replace(/\\n$/, '');\n try {\n await navigator.clipboard.writeText(code);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n } catch (err) {\n console.error('Failed to copy:', err);\n }\n };\n\n if (isCodeBlock) {\n return (\n <div className={styles.codeBlockWrapper}>\n <button\n onClick={handleCopy}\n className={styles.copyButton}\n aria-label=\"Copy code\"\n >\n {copied ? <Check size={14} /> : <Copy size={14} />}\n </button>\n <code className={className} {...props}>\n {children}\n </code>\n </div>\n );\n }\n\n return <code className={className} {...props}>{children}</code>;\n };\n\n // Helper function to format tool name\n const getToolDisplayName = (toolName: string) => {\n if (toolName.toLowerCase() === 'readFile') {\n return 'Reading docs';\n }\n if (toolName.toLowerCase() === 'bash') {\n return 'Exploring docs';\n }\n return 'Searching docs';\n };\n\n // Render a single message part\n const renderMessagePart = (part: UIMessagePart<UIDataTypes, UITools>, index: number) => {\n if (part.type === 'text') {\n return (\n <div key={index} className={styles.textPart}>\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n rehypePlugins={[[rehypeHighlight, {\n languages: common,\n prefix: 'hljs-'\n }]]}\n components={{\n code: CodeBlock\n }}\n >\n {part.text}\n </ReactMarkdown>\n </div>\n );\n }\n\n if (part.type === 'reasoning') {\n return (\n <div key={index} className={`${styles.reasoningPart} ${styles[`reasoning-${part.state}`]}`}>\n <div className={styles.reasoningLabel}>Thinking...</div>\n <div className={styles.reasoningContent}>\n {part.text}\n </div>\n </div>\n );\n }\n\n if (isToolUIPart(part)) {\n const status = part.state === 'output-available' ? 'completed' :\n part.state === 'output-error' ? 'error' :\n part.state === 'input-streaming' ? 'running' : 'pending';\n\n return (\n <div key={index} className={styles.toolPart}>\n <span className={`${styles.toolCall} ${styles[`tool-${status}`]}`}>\n {getToolDisplayName(part.type === 'dynamic-tool' ? part.toolName : part.type.replace('tool-', ''))}\n {(status === 'completed' || status === 'error') ? '' : '...'}\n </span>\n </div>\n );\n }\n\n // Handle other part types if needed\n return null;\n };\n\n return (\n <div className={styles.container}>\n {/* Messages Area */}\n <div\n ref={messagesAreaRef}\n onScroll={handleScroll}\n className={styles.messagesArea}\n >\n {messages.length === 0 ? (\n // Welcome Screen\n <div className={styles.welcomeScreen}>\n <p className={styles.welcomeMessage}>\n {welcomeMessage}\n </p>\n\n {exampleQuestions && exampleQuestions.length > 0 && (\n <div className={styles.exampleQuestionsContainer}>\n <p className={styles.exampleQuestionsTitle}>\n {exampleQuestionsTitle}\n </p>\n {exampleQuestions.map((question, index) => (\n <button\n key={index}\n onClick={() => handleExampleClick(question)}\n className={styles.exampleButton}\n >\n {question}\n </button>\n ))}\n </div>\n )}\n </div>\n ) : (\n // Messages\n <>\n {messages.map((message, index) => (\n <div\n key={message.id}\n className={`${styles.messageWrapper} ${styles[message.role]}`}\n >\n <div className={`${styles.message} ${styles[message.role]}`}>\n {message.role === 'assistant' ? (\n <div className={styles.markdown}>\n {/* Render each part in order */}\n {message.parts.map((part, index) => renderMessagePart(part, index))}\n {isStreaming && index === messages.length -1 && <span className={styles.cursor} />}\n </div>\n ) : (\n <div className={styles.messageText}>\n {/* For user messages, extract and display text */}\n {message.parts\n .filter(part => part.type === 'text')\n .map(part => part.type === 'text' ? part.text : '')\n .join('')}\n </div>\n )}\n </div>\n </div>\n ))}\n </>\n )}\n\n {error && (\n <div className={styles.error}>\n {error.message}\n </div>\n )}\n </div>\n\n {/* Input Area */}\n <form onSubmit={handleSubmit} className={styles.inputForm}>\n <div className={styles.inputWrapper}>\n <textarea\n ref={textareaRef}\n value={input}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n placeholder={inputPlaceholder}\n className={styles.input}\n rows={1}\n />\n <button\n type=\"submit\"\n disabled={!input.trim() || isStreaming}\n className={styles.submitButton}\n >\n <ArrowUp />\n </button>\n </div>\n </form>\n </div>\n );\n}\n\nfunction isToolUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is DynamicToolUIPart | ToolUIPart {\n return part.type === 'dynamic-tool' || part.type.startsWith('tool-');\n}"],"names":["_jsxs","_jsx","_Fragment"],"mappings":";;;;;;;;;;AAwBM,SAAU,aAAa,CAAC,EAC5B,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,OAAO,EACP,QAAQ,EACR,WAAW,EACX,KAAK,EACL,WAAW,EACX,KAAK,EACL,QAAQ,GACW,EAAA;IACnB,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAsB,IAAI,CAAC;IAC3D,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC;IAC1D,MAAM,mBAAmB,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;;AAG/C,IAAA,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,MAAK;AACxC,QAAA,MAAM,YAAY,GAAG,eAAe,CAAC,OAAO;AAC5C,QAAA,IAAI,CAAC,YAAY;AAAE,YAAA,OAAO,IAAI;AAE9B,QAAA,MAAM,SAAS,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
@@ -124,25 +124,23 @@
|
|
|
124
124
|
|
|
125
125
|
.reasoningPart_JD-Cg {
|
|
126
126
|
margin: 12px 0;
|
|
127
|
-
padding:
|
|
128
|
-
|
|
129
|
-
border-radius: var(--ask-ai-radius-md);
|
|
130
|
-
border-left: 3px solid var(--ask-ai-primary);
|
|
127
|
+
padding: 8px 0 8px 16px;
|
|
128
|
+
border-left: 2px solid var(--ask-ai-border);
|
|
131
129
|
}
|
|
132
130
|
|
|
133
131
|
.reasoningLabel_Qbv7v {
|
|
134
132
|
font-size: 12px;
|
|
135
|
-
font-weight:
|
|
136
|
-
color: var(--ask-ai-
|
|
137
|
-
margin-bottom:
|
|
138
|
-
|
|
139
|
-
letter-spacing: 0.5px;
|
|
133
|
+
font-weight: 500;
|
|
134
|
+
color: var(--ask-ai-muted);
|
|
135
|
+
margin-bottom: 4px;
|
|
136
|
+
opacity: 0.8;
|
|
140
137
|
}
|
|
141
138
|
|
|
142
139
|
.reasoningContent_pBYq2 {
|
|
143
140
|
font-size: 13px;
|
|
144
141
|
color: var(--ask-ai-muted);
|
|
145
142
|
line-height: 1.6;
|
|
143
|
+
opacity: 0.7;
|
|
146
144
|
}
|
|
147
145
|
|
|
148
146
|
.toolPart_jy7Rq {
|
|
@@ -173,6 +171,7 @@
|
|
|
173
171
|
opacity: 0.7;
|
|
174
172
|
}
|
|
175
173
|
|
|
174
|
+
.reasoning-streaming_gj-ZD,
|
|
176
175
|
.toolCall_gEKn0.tool-pending_hifHC,
|
|
177
176
|
.toolCall_gEKn0.tool-running_D0dCg {
|
|
178
177
|
animation: pulse_STM-e 1.5s ease-in-out infinite;
|