feat: 报告解读
parent
4d12fcf2b9
commit
c333297970
|
|
@ -105,7 +105,7 @@ export const AI_MODE_MAP: Partial<Record<AI_MODEL, AI_MODEL_MODE>> = {
|
||||||
export const ARK_V3_MODEL_ID: Partial<Record<AI_MODEL, string>> = {
|
export const ARK_V3_MODEL_ID: Partial<Record<AI_MODEL, string>> = {
|
||||||
[AI_MODEL.DOUBAO_LITE_4K]: 'ep-20241217194337-gwpdx',
|
[AI_MODEL.DOUBAO_LITE_4K]: 'ep-20241217194337-gwpdx',
|
||||||
[AI_MODEL.DOUBAO_PRO_4K]: 'ep-20241206114557-8584r',
|
[AI_MODEL.DOUBAO_PRO_4K]: 'ep-20241206114557-8584r',
|
||||||
[AI_MODEL.DOUBAO_PRO_32K]: 'ep-20250329161833-qfc6l', // 使用六维志愿
|
[AI_MODEL.DOUBAO_PRO_32K]: 'ep-20250415135353-vdmbr', // 使用六维志愿
|
||||||
[AI_MODEL.DOUBAO_PRO_128K]: 'doubao-1-5-lite-32k-250115',
|
[AI_MODEL.DOUBAO_PRO_128K]: 'doubao-1-5-lite-32k-250115',
|
||||||
[AI_MODEL.VISION]: 'doubao-1-5-lite-32k-250115',
|
[AI_MODEL.VISION]: 'doubao-1-5-lite-32k-250115',
|
||||||
// ... 可根据所开通的模型进行扩充
|
// ... 可根据所开通的模型进行扩充
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
* Copyright 2025 Beijing Volcano Engine Technology Co., Ltd. All Rights Reserved.
|
* Copyright 2025 Beijing Volcano Engine Technology Co., Ltd. All Rights Reserved.
|
||||||
* SPDX-license-identifier: BSD-3-Clause
|
* SPDX-license-identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useState, useContext } from 'react';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
|
|
||||||
|
|
@ -12,8 +12,9 @@ import MyInput from '@/pages/MainPage/MainArea/Antechamber/MyInput';
|
||||||
|
|
||||||
import { useJoin } from '@/lib/useCommon';
|
import { useJoin } from '@/lib/useCommon';
|
||||||
import style from './index.module.less';
|
import style from './index.module.less';
|
||||||
import { updateAIConfig } from '@/store/slices/room';
|
import { updateAIConfig,setInitMsg } from '@/store/slices/room';
|
||||||
import { requestPostMethod } from '@/app/base';
|
import { requestGetMethod, requestPostMethod } from '@/app/base';
|
||||||
|
import { ReportContext } from '../index';
|
||||||
|
|
||||||
function getRandomLetters(num:number) {
|
function getRandomLetters(num:number) {
|
||||||
const letters = 'abcdefghijklmnopqrstuvwxyz';
|
const letters = 'abcdefghijklmnopqrstuvwxyz';
|
||||||
|
|
@ -31,8 +32,6 @@ function getRandomLetters(num:number) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function Antechamber() {
|
function Antechamber() {
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const [joining, dispatchJoin] = useJoin();
|
const [joining, dispatchJoin] = useJoin();
|
||||||
|
|
@ -43,6 +42,39 @@ function Antechamber() {
|
||||||
const pre = useMemo(() => getRandomLetters(5), []);
|
const pre = useMemo(() => getRandomLetters(5), []);
|
||||||
const roomId = `${pre}${userId}`;
|
const roomId = `${pre}${userId}`;
|
||||||
|
|
||||||
|
const reportId = searchParams.get('reportId') || '';
|
||||||
|
const reportType = searchParams.get('reportType') || '';
|
||||||
|
const { hasHandledReport, setHasHandledReport } = useContext(ReportContext);
|
||||||
|
const token = searchParams.get('token') || '';
|
||||||
|
|
||||||
|
const handleJoinRoom = async() => {
|
||||||
|
if (!isDisable && !joining) {
|
||||||
|
await dispatchJoin(
|
||||||
|
{
|
||||||
|
username,
|
||||||
|
roomId,
|
||||||
|
publishAudio: true,
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getQuestion = async() => {
|
||||||
|
const queryData = await requestGetMethod(`https://api.v3.ycymedu.com/api/busScale/GetBusAIReportKeyWord?Type=${reportType}&Id=${reportId}`,true,{authorization:`Bearer ${token}`})()
|
||||||
|
const res = await queryData?.json();
|
||||||
|
if(res.code === 200){
|
||||||
|
await handleJoinRoom()
|
||||||
|
dispatch(setInitMsg(res.result))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if(reportId && !isDisable && !joining && !hasHandledReport){
|
||||||
|
getQuestion()
|
||||||
|
setHasHandledReport(true)
|
||||||
|
}
|
||||||
|
},[reportId, isDisable, joining, hasHandledReport, setHasHandledReport])
|
||||||
|
|
||||||
const getToken = async () => {
|
const getToken = async () => {
|
||||||
const queryData = await requestPostMethod(`/api/token`)({roomId,userId:username})
|
const queryData = await requestPostMethod(`/api/token`)({roomId,userId:username})
|
||||||
|
|
@ -59,18 +91,7 @@ function Antechamber() {
|
||||||
},[])
|
},[])
|
||||||
|
|
||||||
|
|
||||||
const handleJoinRoom = async() => {
|
|
||||||
if (!isDisable &&!joining) {
|
|
||||||
await dispatchJoin(
|
|
||||||
{
|
|
||||||
username,
|
|
||||||
roomId,
|
|
||||||
publishAudio: true,
|
|
||||||
},
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={style.wrapper}>
|
<div className={style.wrapper}>
|
||||||
|
|
|
||||||
|
|
@ -141,8 +141,7 @@
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 8px 15px;
|
padding: 8px 15px;
|
||||||
padding-bottom:constant(safe-area-inset-bottom);
|
padding-bottom: calc(var(safe-area-inset-bottom) + 15);
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
|
||||||
|
|
||||||
|
|
||||||
.talkWrapper {
|
.talkWrapper {
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,34 @@
|
||||||
* SPDX-license-identifier: BSD-3-Clause
|
* SPDX-license-identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { createContext, useState, useMemo } from 'react';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import Antechamber from './Antechamber';
|
import Antechamber from './Antechamber';
|
||||||
import Room from './Room';
|
import Room from './Room';
|
||||||
|
|
||||||
|
export const ReportContext = createContext<{
|
||||||
|
hasHandledReport: boolean;
|
||||||
|
setHasHandledReport: (value: boolean) => void;
|
||||||
|
}>({
|
||||||
|
hasHandledReport: false,
|
||||||
|
setHasHandledReport: () => {},
|
||||||
|
});
|
||||||
|
|
||||||
function MainArea() {
|
function MainArea() {
|
||||||
const room = useSelector((state: any) => state.room);
|
const room = useSelector((state: any) => state.room);
|
||||||
const isJoined = room.isJoined;
|
const isJoined = room.isJoined;
|
||||||
return isJoined ? <Room /> : <Antechamber />;
|
const [hasHandledReport, setHasHandledReport] = useState(false);
|
||||||
|
|
||||||
|
const contextValue = useMemo(() => ({
|
||||||
|
hasHandledReport,
|
||||||
|
setHasHandledReport
|
||||||
|
}), [hasHandledReport]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ReportContext.Provider value={contextValue}>
|
||||||
|
{isJoined ? <Room /> : <Antechamber />}
|
||||||
|
</ReportContext.Provider>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default MainArea;
|
export default MainArea;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue