in similarity search axios is used

This commit is contained in:
sumedh
2024-08-09 00:21:52 +05:30
parent 174106af5b
commit 55dd8ce8a3
4 changed files with 50 additions and 31 deletions

View File

@@ -42,5 +42,6 @@ docker-build:
- if: $CI_COMMIT_BRANCH - if: $CI_COMMIT_BRANCH
exists: exists:
- Dockerfile - Dockerfile
when: manual
tags: tags:
- OLYMPUS - OLYMPUS

View File

@@ -23,12 +23,12 @@
</template> </template>
<template #empty>No Records found</template> <template #empty>No Records found</template>
<template #loading>Loading Data. Please wait....</template> <template #loading>Loading Data. Please wait....</template>
<Column field="id" header="id" sortable style="min-width: 12rem"> <!--Column field="id" header="id" sortable style="min-width: 12rem">
<template #body="slotProps"> <template #body="slotProps">
<Tag>ksdocuments: {{ slotProps.data.id }}</Tag> <Tag>ksdocuments: {{ slotProps.data.id }}</Tag>
<Tag>ksingestioninfo: {{ slotProps.data.ingestionInfo.id }}</Tag> <Tag>ksingestioninfo: {{ slotProps.data.ingestionInfo.id }}</Tag>
</template> </template>
</Column> </Column-->
<!--Column field="ingestionInfo.id" header="ksingestioninfo id" sortable style="min-width: 12rem" /--> <!--Column field="ingestionInfo.id" header="ksingestioninfo id" sortable style="min-width: 12rem" /-->
<Column field="ingestionInfo.metadata.KsApplicationName" header="KSApplicationName" sortable <Column field="ingestionInfo.metadata.KsApplicationName" header="KSApplicationName" sortable
style="min-width: 12rem"> style="min-width: 12rem">
@@ -80,21 +80,21 @@
</Column> </Column>
<Column headerStyle="width: 5rem; text-align: center" bodyStyle="text-align: center; overflow: visible"> <Column headerStyle="width: 5rem; text-align: center" bodyStyle="text-align: center; overflow: visible">
<template #body="slotProps"> <template #body="slotProps">
<div class="flex justify-center items-center"> <div class="flex justify-center items-center space-x-3" >
<Button type="button" icon="pi pi-pencil" rounded @click="editKsDocument(slotProps.data)" <!--Button type="button" icon="pi pi-pencil" rounded @click="editKsDocument(slotProps.data)"
v-tooltip="'Edit the information of document'" class="mr-4" /> v-tooltip="'Edit the information of document'" /-->
<Button type="button" icon="pi pi-play" rounded @click="startIndividualngestion(slotProps.data.id)" <Button type="button" icon="pi pi-play" rounded @click="startIndividualngestion(slotProps.data.id)"
v-tooltip="'Start Ingestion of document'" :disabled="slotProps.data.ingestionStatus === 'INGESTED'" v-tooltip="'Start Ingestion of document'" :disabled="slotProps.data.ingestionStatus === 'INGESTED'"
:class="{ 'p-button-danger': slotProps.data.ingestionStatus === 'INGESTED' }" class="mr-7" /> :class="{ 'p-button-danger': slotProps.data.ingestionStatus === 'INGESTED' }" />
<Button type="button" icon="pi pi-trash" rounded @click="showConfirmDialog(slotProps.data.id)" <Button type="button" icon="pi pi-trash" rounded @click="showConfirmDialog(slotProps.data.id)"
v-tooltip="'Delete the ingested Record'" :disabled="slotProps.data.ingestionStatus === 'NEW'" v-tooltip="'Delete the ingested Record'" :disabled="slotProps.data.ingestionStatus === 'NEW'"
:class="{ 'p-button-danger': slotProps.data.ingestionStatus === 'NEW' }" class="mr-7" /> :class="{ 'p-button-danger': slotProps.data.ingestionStatus === 'NEW' }" />
<Dialog header="Confirm Deletion" :visible="confirmDialogVisible" modal @hide="resetConfirmDialog" <Dialog header="Confirm Deletion" :visible="confirmDialogVisible" modal @hide="resetConfirmDialog"
:style="{ width: '300px' }"> :style="{ width: '300px' }">
<p>Are you sure you want to delete this record?</p> <p>Are you sure you want to delete this record?</p>
<template #footer> <template #footer>
<Button label="No" icon="pi pi-times" @click="confirmDialogVisible = false" class="p-button-text" /> <Button label="No" icon="pi pi-times" @click="confirmDialogVisible = false"/>
<Button label="Yes" icon="pi pi-check" @click="confirmDelete" class="p-button-danger" /> <Button label="Yes" icon="pi pi-check" @click="confirmDelete" class="p-button-danger" />
</template> </template>
</Dialog> </Dialog>
@@ -301,17 +301,22 @@ function formatDate(dateString) {
</script> </script>
<style scoped> <style scoped>
/* Add this to ensure buttons are spaced consistently */
.space-x-3 > * + * {
margin-left: 1rem; /* Adjust as needed for desired spacing */
}
/* Custom styling for disabled red button */ /* Custom styling for disabled red button */
.p-button-danger { .p-button-danger {
background-color: red; background-color: white;
border-color: red; border-color: blue;
color: white; color: black;
} }
.p-button-danger:disabled { .p-button-danger:disabled {
background-color: red; /*background-color: red;*/
border-color: red; border-color: red;
color: white; color: red;
cursor: not-allowed; cursor: not-allowed;
} }
</style> </style>

View File

@@ -6,12 +6,12 @@
<h2 class="text-3xl font-bold mb-4">Ks document</h2> <h2 class="text-3xl font-bold mb-4">Ks document</h2>
</div> </div>
<form @submit.prevent="submitForm" class="p-fluid"> <form @submit.prevent="submitForm" class="p-fluid">
<div class="lex flex-col md:flex-row gap-4"> <div class="col-12 md:col-6 mb-4">
<div class="flex flex-wrap gap-2 w-full"> <span class="p-float-label">
<label for="description" v-tooltip="'A brief overview of the system purpose and functionality.'">System <label for="description" v-tooltip="'A brief overview of the system purpose and functionality.'">System
Description</label> Description</label>
<InputText id="description" type="text" v-model="formData.description" required class="w-full" /> <InputText id="description" type="text" v-model="formData.description" required class="w-full" />
</div> </span>
</div> </div>
<div class="col-12 md:col-6 mb-4"> <div class="col-12 md:col-6 mb-4">
@@ -33,7 +33,8 @@
<div class="col-12 md:col-6 mb-4"> <div class="col-12 md:col-6 mb-4">
<span class="p-float-label"> <span class="p-float-label">
<label for="ksDocType" v-tooltip="'Specify the type of document e.g, md, pdf,'">KS Document Type</label> <label for="ksDocType" v-tooltip="'Specify the type of document e.g, md, pdf,'">KS Document Type</label>
<InputText id="ksDocType" v-model="formData.ksDocType" required class="w-full" /> <Select id="ksDocType" v-model="formData.ksDocType" :options="dropdownItems" required optionLabel="name" optionValue="value" placeholder="Select One" class="w-full"></Select>
<!--InputText id="ksDocType" v-model="formData.ksDocType" required class="w-full" /-->
</span> </span>
</div> </div>
@@ -103,13 +104,20 @@ import Tooltip from 'primevue/tooltip';
const toast = useToast(); const toast = useToast();
const router = useRouter(); const router = useRouter();
const dropdownItems = ref([
{ name: 'PDF', value: 'pdf' },
{ name: 'MD', value: 'md' },
{ name: 'DOCX', value: 'docx' },
{ name: 'EXCEL', value: 'excel' }
]);
const formData = ref({ const formData = ref({
description: 'Jenkins DevopsJ2Cloud System CSV configuration md file', description: '', //Jenkins DevopsJ2Cloud System CSV configuration md file
ingestionStatus: 'NEW', ingestionStatus: 'NEW',
type: '.md file', type: '', //.md file
ksApplicationName: 'Jenkins-DevopsJ2Cloud', ksApplicationName: '', //Jenkins-DevopsJ2Cloud
ksDocType: 'md', ksDocType: '',
ksDocSource: 'Git Repository - DevopsJ2Cloud CSV System Configuration', ksDocSource: '', //Git Repository - DevopsJ2Cloud CSV System Configuration
defaultChunkSize: 1000, defaultChunkSize: 1000,
minChunkSize: 200, minChunkSize: 200,
maxNumberOfChunks: 1000, maxNumberOfChunks: 1000,

View File

@@ -35,13 +35,14 @@ import SelectButton from 'primevue/selectbutton'; // Import SelectButton
import { useToast } from 'primevue/usetoast'; import { useToast } from 'primevue/usetoast';
import { watch, ref } from 'vue'; import { watch, ref } from 'vue';
import CodeSnippet from '@/components/CodeSnippet.vue'; import CodeSnippet from '@/components/CodeSnippet.vue';
import axios from 'axios';
const query = ref(''); const query = ref('');
const dropdownItem = ref(null); const dropdownItem = ref(null);
const messages = ref([]); const messages = ref([]);
const toast = useToast(); const toast = useToast();
const dynamicCode = ref(''); const dynamicCode = ref('');
const filterQuery = ref("'KsApplicationName' == 'atf'") const filterQuery = ref("'KsApplicationName' == 'ATF'")
const dropdownItems = [ const dropdownItems = [
{ name: 'Documentation', code: 'setup-documentation' }, { name: 'Documentation', code: 'setup-documentation' },
@@ -49,11 +50,16 @@ const dropdownItems = [
{ name: 'SourceCode', code: 'sourcecode' } { name: 'SourceCode', code: 'sourcecode' }
]; ];
const sendQuery = async () => { const sendQuery = () => {
if (query.value.trim() !== '' && filterQuery) { if (query.value.trim() !== '' && filterQuery) {
try { axios.get('/test/query_vector', {
const response = await fetch(`/test/query_vector?query="${query.value}"&filterQuery=${filterQuery.value}`); params: {
const data = await response.json(); query: query.value,
filterQuery: filterQuery.value,
}
})
.then(response => {
const data = response.data;
console.log('API response:', data); console.log('API response:', data);
if (data && Array.isArray(data) && data.length > 0) { if (data && Array.isArray(data) && data.length > 0) {
@@ -62,12 +68,11 @@ const sendQuery = async () => {
} else { } else {
toast.add({ severity: 'info', summary: 'Info', detail: 'No results found', life: 3000 }); toast.add({ severity: 'info', summary: 'Info', detail: 'No results found', life: 3000 });
} }
} catch (error) { })
.catch(error => {
console.error('Error sending query:', error); console.error('Error sending query:', error);
toast.add({ severity: 'error', summary: 'Error', detail: 'Failed to send query', life: 3000 }); toast.add({ severity: 'error', summary: 'Error', detail: 'Failed to send query', life: 3000 });
} });
//query.value = '';
//dropdownItem.value = null;
} else { } else {
toast.add({ severity: 'warn', summary: 'Warning', detail: 'Please enter a query and select a type', life: 3000 }); toast.add({ severity: 'warn', summary: 'Warning', detail: 'Please enter a query and select a type', life: 3000 });
} }