@meaningfully/ui 0.0.6 → 0.0.8
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.
- package/dist/App.svelte +7 -5
- package/dist/App.svelte.d.ts +1 -1
- package/dist/components/CsvUpload.svelte +3 -1
- package/dist/components/DatabaseConfig.svelte +5 -4
- package/dist/components/ExistingDatabases.svelte +5 -5
- package/dist/components/FrontPage.svelte +5 -2
- package/dist/components/SearchPage.svelte +11 -9
- package/package.json +2 -1
package/dist/App.svelte
CHANGED
|
@@ -11,12 +11,14 @@
|
|
|
11
11
|
|
|
12
12
|
interface Props {
|
|
13
13
|
api: MeaningfullyAPI;
|
|
14
|
-
|
|
14
|
+
basepath: string;
|
|
15
15
|
}
|
|
16
|
-
let { api,
|
|
16
|
+
let { api, basepath }: Props = $props();
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
// basepath must not be blank;
|
|
19
|
+
// unclear if it needs a trailing slash when using a subpath.
|
|
20
|
+
let basepath_app = $state(basepath || '/');
|
|
21
|
+
console.log(`basepath App "${basepath_app}" (prop: "${basepath}")`);
|
|
20
22
|
let url = $state('');
|
|
21
23
|
// Ensure $state returns Settings | null
|
|
22
24
|
let settings = $state<Settings | null>(null);
|
|
@@ -45,7 +47,7 @@
|
|
|
45
47
|
|
|
46
48
|
<!-- <img alt="logo" class="logo" src={electronLogo} /> -->
|
|
47
49
|
|
|
48
|
-
<Router url={url} basepath={
|
|
50
|
+
<Router url={url} basepath={basepath_app}>
|
|
49
51
|
<Link to="/">
|
|
50
52
|
<h1 class="text-2xl font-bold">
|
|
51
53
|
Meaningfully
|
package/dist/App.svelte.d.ts
CHANGED
|
@@ -69,8 +69,10 @@
|
|
|
69
69
|
</script>
|
|
70
70
|
|
|
71
71
|
<div class="bg-white p-6 rounded-lg shadow space-y-6 text-black mb-10" data-testid="upload-a-spreadsheet">
|
|
72
|
-
<h2 class="text-xl font-semibold">Upload
|
|
72
|
+
<h2 class="text-xl font-semibold mb-[2px]">Upload a Spreadsheet</h2>
|
|
73
73
|
|
|
74
|
+
<p class="text-gray-700 text-[10px]">CSVs up to 10,000 rows work great. Those with more than 10,000 rows may be slow or could fail. Modify the CSV beforehand to ensure the CSV has exactly one header row.</p>
|
|
75
|
+
|
|
74
76
|
<label class="block">
|
|
75
77
|
<span class="sr-only">Choose CSV file</span>
|
|
76
78
|
<input
|
|
@@ -143,11 +143,12 @@
|
|
|
143
143
|
[selectedTextColumn]: result.text
|
|
144
144
|
}));
|
|
145
145
|
} else {
|
|
146
|
-
error = 'Preview generation failed';
|
|
146
|
+
error = previewResponse.message || 'Preview generation failed'; // fastify responses don't throw
|
|
147
|
+
|
|
147
148
|
console.error('Preview generation failed:', previewResponse);
|
|
148
149
|
}
|
|
149
150
|
} catch (e: any) {
|
|
150
|
-
error = e.message;
|
|
151
|
+
error = e.message; // electron errors throw
|
|
151
152
|
} finally {
|
|
152
153
|
generatingPreview = false;
|
|
153
154
|
}
|
|
@@ -188,9 +189,9 @@
|
|
|
188
189
|
if (uploadResponse.success) {
|
|
189
190
|
navigate("/search/" + uploadResponse.documentSetId);
|
|
190
191
|
} else {
|
|
191
|
-
error = 'Upload failed';
|
|
192
|
+
error = uploadResponse.message || 'Upload failed'; // fastify responses don't throw
|
|
192
193
|
}
|
|
193
|
-
} catch (e: any) {
|
|
194
|
+
} catch (e: any) { // in Electron, errors throw
|
|
194
195
|
error = e.message;
|
|
195
196
|
} finally {
|
|
196
197
|
uploading = false;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
totalDocuments = result.total;
|
|
36
36
|
totalPages = Math.ceil(totalDocuments / pageSize);
|
|
37
37
|
} catch (e) {
|
|
38
|
-
error = e instanceof Error ? e.message : 'Failed to load
|
|
38
|
+
error = e instanceof Error ? e.message : 'Failed to load list of spreadsheets';
|
|
39
39
|
} finally {
|
|
40
40
|
loading = false;
|
|
41
41
|
}
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
await api.deleteDocumentSet(documentSetId);
|
|
49
49
|
await loadDocumentSets(currentPage);
|
|
50
50
|
} catch (e) {
|
|
51
|
-
error = e instanceof Error ? e.message : 'Failed to delete
|
|
51
|
+
error = e instanceof Error ? e.message : 'Failed to delete spreadsheet';
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
<div class="my-10 bg-white p-6 rounded-lg shadow space-y-6 text-black" data-testid="existing-spreadsheets">
|
|
88
88
|
<h2 class="text-2xl font-bold">Existing Spreadsheets</h2>
|
|
89
89
|
{#if documentSets.length === 0}
|
|
90
|
-
<p class="text-gray-500">No spreadsheets found. Upload
|
|
90
|
+
<p class="text-gray-500">No spreadsheets found. Upload a CSV to get started.</p>
|
|
91
91
|
{:else}
|
|
92
92
|
<div class="overflow-x-auto">
|
|
93
93
|
<table class="min-w-full table-auto">
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
<th class="px-4 py-2 text-left">Name</th>
|
|
97
97
|
<th class="px-4 py-2 text-left">Upload Date</th>
|
|
98
98
|
<th class="px-4 py-2 text-left">Documents</th>
|
|
99
|
-
<th class="px-4 py-2 text-left">
|
|
99
|
+
<th class="px-4 py-2 text-left">Details and Settings</th>
|
|
100
100
|
<th class="px-4 py-2 text-left"><span class="sr-only">Actions</span></th>
|
|
101
101
|
</tr>
|
|
102
102
|
</thead>
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
<td class="px-4 py-2">
|
|
122
122
|
{#if Object.keys(set.parameters).length > 0}
|
|
123
123
|
<details>
|
|
124
|
-
<summary class="cursor-pointer text-sm text-blue-600">
|
|
124
|
+
<summary class="cursor-pointer text-sm text-blue-600">See Details</summary>
|
|
125
125
|
<pre class="mt-2 p-2 bg-gray-50 rounded text-sm">{JSON.stringify(set.parameters, null, 2)}</pre>
|
|
126
126
|
</details>
|
|
127
127
|
{:else}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import ExistingDatabases from './ExistingDatabases.svelte'
|
|
3
3
|
import CsvUpload from './CsvUpload.svelte'
|
|
4
|
-
|
|
4
|
+
import type { MeaningfullyAPI } from '../types';
|
|
5
|
+
import { Link } from 'svelte-routing';
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
7
8
|
validApiKeysSet: boolean;
|
|
@@ -14,5 +15,7 @@
|
|
|
14
15
|
<div class="container mx-auto px-4 space-y-8">
|
|
15
16
|
<CsvUpload validApiKeysSet={validApiKeysSet} />
|
|
16
17
|
<ExistingDatabases api={api} />
|
|
18
|
+
<div class="max-w-2xl mx-auto text-left leading-tight space-y-2">
|
|
19
|
+
Meaningfully is a semantic search tool for text data in spreadsheets. Search by the meaning of a sentence instead of keywords. <Link to="help" class="nav-link underline text-blue-600 hover:text-blue-800 visited:text-purple-600">Learn more</Link>.
|
|
20
|
+
</div>
|
|
17
21
|
</div>
|
|
18
|
-
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
113
113
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
|
|
114
114
|
</svg>
|
|
115
|
-
<span>Back to
|
|
115
|
+
<span>Back to Home</span>
|
|
116
116
|
</button>
|
|
117
117
|
</div>
|
|
118
118
|
|
|
@@ -131,19 +131,15 @@
|
|
|
131
131
|
<div class="space-y-4 max-w-3xl">
|
|
132
132
|
<!-- Search Input -->
|
|
133
133
|
<div class="space-y-2">
|
|
134
|
-
<label for="search" class="block text-sm font-medium text-gray-
|
|
134
|
+
<label for="search" class="block text-sm font-medium text-gray-300">
|
|
135
135
|
Semantic Search
|
|
136
136
|
</label>
|
|
137
|
-
<p class="text-xs text-gray-500">
|
|
138
|
-
Imagine the perfect document that you hope might exist in your spreadsheet. Type it here. Meaningfully will find the real documents that mean
|
|
139
|
-
about the same thing -- even if they have no keywords in common.
|
|
140
|
-
</p>
|
|
141
137
|
<div class="flex space-x-4">
|
|
142
138
|
<input
|
|
143
139
|
id="search"
|
|
144
140
|
type="text"
|
|
145
141
|
bind:value={searchQuery}
|
|
146
|
-
placeholder={placeholderQuery}
|
|
142
|
+
placeholder={"... " + placeholderQuery}
|
|
147
143
|
data-testid="search-bar"
|
|
148
144
|
class="flex-1 px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 placeholder-gray-400"
|
|
149
145
|
/>
|
|
@@ -156,13 +152,17 @@
|
|
|
156
152
|
{loading ? 'Searching...' : 'Search'}
|
|
157
153
|
</button>
|
|
158
154
|
</div>
|
|
155
|
+
<p class="text-xs text-gray-500">
|
|
156
|
+
Need a hint? Imagine the perfect document that you hope might exist in your spreadsheet. Type it here. Meaningfully will find the real documents that mean
|
|
157
|
+
about the same thing -- even if they have no keywords in common.
|
|
158
|
+
</p>
|
|
159
159
|
</div>
|
|
160
160
|
|
|
161
161
|
<!-- Metadata Filters -->
|
|
162
162
|
{#if metadataColumns.length > 0}
|
|
163
163
|
<div class="space-y-2">
|
|
164
|
-
<p class="block text-sm font-medium text-gray-
|
|
165
|
-
|
|
164
|
+
<p class="block text-sm font-medium text-gray-300">
|
|
165
|
+
Use filters to search a subset of rows in your spreadsheet.
|
|
166
166
|
</p>
|
|
167
167
|
<div class="space-y-4">
|
|
168
168
|
{#each metadataFilters as filter, index}
|
|
@@ -224,6 +224,8 @@
|
|
|
224
224
|
originalDocumentClick={handleOriginalDocumentClick}
|
|
225
225
|
/>
|
|
226
226
|
</div>
|
|
227
|
+
{:else}
|
|
228
|
+
<div class="text-gray-500">You won't find any results unless you search</div>
|
|
227
229
|
{/if}
|
|
228
230
|
{/if}
|
|
229
231
|
</div>
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meaningfully/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Svelte components for meaningfully semantic search",
|
|
6
6
|
"repo": "https://github.com/jeremybmerrill/meaningfully-ui",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"dev": "vite dev",
|
|
9
9
|
"build": "vite build && npm run prepack",
|
|
10
|
+
"watch": "vite build --watch",
|
|
10
11
|
"preview": "vite preview",
|
|
11
12
|
"prepare": "svelte-kit sync && npm run build",
|
|
12
13
|
"prepack": "svelte-kit sync && svelte-package && publint",
|