Introduce horoscope generation via OpenAI API, including new API endpoints and database schema. Adjust card components in `home.tsx` to use `aspect-[16/9]` for consistent image sizing, resolving previous height stretching issues. Update dependencies in `package.json`. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 413891e8-d784-4bea-b9f5-91a5a68316b4 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: ca1aa952-242c-43c1-9e28-47aed39cee1b Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/413891e8-d784-4bea-b9f5-91a5a68316b4/nTLKCC5 Replit-Helium-Checkpoint-Created: true
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
/**
|
|
* Voice chat client utilities for Replit AI Integrations.
|
|
*
|
|
* Usage:
|
|
* 1. Copy audio-playback-worklet.js to your public/ folder
|
|
* 2. Import and use the React hooks in your components
|
|
*
|
|
* Example:
|
|
* ```tsx
|
|
* import { useVoiceRecorder, useVoiceStream } from "./audio";
|
|
*
|
|
* function VoiceChat() {
|
|
* const [transcript, setTranscript] = useState("");
|
|
* const recorder = useVoiceRecorder();
|
|
* const stream = useVoiceStream({
|
|
* onTranscript: (_, full) => setTranscript(full),
|
|
* onComplete: (text) => console.log("Done:", text),
|
|
* });
|
|
*
|
|
* const handleClick = async () => {
|
|
* if (recorder.state === "recording") {
|
|
* const blob = await recorder.stopRecording();
|
|
* await stream.streamVoiceResponse("/api/voice-conversations/1/messages", blob);
|
|
* } else {
|
|
* await recorder.startRecording();
|
|
* }
|
|
* };
|
|
*
|
|
* return (
|
|
* <div>
|
|
* <button onClick={handleClick}>
|
|
* {recorder.state === "recording" ? "Stop" : "Record"}
|
|
* </button>
|
|
* <p>{transcript}</p>
|
|
* </div>
|
|
* );
|
|
* }
|
|
* ```
|
|
*/
|
|
|
|
export { decodePCM16ToFloat32, createAudioPlaybackContext } from "./audio-utils";
|
|
export { useVoiceRecorder, type RecordingState } from "./useVoiceRecorder";
|
|
export { useAudioPlayback, type PlaybackState } from "./useAudioPlayback";
|
|
export { useVoiceStream } from "./useVoiceStream";
|
|
|