4.8.21 feature (#3742)
* model config * feat: normalization embedding * adapt unstrea reasoning response * remove select app * perf: dataset search code * fix: multiple audio video show * perf: query extension output * perf: link check * perf: faq doc * fix: ts * feat: support reasoning text output * feat: workflow support reasoning output
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { Box } from '@chakra-ui/react';
|
||||
import { useMarkdownWidth } from '../hooks';
|
||||
|
||||
const AudioBlock = ({ code: audioUrl }: { code: string }) => {
|
||||
const { width, Ref } = useMarkdownWidth();
|
||||
const audioRef = useRef<HTMLAudioElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
fetch(audioUrl?.trim(), {
|
||||
@@ -13,8 +14,7 @@ const AudioBlock = ({ code: audioUrl }: { code: string }) => {
|
||||
.then((response) => response.blob())
|
||||
.then((blob) => {
|
||||
const url = URL.createObjectURL(blob);
|
||||
const audio = document.getElementById('player');
|
||||
audio?.setAttribute('src', url);
|
||||
audioRef?.current?.setAttribute('src', url);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
@@ -22,8 +22,8 @@ const AudioBlock = ({ code: audioUrl }: { code: string }) => {
|
||||
}, [audioUrl]);
|
||||
|
||||
return (
|
||||
<Box w={width} ref={Ref}>
|
||||
<audio id="player" controls style={{ width: '100%' }} />
|
||||
<Box w={width} ref={Ref} my={4}>
|
||||
<audio ref={audioRef} controls style={{ width: '100%' }} />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { Box } from '@chakra-ui/react';
|
||||
import { useMarkdownWidth } from '../hooks';
|
||||
|
||||
const VideoBlock = ({ code: videoUrl }: { code: string }) => {
|
||||
const { width, Ref } = useMarkdownWidth();
|
||||
const videoRef = useRef<HTMLVideoElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
fetch(videoUrl?.trim(), {
|
||||
@@ -13,8 +14,7 @@ const VideoBlock = ({ code: videoUrl }: { code: string }) => {
|
||||
.then((response) => response.blob())
|
||||
.then((blob) => {
|
||||
const url = URL.createObjectURL(blob);
|
||||
const video = document.getElementById('player');
|
||||
video?.setAttribute('src', url);
|
||||
videoRef?.current?.setAttribute('src', url);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
@@ -22,8 +22,8 @@ const VideoBlock = ({ code: videoUrl }: { code: string }) => {
|
||||
}, [videoUrl]);
|
||||
|
||||
return (
|
||||
<Box w={width} ref={Ref}>
|
||||
<video id="player" controls />
|
||||
<Box w={width} ref={Ref} my={4} borderRadius={'md'} overflow={'hidden'}>
|
||||
<video ref={videoRef} controls />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -58,10 +58,10 @@ const MarkdownRender = ({ source = '', showAnimation, isDisabled, forbidZhFormat
|
||||
// 保护 URL 格式:https://, http://, /api/xxx
|
||||
const urlPlaceholders: string[] = [];
|
||||
const textWithProtectedUrls = source.replace(
|
||||
/(https?:\/\/[^\s<]+[^<.,:;"')\]\s]|\/api\/[^\s]+)(?=\s|$)/g,
|
||||
/https?:\/\/(?:(?:[\w-]+\.)+[a-zA-Z]{2,6}|localhost)(?::\d{2,5})?(?:\/[\w\-./?%&=@]*)?/g,
|
||||
(match) => {
|
||||
urlPlaceholders.push(match);
|
||||
return `__URL_${urlPlaceholders.length - 1}__`;
|
||||
return `__URL_${urlPlaceholders.length - 1}__ `;
|
||||
}
|
||||
);
|
||||
|
||||
@@ -73,14 +73,14 @@ const MarkdownRender = ({ source = '', showAnimation, isDisabled, forbidZhFormat
|
||||
)
|
||||
// 处理引用标记
|
||||
.replace(/\n*(\[QUOTE SIGN\]\(.*\))/g, '$1')
|
||||
// 处理 [quote:id] 格式引用,将 [quote:675934a198f46329dfc6d05a] 转换为 [675934a198f46329dfc6d05a]()
|
||||
// 处理 [quote:id] 格式引用,将 [quote:675934a198f46329dfc6d05a] 转换为 [675934a198f46329dfc6d05a](QUOTE)
|
||||
.replace(/\[quote:?\s*([a-f0-9]{24})\](?!\()/gi, '[$1](QUOTE)')
|
||||
.replace(/\[([a-f0-9]{24})\](?!\()/g, '[$1](QUOTE)');
|
||||
|
||||
// 还原 URL
|
||||
const finalText = textWithSpaces.replace(
|
||||
/__URL_(\d+)__/g,
|
||||
(_, index) => urlPlaceholders[parseInt(index)]
|
||||
(_, index) => `${urlPlaceholders[parseInt(index)]}`
|
||||
);
|
||||
|
||||
return finalText;
|
||||
|
||||
Reference in New Issue
Block a user