@tuturuuu/ui 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,10 @@
1
1
  import { useQuery } from '@tanstack/react-query';
2
+ import {
3
+ searchWorkspaceTasks,
4
+ type WorkspaceTaskSearchResult,
5
+ } from '@tuturuuu/internal-api/tasks';
2
6
 
3
- interface SemanticSearchResult {
4
- id: string;
5
- name: string;
6
- description: string | null;
7
- list_id: string;
8
- start_date: string | null;
9
- end_date: string | null;
10
- completed: boolean;
11
- archived: boolean;
12
- similarity: number;
13
- }
7
+ type SemanticSearchResult = WorkspaceTaskSearchResult;
14
8
 
15
9
  interface UseSemanticTaskSearchOptions {
16
10
  wsId: string;
@@ -41,28 +35,11 @@ export function useSemanticTaskSearch({
41
35
  }
42
36
 
43
37
  try {
44
- // Call the API endpoint to perform semantic search
45
- const response = await fetch(
46
- `/api/v1/workspaces/${wsId}/tasks/search`,
47
- {
48
- method: 'POST',
49
- headers: {
50
- 'Content-Type': 'application/json',
51
- },
52
- body: JSON.stringify({
53
- query: query.trim(),
54
- matchThreshold,
55
- matchCount,
56
- }),
57
- }
58
- );
59
-
60
- if (!response.ok) {
61
- console.error('Semantic search failed:', await response.text());
62
- return [];
63
- }
64
-
65
- const data = await response.json();
38
+ const data = await searchWorkspaceTasks(wsId, {
39
+ query: query.trim(),
40
+ matchThreshold,
41
+ matchCount,
42
+ });
66
43
  return (data.tasks || []) as SemanticSearchResult[];
67
44
  } catch (error) {
68
45
  console.error('Error performing semantic search:', error);