leonardo 2 ماه پیش
والد
کامیت
34a79ea7bf
2فایلهای تغییر یافته به همراه8 افزوده شده و 6 حذف شده
  1. 2 2
      dist/index.html
  2. 6 4
      src/components/ChatWindow.vue

+ 2 - 2
dist/index.html

@@ -6,8 +6,8 @@
     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1" />
     <link rel="icon" type="image/x-icon" href="/favicon.ico?v=2" />
     <title>ORÁCULO</title>
-    <script type="module" crossorigin src="/assets/index-B5Tyh7gQ.js"></script>
-    <link rel="stylesheet" crossorigin href="/assets/index-BovA5VUQ.css">
+    <script type="module" crossorigin src="/assets/index-fdZrkscK.js"></script>
+    <link rel="stylesheet" crossorigin href="/assets/index-Giq68b07.css">
   </head>
   <body class="bg-background">
     <noscript>

+ 6 - 4
src/components/ChatWindow.vue

@@ -67,7 +67,7 @@
             </div>
 
             <div
-              v-if="m.role === 'assistant' && m.sources?.length"
+              v-if="m.role === 'assistant' && agruparFontes(m.sources).length"
               class="mt-1.5 flex flex-wrap gap-1"
             >
               <span
@@ -226,10 +226,12 @@ marked.use({
 function agruparFontes(sources) {
   const porDocumento = new Map();
   for (const s of sources ?? []) {
-    const chave = s.source ?? "";
-    const grupo = porDocumento.get(chave);
+    // hits sem source (ex.: agregação no modo atendimentos, tipo "quantos atendimentos no setor X")
+    // não têm documento/protocolo para citar — não faz sentido mostrar uma pill vazia
+    if (!s.source) continue;
+    const grupo = porDocumento.get(s.source);
     if (grupo) grupo.count += 1;
-    else porDocumento.set(chave, { ...s, count: 1 });
+    else porDocumento.set(s.source, { ...s, count: 1 });
   }
   return [...porDocumento.values()];
 }