Update chat.tsx

This commit is contained in:
Yanyutin753
2024-04-13 11:14:19 +08:00
parent e7cc2a8c55
commit 24c8ca610c

View File

@@ -373,17 +373,17 @@ function ChatAction(props: {
style={ style={
props.icon && !props.loding props.icon && !props.loding
? ({ ? ({
"--icon-width": `${width.icon}px`, "--icon-width": `${width.icon}px`,
"--full-width": `${width.full}px`, "--full-width": `${width.full}px`,
...props.style, ...props.style,
} as React.CSSProperties) } as React.CSSProperties)
: props.loding : props.loding
? ({ ? ({
"--icon-width": `30px`, "--icon-width": `30px`,
"--full-width": `30px`, "--full-width": `30px`,
...props.style, ...props.style,
} as React.CSSProperties) } as React.CSSProperties)
: props.style : props.style
} }
> >
{props.icon ? ( {props.icon ? (
@@ -622,22 +622,24 @@ export function ChatActions(props: {
)} )}
{(currentModel.includes("vision") || currentModel.includes("gizmo")) && ( {(currentModel.includes("vision") || currentModel.includes("gizmo")) && (
<ChatAction <ChatAction
onClick={selectImage} onClick={selectImages}
text="选择文件" text="选择文件"
loding={uploadLoading} loading={uploadLoading}
icon={<UploadIcon />} icon={<UploadIcon />}
innerNode={ innerNode={
<input <input
type="file" type="file"
multiple
accept="*/*" accept="*/*"
id="chat-image-file-select-upload" id="chat-image-file-select-upload"
style={{ display: "none" }} style={{ display: "none" }}
onChange={onImageSelected} onChange={onImagesSelected}
/> />
} }
/> />
)} )}
{showModelSelector && ( {showModelSelector && (
<Selector <Selector
defaultSelectedValue={currentModel} defaultSelectedValue={currentModel}
@@ -1031,28 +1033,28 @@ function _Chat() {
.concat( .concat(
isLoading isLoading
? [ ? [
{ {
...createMessage({ ...createMessage({
role: "assistant", role: "assistant",
content: "……", content: "……",
}), }),
preview: true, preview: true,
}, },
] ]
: [], : [],
) )
.concat( .concat(
userInput.length > 0 && config.sendPreviewBubble userInput.length > 0 && config.sendPreviewBubble
? [ ? [
{ {
...createMessage({ ...createMessage({
role: "user", role: "user",
content: userInput, content: userInput,
image_url: userImage?.fileUrl, image_url: userImage?.fileUrl,
}), }),
preview: true, preview: true,
}, },
] ]
: [], : [],
); );
}, [ }, [
@@ -1149,7 +1151,7 @@ function _Chat() {
if (payload.key || payload.url) { if (payload.key || payload.url) {
showConfirm( showConfirm(
Locale.URLCommand.Settings + Locale.URLCommand.Settings +
`\n${JSON.stringify(payload, null, 4)}`, `\n${JSON.stringify(payload, null, 4)}`,
).then((res) => { ).then((res) => {
if (!res) return; if (!res) return;
if (payload.key) { if (payload.key) {