Spaces:
Running
Running
Update src/App.tsx
Browse files- src/App.tsx +29 -9
src/App.tsx
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import React, { useEffect, useRef, useState } from "react";
|
| 2 |
import "./App.scss";
|
| 3 |
import { LiveAPIProvider } from "./contexts/LiveAPIContext";
|
|
@@ -7,7 +23,14 @@ import ControlTray from "./components/control-tray/ControlTray";
|
|
| 7 |
import { IOSModal } from "./components/ios-modal/IOSModal";
|
| 8 |
import { isIOS } from "./lib/platform";
|
| 9 |
import cn from "classnames";
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
function App() {
|
| 13 |
const videoRef = useRef<HTMLVideoElement>(null);
|
|
@@ -20,20 +43,17 @@ function App() {
|
|
| 20 |
}
|
| 21 |
}, []);
|
| 22 |
|
|
|
|
| 23 |
const myCustomInstruction = `
|
| 24 |
-
//
|
| 25 |
`.trim();
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
systemInstruction: {
|
| 30 |
-
parts: [{ text: myCustomInstruction }]
|
| 31 |
-
}
|
| 32 |
-
};
|
| 33 |
|
| 34 |
return (
|
| 35 |
<div className="App">
|
| 36 |
-
<LiveAPIProvider
|
| 37 |
<div className="streaming-console">
|
| 38 |
<SidePanel />
|
| 39 |
<main>
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Copyright 2024 Google LLC
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
import React, { useEffect, useRef, useState } from "react";
|
| 18 |
import "./App.scss";
|
| 19 |
import { LiveAPIProvider } from "./contexts/LiveAPIContext";
|
|
|
|
| 23 |
import { IOSModal } from "./components/ios-modal/IOSModal";
|
| 24 |
import { isIOS } from "./lib/platform";
|
| 25 |
import cn from "classnames";
|
| 26 |
+
|
| 27 |
+
// تعریف نوع برای پیکربندی اولیه
|
| 28 |
+
interface LiveConfig {
|
| 29 |
+
model: string;
|
| 30 |
+
systemInstruction: {
|
| 31 |
+
parts: Array<{ text: string }>;
|
| 32 |
+
};
|
| 33 |
+
}
|
| 34 |
|
| 35 |
function App() {
|
| 36 |
const videoRef = useRef<HTMLVideoElement>(null);
|
|
|
|
| 43 |
}
|
| 44 |
}, []);
|
| 45 |
|
| 46 |
+
// دستورالعمل شخصیسازی شده با شخصیت شوخ طبع
|
| 47 |
const myCustomInstruction = `
|
| 48 |
+
// ... [همان محتوای قبلی دستورالعمل شوخ طبع]
|
| 49 |
`.trim();
|
| 50 |
|
| 51 |
+
// اگر LiveAPIProvider از initialConfig پشتیبانی نمیکند، میتوانیم از useEffect برای تنظیمات استفاده کنیم
|
| 52 |
+
// یا اگر API دیگری دارد، از آن استفاده کنیم
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
return (
|
| 55 |
<div className="App">
|
| 56 |
+
<LiveAPIProvider>
|
| 57 |
<div className="streaming-console">
|
| 58 |
<SidePanel />
|
| 59 |
<main>
|