open-ask-ai 0.3.4 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,158 @@
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import ReactMarkdown from 'react-markdown';
4
+ import remarkGfm from 'remark-gfm';
5
+ import rehypeHighlight from 'rehype-highlight';
6
+ import { common } from 'lowlight';
7
+ import { ArrowUp, Check, Copy } from 'lucide-react';
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","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"};
10
+
11
+ function ChatContainer({ texts, exampleQuestions, onMessage, onError, messages, isStreaming, error, sendMessage, input, setInput, }) {
12
+ const textareaRef = React.useRef(null);
13
+ const messagesAreaRef = React.useRef(null);
14
+ const shouldAutoScrollRef = React.useRef(true); // Track if auto-scroll is enabled
15
+ // Check if user is at the bottom of the messages area
16
+ const isAtBottom = React.useCallback(() => {
17
+ const messagesArea = messagesAreaRef.current;
18
+ if (!messagesArea)
19
+ return true;
20
+ const threshold = 50; // pixels from bottom to consider "at bottom"
21
+ const scrollBottom = messagesArea.scrollHeight - messagesArea.scrollTop - messagesArea.clientHeight;
22
+ return scrollBottom < threshold;
23
+ }, []);
24
+ // Scroll to bottom of messages area
25
+ const scrollToBottom = React.useCallback(() => {
26
+ const messagesArea = messagesAreaRef.current;
27
+ if (messagesArea) {
28
+ messagesArea.scrollTop = messagesArea.scrollHeight;
29
+ }
30
+ }, []);
31
+ // Handle user scroll events
32
+ const handleScroll = React.useCallback(() => {
33
+ const atBottom = isAtBottom();
34
+ shouldAutoScrollRef.current = atBottom;
35
+ }, [isAtBottom]);
36
+ // Auto-scroll when messages change (if enabled)
37
+ React.useEffect(() => {
38
+ if (shouldAutoScrollRef.current) {
39
+ scrollToBottom();
40
+ }
41
+ }, [messages, scrollToBottom]);
42
+ // Auto-resize textarea based on content
43
+ const adjustTextareaHeight = React.useCallback(() => {
44
+ const textarea = textareaRef.current;
45
+ if (textarea) {
46
+ textarea.style.height = 'auto';
47
+ textarea.style.height = `${textarea.scrollHeight}px`;
48
+ }
49
+ }, []);
50
+ // Call onError callback when error occurs
51
+ React.useEffect(() => {
52
+ if (error && onError) {
53
+ onError(error);
54
+ }
55
+ }, [error, onError]);
56
+ // Call onMessage callback when new message arrives
57
+ React.useEffect(() => {
58
+ if (messages.length > 0 && onMessage) {
59
+ onMessage(messages[messages.length - 1]);
60
+ }
61
+ }, [messages, onMessage]);
62
+ const handleSubmit = async (e) => {
63
+ e.preventDefault();
64
+ const inputValue = input.trim();
65
+ if (!inputValue || isStreaming)
66
+ return;
67
+ // Enable auto-scroll for new user message
68
+ shouldAutoScrollRef.current = true;
69
+ setInput('');
70
+ await sendMessage(inputValue);
71
+ // Reset textarea height after submission
72
+ setTimeout(() => {
73
+ if (textareaRef.current) {
74
+ textareaRef.current.style.height = 'auto';
75
+ }
76
+ }, 0);
77
+ };
78
+ const handleInputChange = (e) => {
79
+ setInput(e.target.value);
80
+ adjustTextareaHeight();
81
+ };
82
+ const handleKeyDown = (e) => {
83
+ // Submit on Enter (without Shift)
84
+ if (e.key === 'Enter' && !e.shiftKey) {
85
+ e.preventDefault();
86
+ if (input.trim() && !isStreaming) {
87
+ handleSubmit(e);
88
+ }
89
+ }
90
+ // Allow Shift+Enter for new line (default textarea behavior)
91
+ };
92
+ const handleExampleClick = async (question) => {
93
+ if (isStreaming)
94
+ return;
95
+ // Enable auto-scroll for new user message
96
+ shouldAutoScrollRef.current = true;
97
+ await sendMessage(question);
98
+ };
99
+ const inputPlaceholder = texts?.inputPlaceholder || 'Ask a question...';
100
+ const welcomeMessage = texts?.welcomeMessage || 'Hi! How can I help you today?';
101
+ const exampleQuestionsTitle = texts?.exampleQuestionsTitle || 'Example questions:';
102
+ // Custom code block component with copy button
103
+ const CodeBlock = ({ children, className, ...props }) => {
104
+ const [copied, setCopied] = React.useState(false);
105
+ const match = /language-(\w+)/.exec(className || '');
106
+ const isCodeBlock = match;
107
+ const handleCopy = async () => {
108
+ // Recursively extract text content from React elements
109
+ const getTextContent = (node) => {
110
+ if (typeof node === 'string')
111
+ return node;
112
+ if (typeof node === 'number')
113
+ return String(node);
114
+ if (Array.isArray(node))
115
+ return node.map(getTextContent).join('');
116
+ if (node?.props?.children)
117
+ return getTextContent(node.props.children);
118
+ return '';
119
+ };
120
+ const code = getTextContent(children).replace(/\n$/, '');
121
+ try {
122
+ await navigator.clipboard.writeText(code);
123
+ setCopied(true);
124
+ setTimeout(() => setCopied(false), 2000);
125
+ }
126
+ catch (err) {
127
+ console.error('Failed to copy:', err);
128
+ }
129
+ };
130
+ if (isCodeBlock) {
131
+ return (jsxs("div", { className: styles.codeBlockWrapper, children: [jsx("button", { onClick: handleCopy, className: styles.copyButton, "aria-label": "Copy code", children: copied ? jsx(Check, { size: 14 }) : jsx(Copy, { size: 14 }) }), jsx("code", { className: className, ...props, children: children })] }));
132
+ }
133
+ return jsx("code", { className: className, ...props, children: children });
134
+ };
135
+ // Helper function to format tool name
136
+ const getToolDisplayName = (toolName) => {
137
+ if (toolName.toLowerCase() === 'read') {
138
+ return 'Reading docs';
139
+ }
140
+ if (toolName.toLowerCase() === 'task') {
141
+ return 'Exploring docs';
142
+ }
143
+ return 'Searching docs';
144
+ };
145
+ return (jsxs("div", { className: styles.container, children: [jsxs("div", { ref: messagesAreaRef, onScroll: handleScroll, className: styles.messagesArea, children: [messages.length === 0 ? (
146
+ // Welcome Screen
147
+ 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)))] }))] })) : (
148
+ // Messages
149
+ 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' ? (jsxs("div", { className: styles.markdown, children: [message.toolCalls && message.toolCalls.length > 0 && (jsx("div", { className: styles.toolCallsContainer, children: message.toolCalls.map((toolCall) => (jsxs("span", { className: `${styles.toolCall} ${styles[`tool-${toolCall.status}`]}`, children: [getToolDisplayName(toolCall.tool), (toolCall.status === 'completed' || toolCall.status === 'error') ? '' : '...'] }, toolCall.callID))) })), jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [[rehypeHighlight, {
150
+ languages: common,
151
+ prefix: 'hljs-'
152
+ }]], components: {
153
+ code: CodeBlock
154
+ }, children: message.content }), message.isStreaming && (jsx("span", { className: styles.cursor }))] })) : (jsx("div", { className: styles.messageText, children: message.content })) }) }, 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, {}) })] }) })] }));
155
+ }
156
+
157
+ export { ChatContainer };
158
+ //# sourceMappingURL=ask-ai.js.map
@@ -0,0 +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, Message } from '../../core/types/index.js';\nimport styles from './ChatContainer.module.css';\nimport { ArrowUp, Copy, Check } from 'lucide-react';\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: Message[];\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() === 'read') {\n return 'Reading docs';\n }\n if (toolName.toLowerCase() === 'task') {\n return 'Exploring docs';\n }\n return 'Searching docs';\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 {/* Display tool calls if present */}\n {message.toolCalls && message.toolCalls.length > 0 && (\n <div className={styles.toolCallsContainer}>\n {message.toolCalls.map((toolCall) => (\n <span\n key={toolCall.callID}\n className={`${styles.toolCall} ${styles[`tool-${toolCall.status}`]}`}\n >\n {getToolDisplayName(toolCall.tool)}\n {(toolCall.status === 'completed' || toolCall.status === 'error') ? '' : '...'}\n </span>\n ))}\n </div>\n )}\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n rehypePlugins={[[rehypeHighlight, {\n languages: common,\n prefix: 'hljs-'\n }]]}\n components={{\n code: CodeBlock\n }}\n >\n {message.content}\n </ReactMarkdown>\n {message.isStreaming && (\n <span className={styles.cursor} />\n )}\n </div>\n ) : (\n <div className={styles.messageText}>\n {message.content}\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"],"names":["_jsxs","_jsx","_Fragment"],"mappings":";;;;;;;;;;AAuBM,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,MAA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