@rimori/react-client 0.4.13-next.1 → 0.4.13
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.
|
@@ -133,5 +133,5 @@ export const AudioPlayer = ({ text, voice, language, hide, playListenerEvent, in
|
|
|
133
133
|
return (_jsx("div", { className: "group relative", children: _jsxs("div", { className: "flex flex-row items-end", children: [!hide && (_jsx("button", { className: "text-gray-400", onClick: togglePlayback, disabled: isLoading, children: isLoading ? (_jsx(Spinner, { size: size })) : isPlaying ? (_jsx(FaStopCircle, { size: size })) : (_jsx(FaPlayCircle, { size: size })) })), enableSpeedAdjustment && (_jsxs("div", { className: "ml-1 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-row text-sm text-gray-500", children: [_jsx("span", { className: "pr-1", children: "Speed: " }), _jsx("select", { value: speed, className: "appearance-none cursor-pointer pr-0 p-0 rounded shadow leading-tight focus:outline-none focus:bg-gray-800 focus:ring bg-transparent border-0", onChange: (e) => setSpeed(parseFloat(e.target.value)), disabled: isLoading, children: AudioPlayOptions.map((s) => (_jsx("option", { value: s, children: s }, s))) })] }))] }) }));
|
|
134
134
|
};
|
|
135
135
|
const Spinner = ({ text, className, size = '30px' }) => {
|
|
136
|
-
return (_jsxs("div", { className: 'flex items-center space-x-2
|
|
136
|
+
return (_jsxs("div", { className: 'flex items-center space-x-2 ' + className, children: [_jsxs("svg", { style: { width: size, height: size }, className: "animate-spin -ml-1 mr-3 h-5 w-5 text-white", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), text && _jsx("span", { className: "", children: text })] }));
|
|
137
137
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rimori/react-client",
|
|
3
|
-
"version": "0.4.13
|
|
3
|
+
"version": "0.4.13",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"format": "prettier --write ."
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@rimori/client": "2.5.24
|
|
28
|
+
"@rimori/client": "^2.5.24",
|
|
29
29
|
"react": "^18.1.0",
|
|
30
30
|
"react-dom": "^18.1.0"
|
|
31
31
|
},
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@eslint/js": "^9.37.0",
|
|
52
|
-
"@rimori/client": "2.5.24
|
|
52
|
+
"@rimori/client": "^2.5.24",
|
|
53
53
|
"@types/react": "^18.3.21",
|
|
54
54
|
"eslint-config-prettier": "^10.1.8",
|
|
55
55
|
"eslint-plugin-prettier": "^5.5.4",
|
|
@@ -58,17 +58,9 @@ export const AudioPlayer: React.FC<AudioPlayerProps> = ({
|
|
|
58
58
|
const generateAudio = async () => {
|
|
59
59
|
setIsLoading(true);
|
|
60
60
|
|
|
61
|
-
const effectiveInstructions =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const blob = await ai.getVoice(
|
|
65
|
-
text,
|
|
66
|
-
voice || (language ? 'aws_default' : 'openai_alloy'),
|
|
67
|
-
1,
|
|
68
|
-
language,
|
|
69
|
-
cache,
|
|
70
|
-
effectiveInstructions,
|
|
71
|
-
);
|
|
61
|
+
const effectiveInstructions = ttsInstructions
|
|
62
|
+
?? (!disableDialect && userInfo?.dialect ? `Speak with a ${userInfo.dialect} accent and pronunciation.` : undefined);
|
|
63
|
+
const blob = await ai.getVoice(text, voice || (language ? 'aws_default' : 'openai_alloy'), 1, language, cache, effectiveInstructions);
|
|
72
64
|
setAudioUrl(URL.createObjectURL(blob));
|
|
73
65
|
setIsLoading(false);
|
|
74
66
|
};
|
|
@@ -217,10 +209,10 @@ interface SpinnerProps {
|
|
|
217
209
|
|
|
218
210
|
const Spinner = ({ text, className, size = '30px' }: SpinnerProps) => {
|
|
219
211
|
return (
|
|
220
|
-
<div className={'flex items-center space-x-2
|
|
212
|
+
<div className={'flex items-center space-x-2 ' + className}>
|
|
221
213
|
<svg
|
|
222
214
|
style={{ width: size, height: size }}
|
|
223
|
-
className="animate-spin -ml-1 h-5 w-5 text-white"
|
|
215
|
+
className="animate-spin -ml-1 mr-3 h-5 w-5 text-white"
|
|
224
216
|
xmlns="http://www.w3.org/2000/svg"
|
|
225
217
|
fill="none"
|
|
226
218
|
viewBox="0 0 24 24"
|