Spaces:
Running
Running
success sound + fireworks-ai
Browse files- server.js +1 -1
- src/assets/success.mp3 +0 -0
- src/components/ask-ai/ask-ai.tsx +11 -4
- src/components/tabs/tabs.tsx +1 -1
server.js
CHANGED
@@ -216,7 +216,7 @@ app.post("/api/ask-ai", async (req, res) => {
|
|
216 |
try {
|
217 |
const chatCompletion = client.chatCompletionStream({
|
218 |
model: MODEL_ID,
|
219 |
-
provider: "
|
220 |
messages: [
|
221 |
{
|
222 |
role: "system",
|
|
|
216 |
try {
|
217 |
const chatCompletion = client.chatCompletionStream({
|
218 |
model: MODEL_ID,
|
219 |
+
provider: "fireworks-ai",
|
220 |
messages: [
|
221 |
{
|
222 |
role: "system",
|
src/assets/success.mp3
ADDED
Binary file (49.3 kB). View file
|
|
src/components/ask-ai/ask-ai.tsx
CHANGED
@@ -3,8 +3,10 @@ import { RiSparkling2Fill } from "react-icons/ri";
|
|
3 |
import { GrSend } from "react-icons/gr";
|
4 |
import classNames from "classnames";
|
5 |
import { toast } from "react-toastify";
|
|
|
6 |
import Login from "../login/login";
|
7 |
import { defaultHTML } from "../../utils/consts";
|
|
|
8 |
|
9 |
function AskAI({
|
10 |
html,
|
@@ -23,6 +25,8 @@ function AskAI({
|
|
23 |
const [prompt, setPrompt] = useState("");
|
24 |
const [hasAsked, setHasAsked] = useState(false);
|
25 |
const [previousPrompt, setPreviousPrompt] = useState("");
|
|
|
|
|
26 |
|
27 |
const callAi = async () => {
|
28 |
if (isAiWorking || !prompt.trim()) return;
|
@@ -65,13 +69,16 @@ function AskAI({
|
|
65 |
setPreviousPrompt(prompt);
|
66 |
setisAiWorking(false);
|
67 |
setHasAsked(true);
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
71 |
if (finalDoc) {
|
72 |
setHtml(finalDoc);
|
73 |
}
|
74 |
-
|
75 |
return;
|
76 |
}
|
77 |
|
|
|
3 |
import { GrSend } from "react-icons/gr";
|
4 |
import classNames from "classnames";
|
5 |
import { toast } from "react-toastify";
|
6 |
+
|
7 |
import Login from "../login/login";
|
8 |
import { defaultHTML } from "../../utils/consts";
|
9 |
+
import SuccessSound from "./../../assets/success.mp3";
|
10 |
|
11 |
function AskAI({
|
12 |
html,
|
|
|
25 |
const [prompt, setPrompt] = useState("");
|
26 |
const [hasAsked, setHasAsked] = useState(false);
|
27 |
const [previousPrompt, setPreviousPrompt] = useState("");
|
28 |
+
const audio = new Audio(SuccessSound);
|
29 |
+
audio.volume = 0.5;
|
30 |
|
31 |
const callAi = async () => {
|
32 |
if (isAiWorking || !prompt.trim()) return;
|
|
|
69 |
setPreviousPrompt(prompt);
|
70 |
setisAiWorking(false);
|
71 |
setHasAsked(true);
|
72 |
+
audio.play();
|
73 |
+
|
74 |
+
// Now we have the complete HTML including </html>, so set it to be sure
|
75 |
+
const finalDoc = contentResponse.match(
|
76 |
+
/<!DOCTYPE html>[\s\S]*<\/html>/
|
77 |
+
)?.[0];
|
78 |
if (finalDoc) {
|
79 |
setHtml(finalDoc);
|
80 |
}
|
81 |
+
|
82 |
return;
|
83 |
}
|
84 |
|
src/components/tabs/tabs.tsx
CHANGED
@@ -14,7 +14,7 @@ function Tabs({ children }: { children?: React.ReactNode }) {
|
|
14 |
</div>
|
15 |
<div className="flex items-center justify-end gap-3">
|
16 |
<a
|
17 |
-
href="https://huggingface.co/deepseek-ai/DeepSeek-V3-0324?inference_provider=
|
18 |
target="_blank"
|
19 |
className="text-[12px] text-gray-300 hover:brightness-120 flex items-center gap-1 font-code"
|
20 |
>
|
|
|
14 |
</div>
|
15 |
<div className="flex items-center justify-end gap-3">
|
16 |
<a
|
17 |
+
href="https://huggingface.co/deepseek-ai/DeepSeek-V3-0324?inference_provider=fireworks-ai"
|
18 |
target="_blank"
|
19 |
className="text-[12px] text-gray-300 hover:brightness-120 flex items-center gap-1 font-code"
|
20 |
>
|