From 0a7caa314bd26bb2849e2bb77d1725cd134aad90 Mon Sep 17 00:00:00 2001 From: al Date: Thu, 2 May 2024 15:33:53 -0400 Subject: [PATCH 1/4] feat: basic embedding based chat qa --- src/components/KnowledgeStoreUploader.js | 34 +++++++++++++--- src/pages/Chat.vue | 49 ++++++++++++++++++++++-- src/stores/chats-store.js | 34 ++++++++++++---- src/stores/knowledge-store.js | 12 +++++- src/utils/chat.js | 4 ++ 5 files changed, 115 insertions(+), 18 deletions(-) diff --git a/src/components/KnowledgeStoreUploader.js b/src/components/KnowledgeStoreUploader.js index b71b229..cb67154 100644 --- a/src/components/KnowledgeStoreUploader.js +++ b/src/components/KnowledgeStoreUploader.js @@ -9,15 +9,25 @@ const pdfjsLib = window.pdfjsLib; export default createUploaderComponent({ name: 'KnowledgeStoreUploader', - props: {}, - emits: [], - injectPlugin({ _props, _emit, helpers }) { + props: { + chatRef: { + type: Object, + required: true, + }, + }, + emits: [ + 'attachment-added', + ], + injectPlugin({ props, emit, helpers }) { const loading = ref(false); + const chatId = props.chatRef.id; // Map of file objects to their status as either 'queued', 'uploading', 'embedding', 'uploaded', or 'failed' const fileStatus = ref({}); // Upload Logic + // TODO: we should be feeding the chat id through here, not through props + // We're gonna need a way to add more custom tags to the documents async function upload(_args) { // Set the loading state loading.value = true; @@ -40,12 +50,15 @@ export default createUploaderComponent({ try { fileStatus.value[file.name] = 'uploading'; helpers.updateFileStatus(file, 'uploading'); - let { title, text } = await processFile(file); + let { title, text, type } = await processFile(file); fileStatus.value[file.name] = 'embedding'; helpers.updateFileStatus(file, 'embedding'); - await knowledgeStore.addDocument(title, text); + // For now this doesn't support additional tags + let { id } = await knowledgeStore.addDocument(title, text, chatId ? [chatId] : []); + let documentId = id; fileStatus.value[file.name] = 'uploaded'; helpers.updateFileStatus(file, 'uploaded'); + emit('attachment-added', { title, documentId, type }); } catch (error) { console.error(error); fileStatus.value[file.name] = 'failed'; @@ -84,6 +97,7 @@ export default createUploaderComponent({ async function processFile(file) { const title = file.name; let extractedText = ''; + let type = file.type; try { switch (file.type) { @@ -98,6 +112,14 @@ export default createUploaderComponent({ reader.readAsText(file); }); break; + case 'text/markdown': + extractedText = await new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onload = (event) => resolve(event.target.result); + reader.onerror = (error) => reject(error); + reader.readAsText(file); + }); + break; default: throw new Error(`Unsupported file type: ${file.type}`); } @@ -106,7 +128,7 @@ export default createUploaderComponent({ throw error; } - return { title, text: extractedText }; + return { title, text: extractedText, type }; } /** diff --git a/src/pages/Chat.vue b/src/pages/Chat.vue index 69fdaa9..c8356e4 100644 --- a/src/pages/Chat.vue +++ b/src/pages/Chat.vue @@ -34,6 +34,16 @@ {{ message.role.replace(chatRef.username, 'You').replace('assistant', 'Libertai') }} + + + + {{ attachment.title }} + + @@ -80,7 +90,14 @@ style="margin-left: 16px" /> - + + {{ attachment.title }} + + { console.log('pages::Chat.vue::generatePersonaMessage - embedding search result', result); messages.push({ @@ -333,9 +368,12 @@ export default defineComponent({ console.log('pages::Chat.vue::sendMessage'); let chatId = chatRef.value.id; let inputText = inputTextRef.value; + const attachments = JSON.parse(JSON.stringify(attachmentsRef.value)); // Wipe the input text inputTextRef.value = ''; + // Wipe the attachments + attachmentsRef.value = []; nextTick(scrollBottom); @@ -344,7 +382,7 @@ export default defineComponent({ if (content.trim() === '') return; // Append the new message to the chat history and push to local state - let newMessage = await chatsStore.appendUserMessage(chatId, inputText); + let newMessage = await chatsStore.appendUserMessage(chatId, inputText, attachments); messagesRef.value.push({ ...newMessage, stopped: true, error: null }); chatRef.value.messages = messagesRef.value; await generatePersonaMessage(); @@ -445,6 +483,9 @@ export default defineComponent({ isLoadingRef, inputRef, inputTextRef, + attachmentsRef, + addAttachment, + removeAttachment, sendMessage, showKnowledgeUploaderRef, openKnowledgeUploader, diff --git a/src/stores/chats-store.js b/src/stores/chats-store.js index 2973b76..7b99c22 100644 --- a/src/stores/chats-store.js +++ b/src/stores/chats-store.js @@ -15,13 +15,30 @@ const CHATS_STORE_PINIA_KEY = 'chats-store-pinia-key'; * title: string; * username: string; * - * // From @libertai/libertai-js - * model: Model; - * persona: Persona; - * messages: Message[]; + * // From @libertai/libertai-js + * model: Model; + * persona: Persona; + * // Note: we will populate these with additional data, +* // by inlinging attachments, etc. + * messages: Message[]; * } */ +// TODO: for now all attachments are stored in the knowledge base +// but we might want to be able to inline them in the chat if small enough +/** + * Representation of an attachment: + * interface Attachment { + * // File type + * type: string; // eg 'application/pdf', 'text/plain', etc. + * // Document id within the embedding store + * documentId: string; + * // File name + * name: string; + * // TODO: inlinging strategy + * } + */ + export const useChatsStore = defineStore(CHATS_STORE_PINIA_KEY, { state: () => ({ // Interface for our ChatsStore @@ -141,10 +158,11 @@ export const useChatsStore = defineStore(CHATS_STORE_PINIA_KEY, { * @async * @param {string} chatId - the id of the chat * @param {string} message - the content of the message + * @param {[]} attachments - the attachments of the message * @returns {Promise} - the created message */ - async appendUserMessage(chatId, message) { - return await this.chatsStore.appendUserMessage(chatId, message); + async appendUserMessage(chatId, message, attachments) { + return await this.chatsStore.appendUserMessage(chatId, message, attachments); }, /** @@ -317,15 +335,17 @@ class ChatsStore { * @async * @param {string} chatId - the id of the chat * @param {string} messageContent - the content of the message + * @param {[]} attachments - the attachments of the message * @returns {Promise} - the created message * @throws {Error} - if the chat is not found */ - async appendUserMessage(chatId, messageContent) { + async appendUserMessage(chatId, messageContent, attachments) { const chat = await this.readChat(chatId); const message = { role: chat.username, content: messageContent, timestamp: new Date(), + attachments, }; chat.messages.push(message); await idb.put(chatId, chat, this.store); diff --git a/src/stores/knowledge-store.js b/src/stores/knowledge-store.js index d5bdeb6..fcba26d 100644 --- a/src/stores/knowledge-store.js +++ b/src/stores/knowledge-store.js @@ -2,6 +2,7 @@ import { defineStore } from 'pinia'; import { KnowledgeStore } from '@libertai/libertai-js'; import { defaultKnowledge } from '../utils/knowledge'; +export const DEFAULT_KNOWLEDGE_TAG = 'default'; export const KNOWLEDGE_STORE_PINIA_KEY = 'knowledge-store-pinia-key'; export const useKnowledgeStore = defineStore(KNOWLEDGE_STORE_PINIA_KEY, { @@ -22,7 +23,7 @@ export const useKnowledgeStore = defineStore(KNOWLEDGE_STORE_PINIA_KEY, { let addedDocuments = []; for (let title of missingDocuments) { let doc = defaultKnowledge.find((doc) => doc.title === title); - addedDocuments.push(this.addDocument(doc.title, doc.content, doc.tags)); + addedDocuments.push(this.addDocument(doc.title, doc.content, doc.tags.push(DEFAULT_KNOWLEDGE_TAG))); docs.push(doc); } await Promise.all(addedDocuments); @@ -32,12 +33,21 @@ export const useKnowledgeStore = defineStore(KNOWLEDGE_STORE_PINIA_KEY, { async addDocument(title, content, tags = []) { let doc = await this.knowledgeStore.addDocument(title, content, tags); this.documents.push(doc); + return doc; }, async removeDocument(documentId) { await this.knowledgeStore.removeDocument(documentId); this.documents = this.documents.filter((doc) => doc.id !== documentId); }, async searchDocuments(query, tags = []) { + // If tags aren't empty, add the default tag + // Otherwise, if tags is empty, we'll just search + // with no filters, and the default tag will be included + if (tags.length > 0) { + tags.push(DEFAULT_KNOWLEDGE_TAG); + } + + // TODO: this should prolly be none return await this.knowledgeStore.searchDocuments(query, 3, 20, tags); }, }, diff --git a/src/utils/chat.js b/src/utils/chat.js index 7759d6c..487b96a 100644 --- a/src/utils/chat.js +++ b/src/utils/chat.js @@ -2,6 +2,10 @@ import { LlamaCppApiEngine } from '@libertai/libertai-js'; import { modelDefaults, promptFormatDefaults } from './models'; +export function chatTag(id) { + return `chat-id-${id}`; +} + export const defaultChatTopic = 'New Chat'; const chatTopicPromptFormat = { From ca584a6e25735f490d803e487ca7e9b80a30167f Mon Sep 17 00:00:00 2001 From: al Date: Thu, 2 May 2024 18:02:58 -0400 Subject: [PATCH 2/4] feat: basic doc chat --- src/components/KnowledgeStoreUploader.js | 21 +++++-- src/pages/Chat.vue | 69 ++++++++++++++++++----- src/stores/chats-store.js | 70 ++++++++++++++++++------ src/stores/knowledge-store.js | 4 +- 4 files changed, 127 insertions(+), 37 deletions(-) diff --git a/src/components/KnowledgeStoreUploader.js b/src/components/KnowledgeStoreUploader.js index cb67154..8a519f9 100644 --- a/src/components/KnowledgeStoreUploader.js +++ b/src/components/KnowledgeStoreUploader.js @@ -1,6 +1,8 @@ import { createUploaderComponent } from 'quasar'; import { computed, ref } from 'vue'; +import { chatTag } from 'src/utils/chat'; + // State import { useKnowledgeStore } from 'src/stores/knowledge-store'; @@ -15,9 +17,7 @@ export default createUploaderComponent({ required: true, }, }, - emits: [ - 'attachment-added', - ], + emits: ['attachment-added'], injectPlugin({ props, emit, helpers }) { const loading = ref(false); const chatId = props.chatRef.id; @@ -51,10 +51,21 @@ export default createUploaderComponent({ fileStatus.value[file.name] = 'uploading'; helpers.updateFileStatus(file, 'uploading'); let { title, text, type } = await processFile(file); + // Check how big the file is + // If the text is less than 4 KiB, then just inline it + if (text.length < 4 * 1024) { + fileStatus.value[file.name] = 'uploaded'; + helpers.updateFileStatus(file, 'uploaded'); + // If you don't embed the doucment, make sure to set the content + emit('attachment-added', { title, type, content: text }); + return; + } + + // Embed the document fileStatus.value[file.name] = 'embedding'; helpers.updateFileStatus(file, 'embedding'); - // For now this doesn't support additional tags - let { id } = await knowledgeStore.addDocument(title, text, chatId ? [chatId] : []); + let tag = chatTag(chatId); + let { id } = await knowledgeStore.addDocument(title, text, [tag]); let documentId = id; fileStatus.value[file.name] = 'uploaded'; helpers.updateFileStatus(file, 'uploaded'); diff --git a/src/pages/Chat.vue b/src/pages/Chat.vue index c8356e4..37a7cf6 100644 --- a/src/pages/Chat.vue +++ b/src/pages/Chat.vue @@ -137,20 +137,20 @@ import { useQuasar, copyToClipboard } from 'quasar'; import { defineComponent, ref, watch, nextTick, onMounted } from 'vue'; import { useRoute, useRouter } from 'vue-router'; -import { inferChatTopic, defaultChatTopic, chatTag } from 'src/utils/chat'; +import { inferChatTopic, defaultChatTopic } from 'src/utils/chat'; // LlamaCppApiEngine import { LlamaCppApiEngine } from '@libertai/libertai-js'; // Local state -import { useChatsStore } from '../stores/chats-store'; -import { useModelsStore } from '../stores/models-store'; -import { useKnowledgeStore } from '../stores/knowledge-store'; +import { useChatsStore } from 'src/stores/chats-store'; +import { useModelsStore } from 'src/stores/models-store'; +import { useKnowledgeStore } from 'src/stores/knowledge-store'; import { useAccount } from 'src/stores/account'; // Components -import MarkdownRenderer from '../components/MarkdownRenderer.vue'; -import MessageInput from '../components/MessageInput.vue'; +import MarkdownRenderer from 'src/components/MarkdownRenderer.vue'; +import MessageInput from 'src/components/MessageInput.vue'; import axios from 'axios'; console.log(nextTick); @@ -278,7 +278,7 @@ export default defineComponent({ // Generate a new response from the AI async function generatePersonaMessage() { let chatId = chatRef.value.id; - let chatTagStr = chatTag(chatId); + let chatTags = chatRef.value.tags; let messages = JSON.parse(JSON.stringify(messagesRef.value)); let persona = personaRef.value; let username = usernameRef.value; @@ -304,25 +304,68 @@ export default defineComponent({ // NOTE: assuming last message is gauranteed to be non-empty and the user's last message // Get the last message from the user let lastMessage = messages[messages.length - 1]; - // TODO: we should probably create chat-level tags to let user's customize search - let searchResults = await knowledgeStore.searchDocuments(lastMessage.content, [chatTagStr]); + let searchResultMessages = []; + let searchResults = await knowledgeStore.searchDocuments(lastMessage.content, chatTags); searchResults.forEach((result) => { console.log('pages::Chat.vue::generatePersonaMessage - embedding search result', result); - messages.push({ + searchResultMessages.push({ role: 'search-result', content: result.content, }); }); + // Expand all the messages to inline any compatible attachments + const exapndedMessages = messages.map((message) => { + let ret = []; + // Push any attachments ahead of the message + if (message.attachments) { + message.attachments.forEach((attachment) => { + if (attachment.content) { + ret.push({ + role: 'attachment', + content: `[${attachment.title}](${attachment.content})`, + }); + } else if (attachment.documentId) { + ret.push({ + role: 'attachment', + content: `[${attachment.title}](document-id-${attachment.documentId})`, + }) + } + }); + } + + // Push what search results we found based on the message + // TODO: this should prabably be a more generic tool-call or llm-chain-link + // TODO: this should probably link back to the document id + // TODO: I should probably write these below messages in the log + // Really these search results should get attached to the message that + // lead to them being queried + if (message.searchResults) { + console.log('pages::Chat.vue::generatePersonaMessage - embedding search results', message.searchResults); + message.searchResults.forEach((result) => { + ret.push({ + role: 'search-result', + content: result.content, + }); + }); + } + // Push the message itself + ret.push(message); + return ret; + }).flat(); + + // Append the search results to the messages + const allMessages = [...exapndedMessages, ...searchResultMessages]; + // Generate a stream of responses from the AI for await (const output of inferenceEngine.generateAnswer( - messages, + allMessages, model, persona, // Set the target to the user username, // set to false to disable logging - false, + true, )) { let stopped = output.stopped; let content = output.content; @@ -335,7 +378,7 @@ export default defineComponent({ messagesRef.value = [...messagesRef.value]; } // A successful response! Append the chat to long term storage. - await chatsStore.appendModelResponse(chatId, response.content); + await chatsStore.appendModelResponse(chatId, response.content, searchResults); } catch (error) { console.error('pages::Chat.vue::generatePersonaMessage - error', error); response.error = error; diff --git a/src/stores/chats-store.js b/src/stores/chats-store.js index 7b99c22..a70068f 100644 --- a/src/stores/chats-store.js +++ b/src/stores/chats-store.js @@ -2,6 +2,7 @@ import { v4 as uuidv4 } from 'uuid'; import { defineStore } from 'pinia'; import { defaultModels } from 'src/utils/models'; +import { chatTag } from 'src/utils/chat'; import * as idb from 'src/utils/idb'; const CHATS_STORE_NAME = 'chats-store'; @@ -14,31 +15,42 @@ const CHATS_STORE_PINIA_KEY = 'chats-store-pinia-key'; * id: string; * title: string; * username: string; + * tags: string[]; * - * // From @libertai/libertai-js - * model: Model; - * persona: Persona; - * // Note: we will populate these with additional data, -* // by inlinging attachments, etc. - * messages: Message[]; - * } + * // From @libertai/libertai-js + * model: Model; + * persona: Persona; + * // Note: we will populate these with additional data, + * // by inlinging attachments, search-results, etc. + * messages: Message[]; + * } */ -// TODO: for now all attachments are stored in the knowledge base -// but we might want to be able to inline them in the chat if small enough /** * Representation of an attachment: * interface Attachment { * // File type * type: string; // eg 'application/pdf', 'text/plain', etc. - * // Document id within the embedding store - * documentId: string; * // File name * name: string; - * // TODO: inlinging strategy + * // Document id within the embedding store, if stored there + * documentId: string?; + * // The content of the attachment, if stored inlined + * content: string?; * } */ +// TODO: Search results are not yet implemented +/** +* Representation of a search result: +* interface SearchResult { +* // embedding document id +* documentId: string; +* // embdedding conent +* content: string; +* } +*/ + export const useChatsStore = defineStore(CHATS_STORE_PINIA_KEY, { state: () => ({ // Interface for our ChatsStore @@ -84,7 +96,9 @@ export const useChatsStore = defineStore(CHATS_STORE_PINIA_KEY, { * @returns {Promise} - the created chat */ async createChat(title, username, model, persona) { - const chat = await this.chatsStore.createChat(title, username, model, persona); + const chat = await this.chatsStore.createChat(title, username, [], model, persona); + const tag = chatTag(chat.id); + await this.chatsStore.pushChatTag(chat.id, tag); this.chats.push(chat); return chat; }, @@ -158,7 +172,7 @@ export const useChatsStore = defineStore(CHATS_STORE_PINIA_KEY, { * @async * @param {string} chatId - the id of the chat * @param {string} message - the content of the message - * @param {[]} attachments - the attachments of the message + * @param {[]} attachments - the attachments of the message * @returns {Promise} - the created message */ async appendUserMessage(chatId, message, attachments) { @@ -172,8 +186,8 @@ export const useChatsStore = defineStore(CHATS_STORE_PINIA_KEY, { * @param {string} response - the content of the response * @returns {Promise} - the created message */ - async appendModelResponse(chatId, response) { - return await this.chatsStore.appendModelResponse(chatId, response); + async appendModelResponse(chatId, response, searchResults) { + return await this.chatsStore.appendModelResponse(chatId, response, searchResults); }, /** @@ -252,15 +266,17 @@ class ChatsStore { * @async * @param {string} title - the title of the chat * @param {string} username - the username of the user + * @param {string[]} tags - the tags of the chat * @param {Model} model - the model to use for the chat * @param {Persona} persona - the persona to use for the chat * @returns {Promise} - the created chat */ - async createChat(title, username, model, persona) { + async createChat(title, username, tags, model, persona) { const id = uuidv4(); const chat = { id, title, + tags, username, model, persona, @@ -302,6 +318,23 @@ class ChatsStore { return chat; } + /** + * Push a tag to a chat + * @async + * @param {string} chatId - the id of the chat + * @param {string} tag - the tag to push + * @returns {Promise} + * @throws {Error} - if the tag is already in the chat + */ + async pushChatTag(chatId, tag) { + const chat = await this.readChat(chatId); + if (chat.tags.includes(tag)) { + throw new Error('Tag already in chat'); + } + chat.tags.push(tag); + await idb.put(chatId, chat, this.store); + } + /** * Update a chat with a partial data * @async @@ -360,12 +393,13 @@ class ChatsStore { * @returns {Promise} - the created message * @throws {Error} - if the chat is not found */ - async appendModelResponse(chatId, responseContent) { + async appendModelResponse(chatId, responseContent, searchResults) { const chat = await this.readChat(chatId); const message = { role: chat.persona.name, content: responseContent, timestamp: new Date(), + searchResults, }; chat.messages.push(message); await idb.put(chatId, chat, this.store); diff --git a/src/stores/knowledge-store.js b/src/stores/knowledge-store.js index fcba26d..68c80699 100644 --- a/src/stores/knowledge-store.js +++ b/src/stores/knowledge-store.js @@ -23,7 +23,9 @@ export const useKnowledgeStore = defineStore(KNOWLEDGE_STORE_PINIA_KEY, { let addedDocuments = []; for (let title of missingDocuments) { let doc = defaultKnowledge.find((doc) => doc.title === title); - addedDocuments.push(this.addDocument(doc.title, doc.content, doc.tags.push(DEFAULT_KNOWLEDGE_TAG))); + let tags = doc.tags ? doc.tags : []; + tags.push(DEFAULT_KNOWLEDGE_TAG); + addedDocuments.push(this.addDocument(doc.title, doc.content, tags)); docs.push(doc); } await Promise.all(addedDocuments); From 3ab4c1166f6436c2066c4ee006038a3e78dc09de Mon Sep 17 00:00:00 2001 From: al Date: Thu, 2 May 2024 18:06:21 -0400 Subject: [PATCH 3/4] fix: fmt --- src/pages/Chat.vue | 72 ++++++++++++++++++++------------------- src/stores/chats-store.js | 16 ++++----- 2 files changed, 45 insertions(+), 43 deletions(-) diff --git a/src/pages/Chat.vue b/src/pages/Chat.vue index 37a7cf6..d372391 100644 --- a/src/pages/Chat.vue +++ b/src/pages/Chat.vue @@ -315,44 +315,46 @@ export default defineComponent({ }); // Expand all the messages to inline any compatible attachments - const exapndedMessages = messages.map((message) => { - let ret = []; - // Push any attachments ahead of the message - if (message.attachments) { - message.attachments.forEach((attachment) => { - if (attachment.content) { + const exapndedMessages = messages + .map((message) => { + let ret = []; + // Push any attachments ahead of the message + if (message.attachments) { + message.attachments.forEach((attachment) => { + if (attachment.content) { + ret.push({ + role: 'attachment', + content: `[${attachment.title}](${attachment.content})`, + }); + } else if (attachment.documentId) { + ret.push({ + role: 'attachment', + content: `[${attachment.title}](document-id-${attachment.documentId})`, + }); + } + }); + } + + // Push what search results we found based on the message + // TODO: this should prabably be a more generic tool-call or llm-chain-link + // TODO: this should probably link back to the document id + // TODO: I should probably write these below messages in the log + // Really these search results should get attached to the message that + // lead to them being queried + if (message.searchResults) { + console.log('pages::Chat.vue::generatePersonaMessage - embedding search results', message.searchResults); + message.searchResults.forEach((result) => { ret.push({ - role: 'attachment', - content: `[${attachment.title}](${attachment.content})`, + role: 'search-result', + content: result.content, }); - } else if (attachment.documentId) { - ret.push({ - role: 'attachment', - content: `[${attachment.title}](document-id-${attachment.documentId})`, - }) - } - }); - } - - // Push what search results we found based on the message - // TODO: this should prabably be a more generic tool-call or llm-chain-link - // TODO: this should probably link back to the document id - // TODO: I should probably write these below messages in the log - // Really these search results should get attached to the message that - // lead to them being queried - if (message.searchResults) { - console.log('pages::Chat.vue::generatePersonaMessage - embedding search results', message.searchResults); - message.searchResults.forEach((result) => { - ret.push({ - role: 'search-result', - content: result.content, }); - }); - } - // Push the message itself - ret.push(message); - return ret; - }).flat(); + } + // Push the message itself + ret.push(message); + return ret; + }) + .flat(); // Append the search results to the messages const allMessages = [...exapndedMessages, ...searchResultMessages]; diff --git a/src/stores/chats-store.js b/src/stores/chats-store.js index a70068f..ce1eee0 100644 --- a/src/stores/chats-store.js +++ b/src/stores/chats-store.js @@ -42,14 +42,14 @@ const CHATS_STORE_PINIA_KEY = 'chats-store-pinia-key'; // TODO: Search results are not yet implemented /** -* Representation of a search result: -* interface SearchResult { -* // embedding document id -* documentId: string; -* // embdedding conent -* content: string; -* } -*/ + * Representation of a search result: + * interface SearchResult { + * // embedding document id + * documentId: string; + * // embdedding conent + * content: string; + * } + */ export const useChatsStore = defineStore(CHATS_STORE_PINIA_KEY, { state: () => ({ From 48d81b5c742e26080a620993a872ec9d2d3d0ace Mon Sep 17 00:00:00 2001 From: al Date: Thu, 2 May 2024 18:14:23 -0400 Subject: [PATCH 4/4] fix: rm logs --- src/pages/Chat.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/Chat.vue b/src/pages/Chat.vue index d372391..be6b101 100644 --- a/src/pages/Chat.vue +++ b/src/pages/Chat.vue @@ -307,7 +307,6 @@ export default defineComponent({ let searchResultMessages = []; let searchResults = await knowledgeStore.searchDocuments(lastMessage.content, chatTags); searchResults.forEach((result) => { - console.log('pages::Chat.vue::generatePersonaMessage - embedding search result', result); searchResultMessages.push({ role: 'search-result', content: result.content, @@ -342,7 +341,6 @@ export default defineComponent({ // Really these search results should get attached to the message that // lead to them being queried if (message.searchResults) { - console.log('pages::Chat.vue::generatePersonaMessage - embedding search results', message.searchResults); message.searchResults.forEach((result) => { ret.push({ role: 'search-result', @@ -367,7 +365,7 @@ export default defineComponent({ // Set the target to the user username, // set to false to disable logging - true, + false, )) { let stopped = output.stopped; let content = output.content;