diff --git a/src/modules/taskyon/taskManager.ts b/src/modules/taskyon/taskManager.ts index 18a06f23..d447a8d6 100644 --- a/src/modules/taskyon/taskManager.ts +++ b/src/modules/taskyon/taskManager.ts @@ -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; diff --git a/src/pages/taskyon/TaskManager.vue b/src/pages/taskyon/TaskManager.vue index 47b40316..d5b57480 100644 --- a/src/pages/taskyon/TaskManager.vue +++ b/src/pages/taskyon/TaskManager.vue @@ -8,7 +8,7 @@ update search index {{ syncProgressString }} - reset search index + clear search index Search Similarity in % - {{ rows.row.taskId }} - +
+
id: {{ rows.row.taskId }}
+ +
@@ -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, @@ -127,6 +132,7 @@ const router = useRouter(); const state = useTaskyonStore(); const searchResults = ref<{ taskId: string; distance: number }[]>([]); +const taskDataMap = ref>({}); const syncProgressString = ref('0/0'); const syncProgress = ref(0.0); const taskCount = ref('N/A'); @@ -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(); @@ -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(); } }