|
@@ -39,6 +39,7 @@ export function useChat() {
|
|
|
const conversations = ref([]);
|
|
const conversations = ref([]);
|
|
|
const activeConversationId = ref(null);
|
|
const activeConversationId = ref(null);
|
|
|
const messages = ref([...defaultMessages]);
|
|
const messages = ref([...defaultMessages]);
|
|
|
|
|
+ const chatMode = ref("documentos");
|
|
|
const loading = ref(false);
|
|
const loading = ref(false);
|
|
|
const error = ref("");
|
|
const error = ref("");
|
|
|
const conversationsLoading = ref(false);
|
|
const conversationsLoading = ref(false);
|
|
@@ -202,6 +203,10 @@ export function useChat() {
|
|
|
error.value = "";
|
|
error.value = "";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function setMode(mode) {
|
|
|
|
|
+ chatMode.value = mode === "atendimentos" ? "atendimentos" : "documentos";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function cancelCurrentStream() {
|
|
function cancelCurrentStream() {
|
|
|
if (_streamAbort) {
|
|
if (_streamAbort) {
|
|
|
_streamAbort.abort();
|
|
_streamAbort.abort();
|
|
@@ -249,6 +254,7 @@ export function useChat() {
|
|
|
|
|
|
|
|
await sendChatStream(trimmed, {
|
|
await sendChatStream(trimmed, {
|
|
|
conversationId: convId,
|
|
conversationId: convId,
|
|
|
|
|
+ mode: chatMode.value,
|
|
|
signal: _streamAbort.signal,
|
|
signal: _streamAbort.signal,
|
|
|
onStatus: ({ stage, count }) => {
|
|
onStatus: ({ stage, count }) => {
|
|
|
if (stage === "buscando") liveMsg.statusMsg = "Buscando documentos...";
|
|
if (stage === "buscando") liveMsg.statusMsg = "Buscando documentos...";
|
|
@@ -295,12 +301,14 @@ export function useChat() {
|
|
|
conversations,
|
|
conversations,
|
|
|
activeConversationId,
|
|
activeConversationId,
|
|
|
messages,
|
|
messages,
|
|
|
|
|
+ chatMode,
|
|
|
loading,
|
|
loading,
|
|
|
error,
|
|
error,
|
|
|
conversationsLoading,
|
|
conversationsLoading,
|
|
|
conversationsError,
|
|
conversationsError,
|
|
|
conversationsHasMore,
|
|
conversationsHasMore,
|
|
|
send,
|
|
send,
|
|
|
|
|
+ setMode,
|
|
|
clearError,
|
|
clearError,
|
|
|
cancelCurrentStream,
|
|
cancelCurrentStream,
|
|
|
newConversation,
|
|
newConversation,
|