leonardo 4 napja
szülő
commit
710a1a70ea

+ 2 - 2
src/api/chat.js

@@ -1,7 +1,7 @@
 import { apiBaseUrl, apiFetch, buildAuthHeaders, fetchAutenticado, refreshAccessToken, notifyAuthError, extractErrorMessage } from "./client.js";
 
-export async function sendChatStream(message, { conversationId, mode, onChunk, onSources, onStatus, onDone, onError, signal } = {}) {
-  const body = JSON.stringify({ message, ...(conversationId ? { conversationId } : {}), ...(mode ? { mode } : {}) });
+export async function sendChatStream(message, { conversationId, onChunk, onSources, onStatus, onDone, onError, signal } = {}) {
+  const body = JSON.stringify({ message, ...(conversationId ? { conversationId } : {}) });
 
   let res;
   try {

+ 0 - 27
src/components/ChatModeToggle.vue

@@ -1,27 +0,0 @@
-<template>
-  <div class="inline-flex items-center gap-1 rounded-lg border border-gray-200 bg-gray-50 p-0.5 text-xs dark:border-gray-700 dark:bg-gray-800/50">
-    <button
-      type="button"
-      class="rounded-md px-2.5 py-1 font-medium transition-colors"
-      :class="mode === 'documentos' ? 'bg-white text-foreground shadow-sm dark:bg-gray-700' : 'text-muted-foreground'"
-      @click="$emit('update:mode', 'documentos')"
-    >
-      Documentos
-    </button>
-    <button
-      type="button"
-      class="rounded-md px-2.5 py-1 font-medium transition-colors"
-      :class="mode === 'atendimentos' ? 'bg-white text-foreground shadow-sm dark:bg-gray-700' : 'text-muted-foreground'"
-      @click="$emit('update:mode', 'atendimentos')"
-    >
-      Atendimentos
-    </button>
-  </div>
-</template>
-
-<script setup>
-defineProps({
-  mode: { type: String, default: "documentos" }
-});
-defineEmits(["update:mode"]);
-</script>

+ 2 - 6
src/components/ChatWindow.vue

@@ -101,8 +101,6 @@
       </div>
     </div>
 
-    <ChatModeToggle class="self-start" :mode="mode" @update:mode="$emit('update:mode', $event)" />
-
     <div class="grid gap-3 md:grid-cols-[1fr_auto] md:items-end">
       <textarea
         v-model="draft"
@@ -143,17 +141,15 @@ import { formatarHora } from "../utils/data.js";
 import BaseButton from "./base/BaseButton.vue";
 import BaseIcon from "./base/BaseIcon.vue";
 import { Copy, Check, FileText, Send, X } from "lucide-vue-next";
-import ChatModeToggle from "./ChatModeToggle.vue";
 import ChatMessageContent from "./ChatMessageContent.vue";
 
 const props = defineProps({
   messages: { type: Array, required: true },
   loading: { type: Boolean, required: true },
-  error: { type: String, required: true },
-  mode: { type: String, default: "documentos" }
+  error: { type: String, required: true }
 });
 
-const emit = defineEmits(["send", "clearError", "update:mode"]);
+const emit = defineEmits(["send", "clearError"]);
 
 const draft = ref("");
 const chatEl = ref(null);

+ 0 - 8
src/composables/useChat.js

@@ -50,7 +50,6 @@ export function useChat() {
   const conversations = ref([]);
   const activeConversationId = ref(null);
   const messages = ref([...defaultMessages]);
-  const chatMode = ref("documentos");
   const loading = ref(false);
   const error = ref("");
   const conversationsLoading = ref(false);
@@ -217,10 +216,6 @@ export function useChat() {
     error.value = "";
   }
 
-  function setMode(mode) {
-    chatMode.value = mode === "atendimentos" ? "atendimentos" : "documentos";
-  }
-
   function cancelCurrentStream() {
     _flushStream?.();
     if (_streamAbort) {
@@ -307,7 +302,6 @@ export function useChat() {
     try {
       await sendChatStream(trimmed, {
         conversationId: convId,
-        mode: chatMode.value,
         signal: abortController.signal,
         onStatus: ({ stage, count }) => {
           if (stage === "buscando") liveMsg.statusMsg = "Buscando documentos...";
@@ -374,14 +368,12 @@ export function useChat() {
     conversations,
     activeConversationId,
     messages,
-    chatMode,
     loading,
     error,
     conversationsLoading,
     conversationsError,
     conversationsHasMore,
     send,
-    setMode,
     clearError,
     cancelCurrentStream,
     newConversation,

+ 1 - 6
src/views/pagina-inicial/PaginaInicialView.vue

@@ -1,7 +1,6 @@
 <script setup>
 import { computed, nextTick, onMounted, onUnmounted, ref, watch } from "vue";
 import ChatWindow from "../../components/ChatWindow.vue";
-import ChatModeToggle from "../../components/ChatModeToggle.vue";
 import LayoutSistema from "../../layout/LayoutSistema.vue";
 import { useChat } from "../../composables/useChat.js";
 import BaseButton from "../../components/base/BaseButton.vue";
@@ -12,9 +11,7 @@ const {
   messages: chatMessages,
   loading: chatLoading,
   error: chatError,
-  chatMode,
   send: sendMessage,
-  setMode,
   clearError,
   cancelCurrentStream,
   activeConversationId,
@@ -149,8 +146,6 @@ onMounted(() => {
               Enviar
             </BaseButton>
           </div>
-
-          <ChatModeToggle class="mt-3" :mode="chatMode" @update:mode="setMode" />
         </div>
 
         <div v-if="chatError" class="mt-3 flex items-center justify-between gap-2 rounded-xl border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-600 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300">
@@ -176,7 +171,7 @@ onMounted(() => {
             {{ exportando ? "Exportando..." : "Exportar .md" }}
           </button>
         </div>
-        <ChatWindow class="flex-1 min-h-1" :messages="chatMessages" :loading="chatLoading" :error="chatError" :mode="chatMode" @send="sendMessage" @clear-error="clearError" @update:mode="setMode" />
+        <ChatWindow class="flex-1 min-h-1" :messages="chatMessages" :loading="chatLoading" :error="chatError" @send="sendMessage" @clear-error="clearError" />
       </div>
     </div>
   </LayoutSistema>