feat: 增加我的填报

master
xjs 2025-04-01 16:28:22 +08:00
parent 033127de94
commit 14b4aeb570
14 changed files with 143 additions and 49 deletions

View File

@ -13,9 +13,9 @@ type Headers = Record<string, string>;
* @param apiName
* @param headers
*/
export const requestGetMethod = (apiBasicParams: string, headers = {}) => {
export const requestGetMethod = (apiBasicParams: string, hasPrefix:boolean = false, headers = {}) => {
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]}`)
.join('&')}`;
const res = await fetch(url, {

BIN
src/assets/img/myInput.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

View File

@ -27,6 +27,7 @@ export enum CustomParamsType {
export enum VOICE_TYPE {
'通用女声' = 'BV001_streaming',
'通用男声' = 'BV002_streaming',
'邻家女孩' = 'zh_female_linjianvhai_moon_bigtts'
}
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>> = {
// ... 可根据所开通的模型进行扩充
[AI_MODEL.DOUBAO_PRO_32K]: '7456409430717480998'
};
export enum SCENE {
@ -134,7 +136,7 @@ export const Name = {
* @brief
*/
export const Welcome = {
[SCENE.CUSTOM]: 'Hey我是您的六纬AI小助手',
[SCENE.CUSTOM]: '你好我是你的六纬AI志愿填报师 有什么升学选择或者高考志愿填报问题都可以问我',
};
export const Model = {
@ -142,7 +144,7 @@ export const Model = {
};
export const Voice = {
[SCENE.CUSTOM]: VOICE_TYPE.,
[SCENE.CUSTOM]: VOICE_TYPE.,
};
export const Questions = {

View File

@ -12,7 +12,7 @@ import {
Welcome,
Model,
Voice,
// LLM_BOT_ID,
LLM_BOT_ID,
AI_MODEL,
AI_MODE_MAP,
AI_MODEL_MODE,
@ -114,13 +114,13 @@ export class ConfigFactory {
/**
* @brief
*/
InterruptMode = true;
InterruptMode = false;
get LLMConfig() {
const params: Record<string, unknown> = {
Mode: AI_MODE_MAP[this.Model || ''] || AI_MODEL_MODE.CUSTOM,
EndPointId: ARK_V3_MODEL_ID[this.Model],
// BotId: LLM_BOT_ID[this.Model],
BotId: LLM_BOT_ID[this.Model],
MaxTokens: 1024,
Temperature: 0.1,
TopP: 0.3,

View File

@ -1,5 +1,11 @@
.headerWrapper{
margin-top: 65px;
width: 100%;
padding: 0 16px;
box-sizing: border-box;
}
.wrapper {
width: 343px;
height: 105px;
background: rgba(176, 228, 255, 0.8);
border-radius: 50px 13px 13px 13px;
@ -50,6 +56,8 @@
position: relative;
z-index: 1;
backdrop-filter:blur(10px);
min-height: 213px;
box-sizing: border-box;
}
.main {

View File

@ -5,10 +5,10 @@ import style from './index.module.less';
import WhatsThing from '@/assets/img/whatsThing.png';
import CircleIcon from '@/assets/img/circle.png';
import RightIcon from '@/assets/img/right.png';
import { Questions } from '@/config';
import { setInitMsg } from '@/store/slices/room';
import { requestGetMethod } from '@/app/base';
type Props = {
@ -18,26 +18,39 @@ type Props = {
export default function HeaderGroup({toRoom}:Props) {
const [isRotating, setIsRotating] = useState(false);
const [displayQuestions, setDisplayQuestions] = useState<string[]>([]);
const [allQuestions,setAllQuestions] = useState<string[]>([])
// 随机获取4个问题的函数
const getRandomQuestions = () => {
const allQuestions = [...Questions.CUSTOM];
const _allQuestions = Array.from(allQuestions)
const result: string[] = [];
const questionCount = Math.min(4, allQuestions.length);
const questionCount = Math.min(4, _allQuestions.length);
for (let i = 0; i < questionCount; i++) {
const randomIndex = Math.floor(Math.random() * allQuestions.length);
result.push(allQuestions.splice(randomIndex, 1)[0]);
const randomIndex = Math.floor(Math.random() * _allQuestions.length);
result.push(_allQuestions.splice(randomIndex, 1)[0]);
}
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(() => {
setDisplayQuestions(getRandomQuestions());
getQuestion();
}, []);
const handleClick = () => {
@ -63,7 +76,7 @@ export default function HeaderGroup({toRoom}:Props) {
};
return (
<div>
<div className={style.headerWrapper}>
<div className={style.wrapper}>
<img className={style.img} src={HelloGIF} alt="hello" />
<div className={style.text}>HeyAI</div>

View File

@ -8,27 +8,29 @@
align-items: center;
border-radius: 50%;
position: relative;
margin-top: auto;
margin-bottom: 80px;
}
.wrapper::before {
position: absolute;
content: "";
content: '';
left: 0;
bottom: 0;
width: 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);
}
.wrapper::after {
position: absolute;
content: "";
content: '';
left: 20%;
top: 0;
width: 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);
}

View File

@ -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;
}

View File

@ -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>
);
}

View File

@ -49,8 +49,4 @@
margin-top: 4px;
}
.invoke-btn {
position: absolute;
bottom: 120px;
}
}

View File

@ -8,6 +8,8 @@ import { useSearchParams } from 'react-router-dom';
import InvokeButton from '@/pages/MainPage/MainArea/Antechamber/InvokeButton';
import HeaderGroup from '@/pages/MainPage/MainArea/Antechamber/HeaderGroup';
import MyInput from '@/pages/MainPage/MainArea/Antechamber/MyInput';
import { useJoin } from '@/lib/useCommon';
import style from './index.module.less';
import { updateAIConfig } from '@/store/slices/room';
@ -55,6 +57,7 @@ function Antechamber() {
return (
<div className={style.wrapper}>
<HeaderGroup toRoom={handleJoinRoom} />
<MyInput toRoom={handleJoinRoom} />
<InvokeButton onClick={handleJoinRoom} disable={isDisable} loading={joining} className={style['invoke-btn']} />
</div>
);

View File

@ -23,7 +23,8 @@ function AudioController(props: React.HTMLAttributes<HTMLDivElement>) {
const room = useSelector((state: RootState) => state.room);
const volume = room.localUser.audioPropertiesInfo?.linearVolume || 0;
const { isAudioPublished,switchMic } = useDeviceState();
const isAITalking = room.isAITalking;
const { isAITalking} = useSelector((state: RootState) => state.room);
const isLoading = volume >= THRESHOLD_VOLUME && isAudioPublished;
const leaveRoom = useLeave();

View File

@ -48,9 +48,7 @@
width: max-content;
border: 0px solid;
align-self: flex-end;
margin-top: 12px;
margin-bottom: 12px;
margin-right: 15px;
padding: 15px;
.content{
border-radius: 30px 30px 0 30px;