-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a4eb92
commit 5fe4f6e
Showing
9 changed files
with
54 additions
and
101 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,3 @@ | ||
<template> | ||
<router-view /> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { onMounted } from 'vue'; | ||
import { useKnowledgeStore } from 'stores/knowledge'; | ||
const knowledgeStore = useKnowledgeStore(); | ||
onMounted(() => { | ||
// Set the knowledge store to load when the app is mounted | ||
knowledgeStore.load(); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,11 @@ | ||
<template> | ||
<q-layout container style="height: 100vh" view="hHh lpR fff"> | ||
<q-header class="bg-primary text-white" elevated> | ||
<q-toolbar class="row justify-between items-center q-px-lg"> | ||
<q-btn dense flat icon="home" round @click="$router.push('/')" /> | ||
<q-toolbar-title>Knowledge Database</q-toolbar-title> | ||
</q-toolbar> | ||
</q-header> | ||
|
||
<q-page-container> | ||
<div class="row justify-center q-pa-md"> | ||
<div class="col-lg-8 col-sm-12"> | ||
<q-list> | ||
<q-item v-for="document in documents" :key="document.id" clickable @click="onRowClick(document)"> | ||
<q-item-section> | ||
<q-item-label>{{ document.title }}</q-item-label> | ||
</q-item-section> | ||
<!-- If the document is selected, show the deletion icon --> | ||
<q-item-section v-if="selectedDocumentId === document.id" side> | ||
<q-btn-group dense flat> | ||
<q-btn icon="delete" @click="removeSelectedDocument" /> | ||
<q-tooltip>Remove Document</q-tooltip> | ||
</q-btn-group> | ||
</q-item-section> | ||
</q-item> | ||
</q-list> | ||
</div> | ||
</div> | ||
</q-page-container> | ||
</q-layout> | ||
<section class="max-sm:tw-mx-4 md:tw-mx-10 tw-my-5"> | ||
<h4 class="text-h4 text-semibold tw-mb-5">Knowledge base</h4> | ||
<p>Manage your knowledge bases</p> | ||
<div class="tw-my-4 tw-flex md:tw-justify-end"> | ||
<q-btn icon="img:icons/svg/add.svg" label="Create knowledge base" no-caps unelevated /> | ||
</div> | ||
</section> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { ref } from 'vue'; | ||
import { storeToRefs } from 'pinia'; | ||
import { Document } from '@libertai/libertai-js'; | ||
import { useKnowledgeStore } from 'stores/knowledge'; | ||
const knowledgeStore = useKnowledgeStore(); | ||
// Columns for the table displaying documents | ||
// const columns = [ | ||
// { name: 'id', label: 'ID', field: 'id' }, | ||
// { name: 'title', label: 'Title', field: 'title' }, | ||
// ]; | ||
// Documents data source | ||
const { documents } = storeToRefs(knowledgeStore); | ||
// Selected document | ||
// const selectedDocument = ref(null); | ||
const selectedDocumentId = ref<string | null>(null); | ||
// Edited document object | ||
// const editedDocument = ref({ title: '', description: '' }); | ||
// Form title based on whether we're adding or editing a document | ||
// const formTitle = computed(() => (selectedDocument.value ? 'Edit Document' : 'Add Document')); | ||
// On row click event handler for the table | ||
function onRowClick(row: Document) { | ||
selectedDocumentId.value = row.id; | ||
} | ||
async function removeSelectedDocument() { | ||
if (selectedDocumentId.value) { | ||
await knowledgeStore.removeDocument(selectedDocumentId.value); | ||
selectedDocumentId.value = null; | ||
} | ||
} | ||
</script> | ||
<script lang="ts" setup></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters