@sampleapp.ai/sdk 1.0.26 → 1.0.27
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/components/chat-bar.js +19 -14
- package/dist/index.d.ts +4 -4
- package/dist/index.es.js +184 -182
- package/dist/index.standalone.js +1 -3
- package/dist/index.standalone.umd.js +14 -14
- package/dist/index.umd.js +29 -29
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ const getColorScheme = (themeName, playgroundUid) => {
|
|
|
31
31
|
return DEFAULT_COLOR_SCHEME;
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
export const ChatBar = ({ placeholder = "Ask anything...", onSubmit,
|
|
34
|
+
export const ChatBar = ({ placeholder = "Ask anything...", onSubmit, playgroundUid, isSubmitting, typingTexts = [
|
|
35
35
|
"Build me an AI chatbot application using OpenAI API",
|
|
36
36
|
"Build me an ecommerce website using Stripe API",
|
|
37
37
|
"Build me a price tracking tool using AgentQL API",
|
|
@@ -40,7 +40,7 @@ export const ChatBar = ({ placeholder = "Ask anything...", onSubmit, hasPendingE
|
|
|
40
40
|
"Build me a SMS notification system using Twilio API",
|
|
41
41
|
"Build me a travel booking platform using Skyscanner API",
|
|
42
42
|
], shouldFocusOnMount = true, showModelSelector = true, projectUid, theme, height = "auto", // Add default for required height prop
|
|
43
|
-
}) => {
|
|
43
|
+
deepgramApiKey, }) => {
|
|
44
44
|
var _a;
|
|
45
45
|
const [isFocused, setIsFocused] = useState(true);
|
|
46
46
|
const [isRecording, setIsRecording] = useState(false);
|
|
@@ -144,16 +144,15 @@ export const ChatBar = ({ placeholder = "Ask anything...", onSubmit, hasPendingE
|
|
|
144
144
|
setShowVoiceOverlay(false);
|
|
145
145
|
};
|
|
146
146
|
}, [recordingTimeout, isRecording]);
|
|
147
|
-
const handleVoiceOverlayDismiss = () => {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
};
|
|
147
|
+
// const handleVoiceOverlayDismiss = () => {
|
|
148
|
+
// // Only allow dismissing during recording, not transcribing
|
|
149
|
+
// if (isTranscribing) return;
|
|
150
|
+
// if (isRecording) {
|
|
151
|
+
// // Stop recording if currently recording
|
|
152
|
+
// stopRecording();
|
|
153
|
+
// }
|
|
154
|
+
// setShowVoiceOverlay(false);
|
|
155
|
+
// };
|
|
157
156
|
const stopRecording = async () => {
|
|
158
157
|
if (mediaRecorderRef.current && isRecording) {
|
|
159
158
|
// Check minimum recording duration (1 second)
|
|
@@ -209,7 +208,11 @@ export const ChatBar = ({ placeholder = "Ask anything...", onSubmit, hasPendingE
|
|
|
209
208
|
// Send to backend for transcription
|
|
210
209
|
const formData = new FormData();
|
|
211
210
|
formData.append("audio", audioBlob, "recording.wav");
|
|
212
|
-
|
|
211
|
+
// Add Deepgram API key if provided
|
|
212
|
+
if (deepgramApiKey) {
|
|
213
|
+
formData.append("deepgramApiKey", deepgramApiKey);
|
|
214
|
+
}
|
|
215
|
+
const response = await fetch(`/api/voice/transcribe`, {
|
|
213
216
|
method: "POST",
|
|
214
217
|
body: formData,
|
|
215
218
|
});
|
|
@@ -507,6 +510,7 @@ export const ChatBar = ({ placeholder = "Ask anything...", onSubmit, hasPendingE
|
|
|
507
510
|
marginTop: "4px",
|
|
508
511
|
color: "#f4f4f5",
|
|
509
512
|
fontFamily: "inherit",
|
|
513
|
+
height: height,
|
|
510
514
|
}, value: query, onFocus: handleFocus, onBlur: handleBlur, onChange: (e) => setQuery(e.target.value), onSubmit: (e) => {
|
|
511
515
|
// Prevent submission if recording
|
|
512
516
|
if (isRecording || isTranscribing) {
|
|
@@ -535,6 +539,7 @@ export const ChatBar = ({ placeholder = "Ask anything...", onSubmit, hasPendingE
|
|
|
535
539
|
marginTop: "4px",
|
|
536
540
|
color: "#f4f4f5",
|
|
537
541
|
fontFamily: "inherit",
|
|
542
|
+
height: height,
|
|
538
543
|
}, value: query, onFocus: handleFocus, onBlur: handleBlur, onChange: (e) => setQuery(e.target.value), onKeyDown: (e) => {
|
|
539
544
|
if (e.key === "Enter") {
|
|
540
545
|
if (e.shiftKey) {
|
|
@@ -549,7 +554,7 @@ export const ChatBar = ({ placeholder = "Ask anything...", onSubmit, hasPendingE
|
|
|
549
554
|
React.createElement(Button, { style: {
|
|
550
555
|
height: "32px",
|
|
551
556
|
width: "32px",
|
|
552
|
-
}, disabled: query.length === 0 || isSubmitting
|
|
557
|
+
}, disabled: query.length === 0 || isSubmitting, variant: "secondary", onClick: handleSubmit, size: "icon" }, isSubmitting ? (React.createElement(LoaderIcon, { size: 20, style: { animation: "spin 1s linear infinite" } })) : (React.createElement(ArrowUpIcon, { style: { width: "20px", height: "20px" } }))))),
|
|
553
558
|
React.createElement("div", { style: {
|
|
554
559
|
display: "flex",
|
|
555
560
|
alignItems: "center",
|
package/dist/index.d.ts
CHANGED
|
@@ -13,15 +13,13 @@ export declare interface BaseSettings {
|
|
|
13
13
|
[key: string]: any;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export declare const ChatBar: ({ placeholder, onSubmit,
|
|
16
|
+
export declare const ChatBar: ({ placeholder, onSubmit, playgroundUid, isSubmitting, typingTexts, shouldFocusOnMount, showModelSelector, projectUid, theme, height, deepgramApiKey, }: ChatBarProps) => default_2.JSX.Element;
|
|
17
17
|
|
|
18
18
|
export declare interface ChatBarProps {
|
|
19
|
+
playgroundUid: string;
|
|
19
20
|
placeholder?: string;
|
|
20
21
|
onSubmit?: (e: default_2.FormEvent) => void;
|
|
21
22
|
height: string;
|
|
22
|
-
hasPendingEnv?: boolean;
|
|
23
|
-
playgroundUid?: string;
|
|
24
|
-
hasTypingAnimation?: boolean;
|
|
25
23
|
onCancel?: () => void;
|
|
26
24
|
isSubmitting?: boolean;
|
|
27
25
|
typingTexts?: string[];
|
|
@@ -29,6 +27,8 @@ export declare interface ChatBarProps {
|
|
|
29
27
|
showModelSelector?: boolean;
|
|
30
28
|
projectUid?: string | null | undefined;
|
|
31
29
|
theme?: ThemeName;
|
|
30
|
+
deepgramApiKey?: string;
|
|
31
|
+
apiBaseUrl?: string;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export declare const ChatButton: default_2.FC<ChatButtonProps>;
|