fix: 解决重复加入房间的问题
parent
94b3976984
commit
e8c38c121c
|
|
@ -182,6 +182,9 @@ export class ConfigFactory {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
IgnoreBracketText: [1, 2, 3, 4, 5],
|
IgnoreBracketText: [1, 2, 3, 4, 5],
|
||||||
|
BidirectionAdditions:{
|
||||||
|
disable_markdown_filter:false,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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, useState } from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
|
|
||||||
|
|
@ -15,6 +15,23 @@ import style from './index.module.less';
|
||||||
import { updateAIConfig } from '@/store/slices/room';
|
import { updateAIConfig } from '@/store/slices/room';
|
||||||
import { requestPostMethod } from '@/app/base';
|
import { requestPostMethod } from '@/app/base';
|
||||||
|
|
||||||
|
function getRandomLetters(num:number) {
|
||||||
|
const letters = 'abcdefghijklmnopqrstuvwxyz';
|
||||||
|
let result = '';
|
||||||
|
|
||||||
|
// 确保请求的字母数量不超过 26
|
||||||
|
num = Math.min(num, 26);
|
||||||
|
|
||||||
|
// 从字母表中随机选取字母
|
||||||
|
for (let i = 0; i < num; i++) {
|
||||||
|
const randomIndex = Math.floor(Math.random() * letters.length);
|
||||||
|
result += letters[randomIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function Antechamber() {
|
function Antechamber() {
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
|
|
@ -23,7 +40,8 @@ function Antechamber() {
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const userId = searchParams.get('userId') || '0'
|
const userId = searchParams.get('userId') || '0'
|
||||||
const username = userId;
|
const username = userId;
|
||||||
const roomId = `${userId}-${new Date().getTime()}`;
|
const pre = useMemo(() => getRandomLetters(5), []);
|
||||||
|
const roomId = `${pre}${userId}`;
|
||||||
|
|
||||||
|
|
||||||
const getToken = async () => {
|
const getToken = async () => {
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
min-width: 124px;
|
min-width: 116px;
|
||||||
color: #0078ff;
|
color: #0078ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue