mirror of
https://github.com/Yanyutin753/ChatGPT-Next-Web-LangChain-Gpt-4-All.git
synced 2025-10-18 01:01:04 +00:00
适配上传不同类型的文件,适配gpt-4-all,支持包含vision字段的模型,自动打开上传文件按钮
This commit is contained in:
@@ -121,10 +121,25 @@ function _MarkDownContent(props: { content: string; imageBase64?: string }) {
|
||||
() => escapeDollarNumber(props.content),
|
||||
[props.content],
|
||||
);
|
||||
// 判断文件路径
|
||||
const isImage = (filename: any) => {
|
||||
const imageExtensions = ['.png', '.jpg', '.jpeg', '.gif', '.bmp', '.webp', '.tiff'];
|
||||
return imageExtensions.some(ext => filename.toLowerCase().endsWith(ext));
|
||||
};
|
||||
|
||||
const show_filename = (base64: any) => {
|
||||
let parts = base64.split("/");
|
||||
return parts.pop();
|
||||
};
|
||||
return (
|
||||
<div style={{ fontSize: "inherit" }}>
|
||||
{props.imageBase64 && <img src={props.imageBase64} alt="" />}
|
||||
{props.imageBase64 && isImage(props.imageBase64) && <img src={props.imageBase64} alt="" />}
|
||||
{props.imageBase64 && !isImage(props.imageBase64) &&
|
||||
<a href={props.imageBase64} style={{ fontWeight: 'bold' }}>
|
||||
文件:{show_filename(props.imageBase64)}
|
||||
</a>
|
||||
}
|
||||
|
||||
<ReactMarkdown
|
||||
remarkPlugins={[RemarkMath, RemarkGfm, RemarkBreaks]}
|
||||
rehypePlugins={[
|
||||
|
Reference in New Issue
Block a user