fix: 解决重复加入房间的问题

master
xjs 2025-04-09 15:39:06 +08:00
parent 94b3976984
commit e8c38c121c
3 changed files with 24 additions and 3 deletions

View File

@ -182,6 +182,9 @@ export class ConfigFactory {
},
},
IgnoreBracketText: [1, 2, 3, 4, 5],
BidirectionAdditions:{
disable_markdown_filter:false,
}
};
}

View File

@ -2,7 +2,7 @@
* Copyright 2025 Beijing Volcano Engine Technology Co., Ltd. All Rights Reserved.
* SPDX-license-identifier: BSD-3-Clause
*/
import { useEffect, useState } from 'react';
import { useEffect, useMemo, useState } from 'react';
import { useDispatch } from 'react-redux';
import { useSearchParams } from 'react-router-dom';
@ -15,6 +15,23 @@ import style from './index.module.less';
import { updateAIConfig } from '@/store/slices/room';
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() {
const dispatch = useDispatch()
@ -23,7 +40,8 @@ function Antechamber() {
const [searchParams] = useSearchParams();
const userId = searchParams.get('userId') || '0'
const username = userId;
const roomId = `${userId}-${new Date().getTime()}`;
const pre = useMemo(() => getRandomLetters(5), []);
const roomId = `${pre}${userId}`;
const getToken = async () => {

View File

@ -151,7 +151,7 @@
border-radius: 20px;
user-select: none;
gap: 8px;
min-width: 124px;
min-width: 116px;
color: #0078ff;
}