Skip to content

Commit

Permalink
making sure all tass get displayed correctly and not double-indexed...
Browse files Browse the repository at this point in the history
  • Loading branch information
yeus committed Nov 5, 2024
1 parent 3203d33 commit 1d9b311
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 13 deletions.
21 changes: 12 additions & 9 deletions src/modules/taskyon/taskManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,15 +379,18 @@ function useTaskVectors(
}

const vecAlreadyExists = async (taskId: string) => {
const vecid = Number((await vecMappingFromTask(taskId))?.vecid);
if (vecid) {
try {
// this works. If we mark a label as deleted in our vector index
// this will throw an error, meaning the vector doesn't exist...
const vec = (await getVectorIndex())?.getPoint(vecid);
return vec;
} catch (error) {
return undefined;
const res = await vecMappingFromTask(taskId);
if (res?.vecid) {
const vecid = Number(res.vecid);
if (!isNaN(vecid)) {
try {
// this works. If we mark a label as deleted in our vector index
// this will throw an error, meaning the vector doesn't exist...
const vec = (await getVectorIndex())?.getPoint(vecid);
return vec;
} catch (error) {
return undefined;
}
}
}
return undefined;
Expand Down
28 changes: 24 additions & 4 deletions src/pages/taskyon/TaskManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
update search index {{ syncProgressString }}</q-btn
>
<q-btn :icon="mdiDatabaseRemove" @click="onResetSearchIndex">
reset search index
clear search index
</q-btn>
<q-table
style="font-size: 0.8em"
Expand Down Expand Up @@ -73,8 +73,13 @@
<q-tooltip>Search Similarity in %</q-tooltip>
</div>
</div>
{{ rows.row.taskId }}
<!--<Task :task="rows.row" class="col q-pa-xs" />-->
<div class="col q-pa-xs">
<div class="text-caption text-right">id: {{ rows.row.taskId }}</div>
<Task
v-if="taskDataMap[rows.row.taskId]"
:task="taskDataMap[rows.row.taskId]!"
/>
</div>
</div>
</td>
</template>
Expand All @@ -86,7 +91,7 @@
import { ref, watch, computed } from 'vue';
import Search from 'components/SearchInput.vue';
import { TaskNode } from 'src/modules/taskyon/types';
//import Task from 'components/taskyon/TaskWidget.vue';
import Task from 'components/taskyon/TaskWidget.vue';
import { useTaskyonStore } from 'src/stores/taskyonState';
import {
mdiApproximatelyEqual,
Expand Down Expand Up @@ -127,6 +132,7 @@ const router = useRouter();
const state = useTaskyonStore();
const searchResults = ref<{ taskId: string; distance: number }[]>([]);
const taskDataMap = ref<Record<string, TaskNode>>({});
const syncProgressString = ref('0/0');
const syncProgress = ref(0.0);
const taskCount = ref<number | string>('N/A');
Expand Down Expand Up @@ -183,6 +189,18 @@ const createMangoQuery = (labelString: string) => {
};
};
async function fetchAndDisplayTasks() {
console.log('get task data from IDs');
for (const task of searchResults.value) {
if (!taskDataMap.value[task.taskId]) {
const taskData = await state
.getTaskManager()
.then((tm) => tm.getTask(task.taskId));
if (taskData) taskDataMap.value[task.taskId] = taskData;
}
}
}
async function searchTasks(params: searchParams & { k: string }) {
console.log('searching tasks:', params);
const taskManager = await state.getTaskManager();
Expand Down Expand Up @@ -214,6 +232,8 @@ async function searchTasks(params: searchParams & { k: string }) {
searchResults.value = result;
taskCount.value = (await taskManager.countTasks()) || 'N/A';
isSearching.value = false;
void fetchAndDisplayTasks();
}
}
Expand Down

0 comments on commit 1d9b311

Please sign in to comment.