delete functionality implemented
This commit is contained in:
@@ -2,31 +2,27 @@
|
||||
<Fluid>
|
||||
<h2 class="text-4xl font-semibold text-center mb-4">Similarity Search</h2>
|
||||
<div class="similarity-search">
|
||||
<div v-if="messages.length > 0" class="results-container mt-6">
|
||||
<Card v-for="(result, index) in messages" :key="index" class="result-card">
|
||||
<template #content>
|
||||
<ScrollPanel style="width: 100%; max-height: 400px">
|
||||
<CodeSnippet :code="dynamicCode" language="systemd" />
|
||||
</ScrollPanel>
|
||||
</template>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
<div class="card-container flex flex-col gap-6">
|
||||
<div class="flex flex-col gap-4">
|
||||
<Textarea id="query" v-model="query" rows="6" placeholder="Enter your query..." class="input-textarea" />
|
||||
<div class="select-container">
|
||||
<SelectButton
|
||||
id="type"
|
||||
v-model="dropdownItem"
|
||||
:options="dropdownItems"
|
||||
optionLabel="name"
|
||||
class="select-button"
|
||||
/>
|
||||
</div>
|
||||
<div class="card-container flex flex-col gap-6">
|
||||
<div class="flex flex-col gap-4">
|
||||
<Textarea id="query" v-model="query" rows="6" placeholder="Enter your query..." class="input-textarea" />
|
||||
<div class="select-container">
|
||||
<!--SelectButton id="type" v-model="dropdownItem" :options="dropdownItems" optionLabel="name"
|
||||
class="select-button" /-->
|
||||
<InputText v-model="filterQuery" type="text" placeholder="Add filterQuery" />
|
||||
</div>
|
||||
<Button label="Send" icon="pi pi-send" @click="sendQuery" class="send-button" />
|
||||
</div>
|
||||
<Button label="Query" icon="pi pi-send" @click="sendQuery" class="send-button" />
|
||||
</div>
|
||||
|
||||
<div v-if="messages.length > 0" class="results-container mt-6">
|
||||
<Card v-for="(result, index) in messages" :key="index" class="result-card">
|
||||
<template #content>
|
||||
<ScrollPanel style="width: 100%; max-height: 400px">
|
||||
<CodeSnippet :code="dynamicCode" language="systemd" />
|
||||
</ScrollPanel>
|
||||
</template>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
</Fluid>
|
||||
</template>
|
||||
@@ -45,6 +41,7 @@ const dropdownItem = ref(null);
|
||||
const messages = ref([]);
|
||||
const toast = useToast();
|
||||
const dynamicCode = ref('');
|
||||
const filterQuery = ref("'KsApplicationName' == 'atf'")
|
||||
|
||||
const dropdownItems = [
|
||||
{ name: 'Documentation', code: 'setup-documentation' },
|
||||
@@ -53,9 +50,9 @@ const dropdownItems = [
|
||||
];
|
||||
|
||||
const sendQuery = async () => {
|
||||
if (query.value.trim() !== '' && dropdownItem.value) {
|
||||
if (query.value.trim() !== '' && filterQuery) {
|
||||
try {
|
||||
const response = await fetch(`http://localhost:8082/test/query_vector?query="${query.value}"&type=${dropdownItem.value.code}`);
|
||||
const response = await fetch(`http://localhost:8082/test/query_vector?query="${query.value}"&filterQuery=${filterQuery.value}`);
|
||||
const data = await response.json();
|
||||
console.log('API response:', data);
|
||||
|
||||
@@ -69,8 +66,8 @@ const sendQuery = async () => {
|
||||
console.error('Error sending query:', error);
|
||||
toast.add({ severity: 'error', summary: 'Error', detail: 'Failed to send query', life: 3000 });
|
||||
}
|
||||
query.value = '';
|
||||
dropdownItem.value = null;
|
||||
//query.value = '';
|
||||
//dropdownItem.value = null;
|
||||
} else {
|
||||
toast.add({ severity: 'warn', summary: 'Warning', detail: 'Please enter a query and select a type', life: 3000 });
|
||||
}
|
||||
@@ -104,7 +101,8 @@ watch(messages, (newMessages) => {
|
||||
.input-textarea {
|
||||
width: 100%;
|
||||
resize: vertical;
|
||||
min-height: 150px; /* Increased height for better readability */
|
||||
min-height: 150px;
|
||||
/* Increased height for better readability */
|
||||
border-radius: 8px;
|
||||
padding: 1rem;
|
||||
border: 1px solid #ccc;
|
||||
|
||||
Reference in New Issue
Block a user