From e8c38c121c65c88f36571769e94fb5a5e9e10df9 Mon Sep 17 00:00:00 2001 From: xjs Date: Wed, 9 Apr 2025 15:39:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=88=BF=E9=97=B4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/config.ts | 3 +++ .../MainPage/MainArea/Antechamber/index.tsx | 22 +++++++++++++++++-- .../MainPage/MainArea/Room/index.module.less | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/config/config.ts b/src/config/config.ts index 184d2ca..47b813c 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -182,6 +182,9 @@ export class ConfigFactory { }, }, IgnoreBracketText: [1, 2, 3, 4, 5], + BidirectionAdditions:{ + disable_markdown_filter:false, + } }; } diff --git a/src/pages/MainPage/MainArea/Antechamber/index.tsx b/src/pages/MainPage/MainArea/Antechamber/index.tsx index 0edbd6f..a5b92ae 100644 --- a/src/pages/MainPage/MainArea/Antechamber/index.tsx +++ b/src/pages/MainPage/MainArea/Antechamber/index.tsx @@ -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 () => { diff --git a/src/pages/MainPage/MainArea/Room/index.module.less b/src/pages/MainPage/MainArea/Room/index.module.less index d4b049b..f070e08 100644 --- a/src/pages/MainPage/MainArea/Room/index.module.less +++ b/src/pages/MainPage/MainArea/Room/index.module.less @@ -151,7 +151,7 @@ border-radius: 20px; user-select: none; gap: 8px; - min-width: 124px; + min-width: 116px; color: #0078ff; }