fix: resolve biome format/lint issues in chat attachment files

This commit is contained in:
Vorflux AI 2026-06-01 15:14:58 +00:00
parent 4159985933
commit 28e701a4d9
3 changed files with 45 additions and 23 deletions

View file

@ -333,7 +333,11 @@ export function ChatSidebar({
}, [])
const handleSend = (attachments?: import("ai").FileUIPart[]) => {
if ((!input.trim() && (!attachments || attachments.length === 0)) || status === "submitted" || status === "streaming")
if (
(!input.trim() && (!attachments || attachments.length === 0)) ||
status === "submitted" ||
status === "streaming"
)
return
if (!threadId) setThreadId(fallbackChatId)
analytics.chatMessageSent({ source: "typed" })

View file

@ -9,7 +9,8 @@ import { motion } from "motion/react"
import type { FileUIPart } from "ai"
import { SendButton, StopButton } from "./actions"
const ACCEPTED_FILE_TYPES = "image/jpeg,image/png,image/gif,image/webp,application/pdf"
const ACCEPTED_FILE_TYPES =
"image/jpeg,image/png,image/gif,image/webp,application/pdf"
const MAX_FILE_SIZE_MB = 10
const MAX_TOTAL_SIZE_MB = 20
const MAX_FILE_COUNT = 5
@ -147,8 +148,11 @@ export default function ChatInput({
const attachmentChips = attachments.length > 0 && (
<div className="flex flex-wrap gap-1.5 px-1 pt-1">
{attachments.map((att, i) => (
// biome-ignore lint/suspicious/noArrayIndexKey: stable list
<AttachmentChip key={i} attachment={att} onRemove={() => removeAttachment(i)} />
<AttachmentChip
key={i}
attachment={att}
onRemove={() => removeAttachment(i)}
/>
))}
</div>
)
@ -263,7 +267,10 @@ export default function ChatInput({
{isResponding ? (
<StopButton onClick={onStop} />
) : (
<SendButton onClick={handleSend} disabled={!value.trim() && attachments.length === 0} />
<SendButton
onClick={handleSend}
disabled={!value.trim() && attachments.length === 0}
/>
)}
</div>
</div>
@ -287,12 +294,20 @@ export default function ChatInput({
rows={1}
disabled={isResponding}
/>
<div className={cn("flex items-center gap-1 transition-all duration-200", isMultiline && "w-full justify-end")}>
<div
className={cn(
"flex items-center gap-1 transition-all duration-200",
isMultiline && "w-full justify-end",
)}
>
{paperclipButton}
{isResponding ? (
<StopButton onClick={onStop} />
) : (
<SendButton onClick={handleSend} disabled={!value.trim() && attachments.length === 0} />
<SendButton
onClick={handleSend}
disabled={!value.trim() && attachments.length === 0}
/>
)}
</div>
</div>

View file

@ -21,7 +21,8 @@ export const UserMessage = memo(function UserMessage({
.join(" ")
const files = message.parts.filter(
(part): part is Extract<typeof part, { type: "file" }> => part.type === "file",
(part): part is Extract<typeof part, { type: "file" }> =>
part.type === "file",
)
return (
@ -33,7 +34,6 @@ export const UserMessage = memo(function UserMessage({
return isImage ? (
// eslint-disable-next-line @next/next/no-img-element
<img
// biome-ignore lint/suspicious/noArrayIndexKey: stable list
key={i}
src={f.url}
alt={f.filename ?? "attachment"}
@ -41,12 +41,13 @@ export const UserMessage = memo(function UserMessage({
/>
) : (
<div
// biome-ignore lint/suspicious/noArrayIndexKey: stable list
key={i}
className="flex items-center gap-2 rounded-xl border border-white/10 bg-[#1B1F24] px-3 py-2 text-xs text-white/60"
>
<FileText className="size-3.5 shrink-0" />
<span className="truncate max-w-[120px]">{f.filename ?? "file"}</span>
<span className="truncate max-w-[120px]">
{f.filename ?? "file"}
</span>
</div>
)
})}
@ -57,18 +58,20 @@ export const UserMessage = memo(function UserMessage({
<p className="text-sm text-white">{text}</p>
</div>
)}
{text && <button
type="button"
onClick={() => onCopy(message.id, text)}
className="p-1.5 hover:bg-[#293952]/40 rounded transition-colors mt-1"
title="Copy message"
>
{copiedMessageId === message.id ? (
<Check className="size-3.5 text-green-400" />
) : (
<Copy className="size-3.5 text-white/50" />
)}
</button>}
{text && (
<button
type="button"
onClick={() => onCopy(message.id, text)}
className="p-1.5 hover:bg-[#293952]/40 rounded transition-colors mt-1"
title="Copy message"
>
{copiedMessageId === message.id ? (
<Check className="size-3.5 text-green-400" />
) : (
<Copy className="size-3.5 text-white/50" />
)}
</button>
)}
</div>
)
})