Merge branch 'master' of http://192.168.100.104:3000/xjs/six-dimension-aigc
commit
b8a81e8e3d
|
|
@ -13,9 +13,9 @@ type Headers = Record<string, string>;
|
||||||
* @param apiName
|
* @param apiName
|
||||||
* @param headers
|
* @param headers
|
||||||
*/
|
*/
|
||||||
export const requestGetMethod = (apiBasicParams: string, headers = {}) => {
|
export const requestGetMethod = (apiBasicParams: string, hasPrefix:boolean = false, headers = {}) => {
|
||||||
return async (params: Record<string, any> = {}) => {
|
return async (params: Record<string, any> = {}) => {
|
||||||
const url = `${AIGC_PROXY_HOST}${apiBasicParams}&${Object.keys(params)
|
const url = `${hasPrefix ? '':AIGC_PROXY_HOST}${apiBasicParams}&${Object.keys(params)
|
||||||
.map((key) => `${key}=${params[key]}`)
|
.map((key) => `${key}=${params[key]}`)
|
||||||
.join('&')}`;
|
.join('&')}`;
|
||||||
const res = await fetch(url, {
|
const res = await fetch(url, {
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 206 B |
|
|
@ -27,6 +27,7 @@ export enum CustomParamsType {
|
||||||
export enum VOICE_TYPE {
|
export enum VOICE_TYPE {
|
||||||
'通用女声' = 'BV001_streaming',
|
'通用女声' = 'BV001_streaming',
|
||||||
'通用男声' = 'BV002_streaming',
|
'通用男声' = 'BV002_streaming',
|
||||||
|
'邻家女孩' = 'zh_female_linjianvhai_moon_bigtts'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const VOICE_INFO_MAP = {
|
export const VOICE_INFO_MAP = {
|
||||||
|
|
@ -115,6 +116,7 @@ export const ARK_V3_MODEL_ID: Partial<Record<AI_MODEL, string>> = {
|
||||||
*/
|
*/
|
||||||
export const LLM_BOT_ID: Partial<Record<AI_MODEL, string>> = {
|
export const LLM_BOT_ID: Partial<Record<AI_MODEL, string>> = {
|
||||||
// ... 可根据所开通的模型进行扩充
|
// ... 可根据所开通的模型进行扩充
|
||||||
|
[AI_MODEL.DOUBAO_PRO_32K]: '7456409430717480998'
|
||||||
};
|
};
|
||||||
|
|
||||||
export enum SCENE {
|
export enum SCENE {
|
||||||
|
|
@ -134,7 +136,7 @@ export const Name = {
|
||||||
* @brief 智能体启动后的欢迎词。
|
* @brief 智能体启动后的欢迎词。
|
||||||
*/
|
*/
|
||||||
export const Welcome = {
|
export const Welcome = {
|
||||||
[SCENE.CUSTOM]: 'Hey,我是您的六纬AI小助手',
|
[SCENE.CUSTOM]: '你好,我是你的六纬AI志愿填报师, 有什么升学选择或者高考志愿填报问题都可以问我',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Model = {
|
export const Model = {
|
||||||
|
|
@ -142,7 +144,7 @@ export const Model = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Voice = {
|
export const Voice = {
|
||||||
[SCENE.CUSTOM]: VOICE_TYPE.通用女声,
|
[SCENE.CUSTOM]: VOICE_TYPE.邻家女孩,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Questions = {
|
export const Questions = {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import {
|
||||||
Welcome,
|
Welcome,
|
||||||
Model,
|
Model,
|
||||||
Voice,
|
Voice,
|
||||||
// LLM_BOT_ID,
|
LLM_BOT_ID,
|
||||||
AI_MODEL,
|
AI_MODEL,
|
||||||
AI_MODE_MAP,
|
AI_MODE_MAP,
|
||||||
AI_MODEL_MODE,
|
AI_MODEL_MODE,
|
||||||
|
|
@ -114,13 +114,13 @@ export class ConfigFactory {
|
||||||
/**
|
/**
|
||||||
* @brief 是否为打断模式
|
* @brief 是否为打断模式
|
||||||
*/
|
*/
|
||||||
InterruptMode = true;
|
InterruptMode = false;
|
||||||
|
|
||||||
get LLMConfig() {
|
get LLMConfig() {
|
||||||
const params: Record<string, unknown> = {
|
const params: Record<string, unknown> = {
|
||||||
Mode: AI_MODE_MAP[this.Model || ''] || AI_MODEL_MODE.CUSTOM,
|
Mode: AI_MODE_MAP[this.Model || ''] || AI_MODEL_MODE.CUSTOM,
|
||||||
EndPointId: ARK_V3_MODEL_ID[this.Model],
|
EndPointId: ARK_V3_MODEL_ID[this.Model],
|
||||||
// BotId: LLM_BOT_ID[this.Model],
|
BotId: LLM_BOT_ID[this.Model],
|
||||||
MaxTokens: 1024,
|
MaxTokens: 1024,
|
||||||
Temperature: 0.1,
|
Temperature: 0.1,
|
||||||
TopP: 0.3,
|
TopP: 0.3,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,11 @@
|
||||||
|
.headerWrapper{
|
||||||
|
margin-top: 65px;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0 16px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
.wrapper {
|
.wrapper {
|
||||||
width: 343px;
|
|
||||||
height: 105px;
|
height: 105px;
|
||||||
background: rgba(176, 228, 255, 0.8);
|
background: rgba(176, 228, 255, 0.8);
|
||||||
border-radius: 50px 13px 13px 13px;
|
border-radius: 50px 13px 13px 13px;
|
||||||
|
|
@ -50,6 +56,8 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
backdrop-filter:blur(10px);
|
backdrop-filter:blur(10px);
|
||||||
|
min-height: 213px;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main {
|
.main {
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ import style from './index.module.less';
|
||||||
import WhatsThing from '@/assets/img/whatsThing.png';
|
import WhatsThing from '@/assets/img/whatsThing.png';
|
||||||
import CircleIcon from '@/assets/img/circle.png';
|
import CircleIcon from '@/assets/img/circle.png';
|
||||||
import RightIcon from '@/assets/img/right.png';
|
import RightIcon from '@/assets/img/right.png';
|
||||||
import { Questions } from '@/config';
|
|
||||||
|
|
||||||
|
|
||||||
import { setInitMsg } from '@/store/slices/room';
|
import { setInitMsg } from '@/store/slices/room';
|
||||||
|
import { requestGetMethod } from '@/app/base';
|
||||||
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|
@ -18,26 +18,39 @@ type Props = {
|
||||||
export default function HeaderGroup({toRoom}:Props) {
|
export default function HeaderGroup({toRoom}:Props) {
|
||||||
const [isRotating, setIsRotating] = useState(false);
|
const [isRotating, setIsRotating] = useState(false);
|
||||||
const [displayQuestions, setDisplayQuestions] = useState<string[]>([]);
|
const [displayQuestions, setDisplayQuestions] = useState<string[]>([]);
|
||||||
|
const [allQuestions,setAllQuestions] = useState<string[]>([])
|
||||||
|
|
||||||
// 随机获取4个问题的函数
|
// 随机获取4个问题的函数
|
||||||
const getRandomQuestions = () => {
|
const getRandomQuestions = () => {
|
||||||
const allQuestions = [...Questions.CUSTOM];
|
const _allQuestions = Array.from(allQuestions)
|
||||||
const result: string[] = [];
|
const result: string[] = [];
|
||||||
const questionCount = Math.min(4, allQuestions.length);
|
const questionCount = Math.min(4, _allQuestions.length);
|
||||||
|
|
||||||
for (let i = 0; i < questionCount; i++) {
|
for (let i = 0; i < questionCount; i++) {
|
||||||
const randomIndex = Math.floor(Math.random() * allQuestions.length);
|
const randomIndex = Math.floor(Math.random() * _allQuestions.length);
|
||||||
result.push(allQuestions.splice(randomIndex, 1)[0]);
|
result.push(_allQuestions.splice(randomIndex, 1)[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getQuestion = async() => {
|
||||||
|
const queryData = await requestGetMethod(`https://api.v3.ycymedu.com/api/zhiYuan/aigcquestionswords?`,true)()
|
||||||
|
const res = await queryData?.json();
|
||||||
|
if(res.code === 200){
|
||||||
|
setAllQuestions(res.result)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setDisplayQuestions(getRandomQuestions());
|
||||||
|
},[allQuestions])
|
||||||
|
|
||||||
// 组件初始化时获取随机问题
|
// 组件初始化时获取随机问题
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setDisplayQuestions(getRandomQuestions());
|
getQuestion();
|
||||||
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
|
|
@ -55,7 +68,7 @@ export default function HeaderGroup({toRoom}:Props) {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const handleQuestion = async(question: string) => {
|
const handleQuestion = async(question: string) => {
|
||||||
await toRoom();
|
await toRoom();
|
||||||
|
|
||||||
dispatch(
|
dispatch(
|
||||||
setInitMsg(question)
|
setInitMsg(question)
|
||||||
);
|
);
|
||||||
|
|
@ -63,7 +76,7 @@ export default function HeaderGroup({toRoom}:Props) {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className={style.headerWrapper}>
|
||||||
<div className={style.wrapper}>
|
<div className={style.wrapper}>
|
||||||
<img className={style.img} src={HelloGIF} alt="hello" />
|
<img className={style.img} src={HelloGIF} alt="hello" />
|
||||||
<div className={style.text}>Hey,我是您的六纬AI小助手</div>
|
<div className={style.text}>Hey,我是您的六纬AI小助手</div>
|
||||||
|
|
|
||||||
|
|
@ -8,28 +8,30 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
margin-top: auto;
|
||||||
|
margin-bottom: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wrapper::before{
|
.wrapper::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
content: "";
|
content: '';
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 26px;
|
width: 26px;
|
||||||
height: 26px;
|
height: 26px;
|
||||||
background: radial-gradient(farthest-corner at 100% 0%, #7BDCF0, #fff);
|
background: radial-gradient(farthest-corner at 100% 0%, #7bdcf0, #fff);
|
||||||
filter: blur(14px);
|
filter: blur(14px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.wrapper::after{
|
.wrapper::after {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
content: "";
|
content: '';
|
||||||
left: 20%;
|
left: 20%;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 26px;
|
width: 26px;
|
||||||
height: 26px;
|
height: 26px;
|
||||||
background: radial-gradient(farthest-corner at 100% 0%, #7BDCF0, #a4dbe6);
|
background: radial-gradient(farthest-corner at 100% 0%, #7bdcf0, #a4dbe6);
|
||||||
filter: blur(14px);
|
filter: blur(14px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
|
|
@ -38,9 +40,9 @@
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.call{
|
.call {
|
||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
.scoreWrapper {
|
||||||
|
padding: 15px;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.innerWrapper {
|
||||||
|
padding: 15px;
|
||||||
|
width: 100%;
|
||||||
|
background: rgba(255, 255, 255, 0.7);
|
||||||
|
border-radius: 13px;
|
||||||
|
border: 1px solid #f4f6fa;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right{
|
||||||
|
color: #1580FF;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
import { useSearchParams } from 'react-router-dom';
|
||||||
|
import { setInitMsg } from '@/store/slices/room';
|
||||||
|
import MyInputIcon from '@/assets/img/myInput.png';
|
||||||
|
import RightBlueIcon from '@/assets/img/rightBlue.png';
|
||||||
|
import style from './index.module.less';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
toRoom: () => Promise<void>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function MyInput({ toRoom }: Props) {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const [searchParams] = useSearchParams()
|
||||||
|
|
||||||
|
const provinceName = searchParams.get('provinceName') || '山东省'
|
||||||
|
const subjectGroup = searchParams.get('subjectGroup') || '物/化/史'
|
||||||
|
const expectedScore = searchParams.get('expectedScore') || 500
|
||||||
|
|
||||||
|
const handleQuestion = async () => {
|
||||||
|
await toRoom();
|
||||||
|
dispatch(setInitMsg(`我的高考地点在${provinceName},我选择的科目是${subjectGroup},我的高考分数为${expectedScore}分。我适合哪些学校和专业`));
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={style.scoreWrapper}>
|
||||||
|
<div className={style.innerWrapper}>
|
||||||
|
<div className={style.left}>
|
||||||
|
<img src={MyInputIcon} alt="input-ico" />
|
||||||
|
<div className={style.detail}>
|
||||||
|
<div className={style.city}>{provinceName}</div>
|
||||||
|
<div className={style.subject}>{(subjectGroup as string).split(',').join('/') }</div>
|
||||||
|
<div className={style.score}>{expectedScore}分</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className={style.right} onClick={handleQuestion}>
|
||||||
|
<span>智能分析</span>
|
||||||
|
<img src={RightBlueIcon} alt="right" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -49,8 +49,4 @@
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.invoke-btn {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 120px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -8,6 +8,8 @@ import { useSearchParams } from 'react-router-dom';
|
||||||
|
|
||||||
import InvokeButton from '@/pages/MainPage/MainArea/Antechamber/InvokeButton';
|
import InvokeButton from '@/pages/MainPage/MainArea/Antechamber/InvokeButton';
|
||||||
import HeaderGroup from '@/pages/MainPage/MainArea/Antechamber/HeaderGroup';
|
import HeaderGroup from '@/pages/MainPage/MainArea/Antechamber/HeaderGroup';
|
||||||
|
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 } from '@/store/slices/room';
|
||||||
|
|
@ -55,6 +57,7 @@ function Antechamber() {
|
||||||
return (
|
return (
|
||||||
<div className={style.wrapper}>
|
<div className={style.wrapper}>
|
||||||
<HeaderGroup toRoom={handleJoinRoom} />
|
<HeaderGroup toRoom={handleJoinRoom} />
|
||||||
|
<MyInput toRoom={handleJoinRoom} />
|
||||||
<InvokeButton onClick={handleJoinRoom} disable={isDisable} loading={joining} className={style['invoke-btn']} />
|
<InvokeButton onClick={handleJoinRoom} disable={isDisable} loading={joining} className={style['invoke-btn']} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,8 @@ function AudioController(props: React.HTMLAttributes<HTMLDivElement>) {
|
||||||
const room = useSelector((state: RootState) => state.room);
|
const room = useSelector((state: RootState) => state.room);
|
||||||
const volume = room.localUser.audioPropertiesInfo?.linearVolume || 0;
|
const volume = room.localUser.audioPropertiesInfo?.linearVolume || 0;
|
||||||
const { isAudioPublished,switchMic } = useDeviceState();
|
const { isAudioPublished,switchMic } = useDeviceState();
|
||||||
const isAITalking = room.isAITalking;
|
|
||||||
|
const { isAITalking} = useSelector((state: RootState) => state.room);
|
||||||
const isLoading = volume >= THRESHOLD_VOLUME && isAudioPublished;
|
const isLoading = volume >= THRESHOLD_VOLUME && isAudioPublished;
|
||||||
const leaveRoom = useLeave();
|
const leaveRoom = useLeave();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,7 @@
|
||||||
width: max-content;
|
width: max-content;
|
||||||
border: 0px solid;
|
border: 0px solid;
|
||||||
align-self: flex-end;
|
align-self: flex-end;
|
||||||
margin-top: 12px;
|
padding: 15px;
|
||||||
margin-bottom: 12px;
|
|
||||||
margin-right: 15px;
|
|
||||||
|
|
||||||
.content{
|
.content{
|
||||||
border-radius: 30px 30px 0 30px;
|
border-radius: 30px 30px 0 30px;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue