diff --git a/src/app/base.ts b/src/app/base.ts index 2ad8372..162ff26 100644 --- a/src/app/base.ts +++ b/src/app/base.ts @@ -13,9 +13,9 @@ type Headers = Record; * @param apiName * @param headers */ -export const requestGetMethod = (apiBasicParams: string, headers = {}) => { +export const requestGetMethod = (apiBasicParams: string, hasPrefix:boolean = false, headers = {}) => { return async (params: Record = {}) => { - 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, { diff --git a/src/assets/img/myInput.png b/src/assets/img/myInput.png new file mode 100644 index 0000000..59c0e0a Binary files /dev/null and b/src/assets/img/myInput.png differ diff --git a/src/assets/img/rightBlue.png b/src/assets/img/rightBlue.png new file mode 100644 index 0000000..28eee5c Binary files /dev/null and b/src/assets/img/rightBlue.png differ diff --git a/src/config/common.ts b/src/config/common.ts index 58155a4..02af100 100644 --- a/src/config/common.ts +++ b/src/config/common.ts @@ -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> = { */ export const LLM_BOT_ID: Partial> = { // ... 可根据所开通的模型进行扩充 + [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 = { diff --git a/src/config/config.ts b/src/config/config.ts index eed40fc..184d2ca 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -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() { + get LLMConfig() { const params: Record = { 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, diff --git a/src/pages/MainPage/MainArea/Antechamber/HeaderGroup/index.module.less b/src/pages/MainPage/MainArea/Antechamber/HeaderGroup/index.module.less index e9afd54..d530b8a 100644 --- a/src/pages/MainPage/MainArea/Antechamber/HeaderGroup/index.module.less +++ b/src/pages/MainPage/MainArea/Antechamber/HeaderGroup/index.module.less @@ -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 { diff --git a/src/pages/MainPage/MainArea/Antechamber/HeaderGroup/index.tsx b/src/pages/MainPage/MainArea/Antechamber/HeaderGroup/index.tsx index d2cdc66..5f2b0fb 100644 --- a/src/pages/MainPage/MainArea/Antechamber/HeaderGroup/index.tsx +++ b/src/pages/MainPage/MainArea/Antechamber/HeaderGroup/index.tsx @@ -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([]); + const [allQuestions,setAllQuestions] = useState([]) // 随机获取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 = () => { @@ -55,7 +68,7 @@ export default function HeaderGroup({toRoom}:Props) { const dispatch = useDispatch(); const handleQuestion = async(question: string) => { await toRoom(); - + dispatch( setInitMsg(question) ); @@ -63,7 +76,7 @@ export default function HeaderGroup({toRoom}:Props) { }; return ( -
+
hello
Hey,我是您的六纬AI小助手
diff --git a/src/pages/MainPage/MainArea/Antechamber/InvokeButton/index.module.less b/src/pages/MainPage/MainArea/Antechamber/InvokeButton/index.module.less index dee4bf7..a2b77da 100644 --- a/src/pages/MainPage/MainArea/Antechamber/InvokeButton/index.module.less +++ b/src/pages/MainPage/MainArea/Antechamber/InvokeButton/index.module.less @@ -8,28 +8,30 @@ align-items: center; border-radius: 50%; position: relative; + margin-top: auto; + margin-bottom: 80px; } -.wrapper::before{ - position: absolute; - content: ""; - left: 0; - bottom: 0; - width: 26px; - height: 26px; - background: radial-gradient(farthest-corner at 100% 0%, #7BDCF0, #fff); - filter: blur(14px); +.wrapper::before { + position: absolute; + content: ''; + left: 0; + bottom: 0; + width: 26px; + height: 26px; + background: radial-gradient(farthest-corner at 100% 0%, #7bdcf0, #fff); + filter: blur(14px); } -.wrapper::after{ - position: absolute; - content: ""; - left: 20%; - top: 0; - width: 26px; - height: 26px; - background: radial-gradient(farthest-corner at 100% 0%, #7BDCF0, #a4dbe6); - filter: blur(14px); +.wrapper::after { + position: absolute; + content: ''; + left: 20%; + top: 0; + width: 26px; + height: 26px; + background: radial-gradient(farthest-corner at 100% 0%, #7bdcf0, #a4dbe6); + filter: blur(14px); } .text { @@ -38,9 +40,9 @@ font-size: 13px; } -.call{ - width: 32px; - height: 32px; - object-fit: contain; - margin-bottom: 4px; +.call { + width: 32px; + height: 32px; + object-fit: contain; + margin-bottom: 4px; } diff --git a/src/pages/MainPage/MainArea/Antechamber/MyInput/index.module.less b/src/pages/MainPage/MainArea/Antechamber/MyInput/index.module.less new file mode 100644 index 0000000..093ee9a --- /dev/null +++ b/src/pages/MainPage/MainArea/Antechamber/MyInput/index.module.less @@ -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; +} diff --git a/src/pages/MainPage/MainArea/Antechamber/MyInput/index.tsx b/src/pages/MainPage/MainArea/Antechamber/MyInput/index.tsx new file mode 100644 index 0000000..6667951 --- /dev/null +++ b/src/pages/MainPage/MainArea/Antechamber/MyInput/index.tsx @@ -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; +}; + +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 ( +
+
+
+ input-ico +
+
{provinceName}
+
{(subjectGroup as string).split(',').join('/') }
+
{expectedScore}分
+
+
+
+ 智能分析 + right +
+
+
+ ); +} diff --git a/src/pages/MainPage/MainArea/Antechamber/index.module.less b/src/pages/MainPage/MainArea/Antechamber/index.module.less index 999dcf1..1e8fad4 100644 --- a/src/pages/MainPage/MainArea/Antechamber/index.module.less +++ b/src/pages/MainPage/MainArea/Antechamber/index.module.less @@ -49,8 +49,4 @@ margin-top: 4px; } - .invoke-btn { - position: absolute; - bottom: 120px; - } } \ No newline at end of file diff --git a/src/pages/MainPage/MainArea/Antechamber/index.tsx b/src/pages/MainPage/MainArea/Antechamber/index.tsx index 50309fe..596c46a 100644 --- a/src/pages/MainPage/MainArea/Antechamber/index.tsx +++ b/src/pages/MainPage/MainArea/Antechamber/index.tsx @@ -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 (
+
); diff --git a/src/pages/MainPage/MainArea/Room/AudioController.tsx b/src/pages/MainPage/MainArea/Room/AudioController.tsx index 6d09bf9..bea26e8 100644 --- a/src/pages/MainPage/MainArea/Room/AudioController.tsx +++ b/src/pages/MainPage/MainArea/Room/AudioController.tsx @@ -23,7 +23,8 @@ function AudioController(props: React.HTMLAttributes) { 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(); diff --git a/src/pages/MainPage/MainArea/Room/index.module.less b/src/pages/MainPage/MainArea/Room/index.module.less index e233a3c..d4b049b 100644 --- a/src/pages/MainPage/MainArea/Room/index.module.less +++ b/src/pages/MainPage/MainArea/Room/index.module.less @@ -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;