chat: remover placeholder [Anexo]

This commit is contained in:
esdrasrenan 2025-12-12 23:31:35 -03:00
parent 119ada60a6
commit ce5ea5dad5
3 changed files with 42 additions and 21 deletions

View file

@ -612,7 +612,7 @@ export function ChatWidget({ ticketId, ticketRef }: ChatWidgetProps) {
setIsSending(true)
try {
const bodyToSend = messageText || (attachmentsToSend.length > 0 ? "[Anexo]" : "")
const bodyToSend = messageText
const cfg = await ensureConfig()
await invoke("send_chat_message", {
baseUrl: cfg.apiBaseUrl,
@ -814,6 +814,9 @@ export function ChatWidget({ ticketId, ticketRef }: ChatWidgetProps) {
// No desktop: isFromMachine=true significa mensagem do cliente (maquina)
// Layout igual à web: cliente à esquerda, agente à direita
const isAgent = !msg.isFromMachine
const bodyText = msg.body.trim()
const shouldShowBody =
bodyText.length > 0 && !(bodyText === "[Anexo]" && (msg.attachments?.length ?? 0) > 0)
return (
<div key={msg.id} className="space-y-2">
{firstUnreadAgentMessageId === msg.id && unreadCount > 0 && !isAtBottom && (
@ -856,7 +859,7 @@ export function ChatWidget({ ticketId, ticketRef }: ChatWidgetProps) {
{msg.authorName}
</p>
)}
<p className="whitespace-pre-wrap text-sm">{msg.body}</p>
{shouldShowBody && <p className="whitespace-pre-wrap text-sm">{msg.body}</p>}
{/* Anexos */}
{msg.attachments && msg.attachments.length > 0 && (
<div className="mt-2 space-y-2">