Compare commits
No commits in common. "d774630aeaf2e869223ea8bfb47a5ddcf3f04c12" and "86918a667e77be51670acf82db352906dd1600c5" have entirely different histories.
d774630aea
...
86918a667e
Binary file not shown.
|
Before Width: | Height: | Size: 10 KiB |
|
|
@ -1,14 +1,11 @@
|
||||||
import { Loading } from "@/components/Loading";
|
import { lazy } from "react";
|
||||||
import { lazy, Suspense } from "react";
|
|
||||||
|
|
||||||
const MainArea = lazy(() => import("@/app/MainArea/index"));
|
const MainArea = lazy(() => import("@/app/MainArea/index"));
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<div className="h-full bg-[#F4F6FA]">
|
<div className="h-full bg-[#F4F6FA]">
|
||||||
<Suspense fallback={<Loading/>}>
|
|
||||||
<MainArea />
|
<MainArea />
|
||||||
</Suspense>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,20 @@ import {
|
||||||
RealtimeClientProvider,
|
RealtimeClientProvider,
|
||||||
} from "@/components/Provider/RealtimeClientProvider";
|
} from "@/components/Provider/RealtimeClientProvider";
|
||||||
import { ReportProvider } from "@/components/Provider/ReportResolveProvider";
|
import { ReportProvider } from "@/components/Provider/ReportResolveProvider";
|
||||||
// import { RealtimeUtils } from "@coze/realtime-api";
|
import { RealtimeUtils } from "@coze/realtime-api";
|
||||||
import { useLocation } from "react-router-dom";
|
import { useLocation } from "react-router-dom";
|
||||||
|
|
||||||
function MainContent() {
|
function MainContent() {
|
||||||
const { isConnected, handleDisconnect } = useContext(RealtimeClientContext);
|
const { isConnected, handleDisconnect } = useContext(RealtimeClientContext);
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|
||||||
// const handlePromise = async() => {
|
const handlePromise = async() => {
|
||||||
// await RealtimeUtils.checkDevicePermission(false);
|
await RealtimeUtils.checkDevicePermission(false);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// useEffect(() => {
|
useEffect(() => {
|
||||||
// handlePromise();
|
handlePromise();
|
||||||
// }, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isConnected) {
|
if (isConnected) {
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,8 @@ export default function AntechamberFile({handleLoading}:Props) {
|
||||||
|
|
||||||
handleConnect({
|
handleConnect({
|
||||||
fileInfo: {type: resp.type,url: resp.url,tableName: resp.tableName,provinceName: resp.provinceName,subjectClaim: resp.subjectClaim},
|
fileInfo: {type: resp.type,url: resp.url,tableName: resp.tableName,provinceName: resp.provinceName,subjectClaim: resp.subjectClaim},
|
||||||
}).then(() => {
|
|
||||||
setHasHandledReport(true);
|
|
||||||
});
|
});
|
||||||
|
setHasHandledReport(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
.custom-animation {
|
|
||||||
height: calc(100% - 12px);
|
|
||||||
will-change: width;
|
|
||||||
animation: moveBackAndForth 2s infinite linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes moveBackAndForth {
|
|
||||||
0% {
|
|
||||||
transform: translateX(0);
|
|
||||||
}
|
|
||||||
25% {
|
|
||||||
width: calc(40%);
|
|
||||||
transform: translateX(calc(50% - 12px));
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
width: calc(20%);
|
|
||||||
transform: translateX(calc(400% - 12px));
|
|
||||||
}
|
|
||||||
75% {
|
|
||||||
width: calc(40%);
|
|
||||||
transform: translateX(calc(50% - 12px));
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
transform: translateX(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
import "./index.css";
|
|
||||||
import LogoSvg from "/icons/logo.png";
|
|
||||||
|
|
||||||
export const Loading = () => {
|
|
||||||
return (
|
|
||||||
<div className="h-screen w-full flex items-center justify-center">
|
|
||||||
<div className="flex mx-[12vw] rounded-full border-[3px] border-solid border-[#000] h-[54px] p-[6px] relative flex-1">
|
|
||||||
<div className="w-[calc(20%)] bg-black rounded-full custom-animation absolute left-0"></div>
|
|
||||||
<div className="w-full h-full flex items-center justify-center mix-blend-difference">
|
|
||||||
<img src={LogoSvg} className="w-[115px] h-[18px]" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
@ -105,7 +105,17 @@ export const RealtimeClientProvider = ({
|
||||||
initMessage?: string;
|
initMessage?: string;
|
||||||
fileInfo?: FileInfo;
|
fileInfo?: FileInfo;
|
||||||
}) => {
|
}) => {
|
||||||
|
const perm = await RealtimeUtils.checkDevicePermission(false);
|
||||||
|
const device = await RealtimeUtils.getAudioDevices();
|
||||||
|
|
||||||
|
if (!perm.audio) {
|
||||||
|
toast({ title: "连接错误", description: "需要麦克风访问权限" });
|
||||||
|
throw new Error("需要麦克风访问权限");
|
||||||
|
}
|
||||||
|
if (device.audioInputs.length === 0) {
|
||||||
|
toast({ title: "连接错误", description: "没有麦克风设备" });
|
||||||
|
throw new Error("没有麦克风设备");
|
||||||
|
}
|
||||||
|
|
||||||
const client = new RealtimeClient({
|
const client = new RealtimeClient({
|
||||||
accessToken: token,
|
accessToken: token,
|
||||||
|
|
@ -115,7 +125,7 @@ export const RealtimeClientProvider = ({
|
||||||
allowPersonalAccessTokenInBrowser: true,
|
allowPersonalAccessTokenInBrowser: true,
|
||||||
suppressStationaryNoise: true,
|
suppressStationaryNoise: true,
|
||||||
suppressNonStationaryNoise: true,
|
suppressNonStationaryNoise: true,
|
||||||
debug: false,
|
debug: true,
|
||||||
});
|
});
|
||||||
clientRef.current = client;
|
clientRef.current = client;
|
||||||
|
|
||||||
|
|
@ -139,18 +149,6 @@ export const RealtimeClientProvider = ({
|
||||||
connectingLockRef.current = false;
|
connectingLockRef.current = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const perm = await RealtimeUtils.checkDevicePermission(false);
|
|
||||||
const device = await RealtimeUtils.getAudioDevices();
|
|
||||||
if (!perm.audio) {
|
|
||||||
toast({ title: "连接错误", description: "需要麦克风访问权限" });
|
|
||||||
return;
|
|
||||||
// throw new Error("需要麦克风访问权限");
|
|
||||||
}
|
|
||||||
if (device.audioInputs.length === 0) {
|
|
||||||
toast({ title: "连接错误", description: "没有麦克风设备" });
|
|
||||||
return;
|
|
||||||
// throw new Error("没有麦克风设备");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!clientRef.current) {
|
if (!clientRef.current) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue