Skip to content

Commit 43f9a37

Browse files
committed
feature: add page_size and date_recency options to Search UI | feature: add description to events tab in dashboard for what events are
1 parent 2a3d040 commit 43f9a37

File tree

8 files changed

+95
-200
lines changed

8 files changed

+95
-200
lines changed

dashboard/src/pages/Dashboard/Dataset/DatasetEvents.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
BiRegularChevronRight,
1515
} from "solid-icons/bi";
1616
import { MultiSelect } from "../../../components/MultiSelect";
17+
import { FiInfo } from "solid-icons/fi";
1718

1819
export const DatasetEvents = () => {
1920
const api_host = import.meta.env.VITE_API_HOST as unknown as string;
@@ -78,6 +79,16 @@ export const DatasetEvents = () => {
7879
return (
7980
<div class="mb-3">
8081
<main class="mx-auto">
82+
<div class="rounded-md bg-blue-50 p-4 dark:bg-blue-900">
83+
<div class="flex space-x-2">
84+
<FiInfo class="h-5 w-5 text-blue-400 dark:text-blue-50" />
85+
<p class="text-sm text-blue-700 dark:text-blue-50">
86+
Events are logged by the server and displayed here for chunk and
87+
file CRUD operations. You can filter by event type. The list
88+
refreshes every 5 seconds.
89+
</p>
90+
</div>
91+
</div>
8192
<div class="mx-auto mt-8 pb-8">
8293
<div class="">
8394
<div class="sm:flex sm:items-center">

dashboard/src/pages/Dashboard/Dataset/DatasetSettingsPage.tsx

Lines changed: 3 additions & 196 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
ClientEnvsConfiguration,
66
ServerEnvsConfiguration,
77
availableEmbeddingModels,
8-
isComboboxValues,
98
} from "../../../types/apiTypes";
109
import { UserContext } from "../../../contexts/UserContext";
1110
import { createToast } from "../../../components/ShowToasts";
@@ -155,174 +154,6 @@ export const FrontendSettingsForm = () => {
155154
/>
156155
</div>
157156

158-
<div class="col-span-4 flex items-center space-x-2 sm:col-span-2">
159-
<input
160-
type="checkbox"
161-
name="documentUploadFeatureClient"
162-
id="documentUploadFeatureClient"
163-
checked={clientConfig().DOCUMENT_UPLOAD_FEATURE}
164-
onInput={(e) =>
165-
setClientConfig((prev) => {
166-
return {
167-
...prev,
168-
DOCUMENT_UPLOAD_FEATURE: e.currentTarget.checked,
169-
};
170-
})
171-
}
172-
/>
173-
<label
174-
for="documentUploadFeature"
175-
class="block text-sm font-medium"
176-
>
177-
Document upload feature
178-
</label>
179-
</div>
180-
181-
<div class="col-span-4 flex items-center space-x-2 sm:col-span-2">
182-
<input
183-
type="checkbox"
184-
name="documentUploadFeatureClient"
185-
id="documentUploadFeatureClient"
186-
checked={clientConfig().CREATE_CHUNK_FEATURE}
187-
onInput={(e) =>
188-
setClientConfig((prev) => {
189-
return {
190-
...prev,
191-
CREATE_CHUNK_FEATURE: e.currentTarget.checked,
192-
};
193-
})
194-
}
195-
/>
196-
<label
197-
for="documentUploadFeature"
198-
class="block text-sm font-medium"
199-
>
200-
Create chunk feature
201-
</label>
202-
</div>
203-
204-
<div class="col-span-4 sm:col-span-2">
205-
<label
206-
for="dateRangeValue"
207-
class="block text-sm font-medium leading-6"
208-
>
209-
Date range value
210-
</label>
211-
<input
212-
type="text"
213-
name="dateRangeValue"
214-
id="dateRangeValue"
215-
class="mt-2 block w-full rounded-md border-[0.5px] border-neutral-300 px-3 py-1.5 shadow-sm placeholder:text-neutral-400 focus:outline-magenta-500 sm:text-sm sm:leading-6"
216-
value={clientConfig().DATE_RANGE_VALUE}
217-
onInput={(e) =>
218-
setClientConfig((prev) => {
219-
return {
220-
...prev,
221-
DATE_RANGE_VALUE: e.target.value,
222-
};
223-
})
224-
}
225-
/>
226-
</div>
227-
228-
<div class="col-span-4">
229-
<label
230-
for="searchQueries"
231-
class="block text-sm font-medium leading-6"
232-
>
233-
Search Queries
234-
</label>
235-
<input
236-
type="text"
237-
name="searchQueries"
238-
id="searchQueries"
239-
class="mt-2 block w-full rounded-md border-[0.5px] border-neutral-300 px-3 py-1.5 shadow-sm placeholder:text-neutral-400 focus:outline-magenta-500 sm:text-sm sm:leading-6"
240-
value={clientConfig().SEARCH_QUERIES}
241-
onInput={(e) =>
242-
setClientConfig((prev) => {
243-
return {
244-
...prev,
245-
SEARCH_QUERIES: e.target.value,
246-
};
247-
})
248-
}
249-
/>
250-
</div>
251-
252-
<div class="col-span-4">
253-
<label
254-
for="frontmatterVals"
255-
class="block text-sm font-medium leading-6"
256-
>
257-
Frontmatter Values
258-
</label>
259-
<input
260-
type="text"
261-
name="frontmatterVals"
262-
id="frontmatterVals"
263-
class="mt-2 block w-full rounded-md border-[0.5px] border-neutral-300 px-3 py-1.5 shadow-sm placeholder:text-neutral-400 focus:outline-magenta-500 sm:text-sm sm:leading-6"
264-
value={clientConfig().FRONTMATTER_VALS}
265-
onInput={(e) =>
266-
setClientConfig((prev) => {
267-
return {
268-
...prev,
269-
FRONTMATTER_VALS: e.target.value,
270-
};
271-
})
272-
}
273-
/>
274-
</div>
275-
{/** TODO: change to a modal to set filters and generate json from that */}
276-
<div class="col-span-4">
277-
<label
278-
for="filterItems"
279-
class="block text-sm font-medium leading-6"
280-
>
281-
Filter Items
282-
</label>
283-
<input
284-
type="text"
285-
name="filterItems"
286-
id="filterItems"
287-
class="mt-2 block w-full rounded-md border-[0.5px] border-neutral-300 px-3 py-1.5 shadow-sm placeholder:text-neutral-400 focus:outline-magenta-500 sm:text-sm sm:leading-6"
288-
value={JSON.stringify(clientConfig().FILTER_ITEMS)}
289-
onInput={(e) => {
290-
const value = JSON.parse(e.target.value) as object[];
291-
if (isComboboxValues(value)) {
292-
setClientConfig((prev) => {
293-
return {
294-
...prev,
295-
FILTER_ITEMS: value,
296-
};
297-
});
298-
}
299-
}}
300-
/>
301-
</div>
302-
303-
<div class="col-span-4">
304-
<label
305-
for="suggestedQueries"
306-
class="block text-sm font-medium leading-6"
307-
>
308-
Suggested Queries
309-
</label>
310-
<input
311-
type="text"
312-
name="suggestedQueries"
313-
id="suggestedQueries"
314-
class="mt-2 block w-full rounded-md border-[0.5px] border-neutral-300 px-3 py-1.5 shadow-sm placeholder:text-neutral-400 focus:outline-magenta-500 sm:text-sm sm:leading-6"
315-
value={clientConfig().SUGGESTED_QUERIES}
316-
onInput={(e) =>
317-
setClientConfig((prev) => {
318-
return {
319-
...prev,
320-
SUGGESTED_QUERIES: e.target.value,
321-
};
322-
})
323-
}
324-
/>
325-
</div>
326157
<div class="col-span-4">
327158
<label
328159
for="imageRangeStartKey"
@@ -370,30 +201,6 @@ export const FrontendSettingsForm = () => {
370201
}
371202
/>
372203
</div>
373-
374-
<div class="col-span-4">
375-
<label
376-
for="fileNameKey"
377-
class="block text-sm font-medium leading-6"
378-
>
379-
File Name Key
380-
</label>
381-
<input
382-
type="text"
383-
name="suggestedQueries"
384-
id="suggestedQueries"
385-
class="mt-2 block w-full rounded-md border-[0.5px] border-neutral-300 px-3 py-1.5 shadow-sm placeholder:text-neutral-400 focus:outline-magenta-500 sm:text-sm sm:leading-6"
386-
value={clientConfig().FILE_NAME_KEY}
387-
onInput={(e) =>
388-
setClientConfig((prev) => {
389-
return {
390-
...prev,
391-
FILE_NAME_KEY: e.target.value,
392-
};
393-
})
394-
}
395-
/>
396-
</div>
397204
</div>
398205
</div>
399206
<div class="bg-neutral-50 px-4 py-3 text-right sm:px-6">
@@ -905,12 +712,12 @@ export const DangerZoneForm = () => {
905712

906713
export const DatasetSettingsPage = () => {
907714
return (
908-
<div class="grid grid-cols-1 gap-3 lg:grid-cols-2">
715+
<div class="grid grid-cols-1 gap-3">
909716
<div>
910-
<FrontendSettingsForm />
717+
<ServerSettingsForm />
911718
</div>
912719
<div>
913-
<ServerSettingsForm />
720+
<FrontendSettingsForm />
914721
</div>
915722
<div>
916723
<DangerZoneForm />

dashboard/src/pages/Dashboard/UserManagment.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export const UserManagement = () => {
177177
});
178178

179179
return (
180-
<div class="mt-10 px-4 sm:px-6 lg:px-8">
180+
<div class="mt-10">
181181
<div class="mt-10 sm:flex sm:items-center">
182182
<div class="sm:flex-auto">
183183
<Show when={!showInvitations()}>

search/src/HomeSearch.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ export const HomeSearch = () => {
2121
const searchType: string = params.get("searchType") ?? "search";
2222
const groupUnique = params.get("groupUnique") === "true" || false;
2323
const slimChunks = params.get("slimChunks") === "true" || false;
24+
const pageSize = Number(params.get("pageSize")) || 10;
2425
const getTotalPages = params.get("getTotalPages") === "true" || false;
2526
const highlightResults = params.get("highlightResults") === "true" || true;
2627
const highlightDelimiters = params
2728
.get("highlightDelimiters")
2829
?.split(",")
2930
.filter((delimiter) => delimiter !== "") ?? ["?", ".", "!"];
31+
const recencyBias = Number(params.get("recencyBias")) || 0.0;
3032

3133
return (
3234
<div class="flex min-h-screen flex-col bg-white dark:bg-shark-800 dark:text-white">
@@ -55,9 +57,11 @@ export const HomeSearch = () => {
5557
searchType={searchType}
5658
groupUniqueSearch={groupUnique}
5759
slimChunks={slimChunks}
60+
pageSize={pageSize}
5861
getTotalPages={getTotalPages}
5962
highlightDelimiters={highlightDelimiters}
6063
highlightResults={highlightResults}
64+
recencyBias={recencyBias}
6165
/>
6266
</div>
6367
</div>

search/src/components/GroupPage.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export const GroupPage = (props: GroupPageProps) => {
5252
const [page, setPage] = createSignal<number>(1);
5353
const [searchType, setSearchType] = createSignal<string>("hybrid");
5454
const [slimChunks, setSlimChunks] = createSignal(false);
55+
const [pageSize, setPageSize] = createSignal<number>(10);
5556
const [getTotalPages, setGetTotalPages] = createSignal(false);
5657
const [highlightResults, setHighlightResults] = createSignal(true);
5758
const [highlightDelimiters, setHighlightDelimiters] = createSignal<string[]>([
@@ -60,6 +61,7 @@ export const GroupPage = (props: GroupPageProps) => {
6061
".",
6162
"!",
6263
]);
64+
const [recencyBias, setRecencyBias] = createSignal<number>(0.0);
6365
const [searchLoading, setSearchLoading] = createSignal(false);
6466
const [chunkMetadatas, setChunkMetadatas] = createSignal<ChunkMetadata[]>([]);
6567
const [searchMetadatasWithVotes, setSearchMetadatasWithVotes] = createSignal<
@@ -109,11 +111,13 @@ export const GroupPage = (props: GroupPageProps) => {
109111
setPage(Number(location.query.page) || 1);
110112
setSearchType(location.query.searchType ?? "hybrid");
111113
setSlimChunks(location.query.slimChunks === "true");
114+
setPageSize(Number(location.query.pageSize) || 10);
112115
setGetTotalPages(location.query.getTotalPages === "true");
113116
setHighlightResults(location.query.highlightResults === "true");
114117
setHighlightDelimiters(
115118
location.query.highlightDelimiters?.split(",") ?? ["?", ".", "!"],
116119
);
120+
setRecencyBias(Number(location.query.recencyBias) || 0.0);
117121
});
118122

119123
createEffect(() => {
@@ -166,9 +170,11 @@ export const GroupPage = (props: GroupPageProps) => {
166170
group_id: props.groupID,
167171
search_type: searchType(),
168172
slim_chunks: slimChunks(),
173+
page_size: pageSize(),
169174
get_total_pages: getTotalPages(),
170175
highlight_results: highlightResults(),
171176
highlight_delimiters: highlightDelimiters(),
177+
recency_bias: recencyBias(),
172178
}),
173179
}).then((response) => {
174180
if (response.ok) {
@@ -503,7 +509,11 @@ export const GroupPage = (props: GroupPageProps) => {
503509
<SearchForm
504510
query={query()}
505511
searchType={searchType()}
512+
pageSize={pageSize()}
506513
getTotalPages={getTotalPages()}
514+
highlightResults={highlightResults()}
515+
highlightDelimiters={highlightDelimiters()}
516+
recencyBias={recencyBias()}
507517
groupID={props.groupID}
508518
slimChunks={slimChunks()}
509519
/>

search/src/components/ResultsPage.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ export interface ResultsPageProps {
3838
searchType: string;
3939
groupUnique?: boolean;
4040
slimChunks?: boolean;
41+
pageSize?: number;
4142
getTotalPages?: boolean;
4243
highlightResults?: boolean;
4344
highlightDelimiters?: string[];
45+
recencyBias?: number;
4446
loading: Accessor<boolean>;
4547
setLoading: Setter<boolean>;
4648
}
@@ -143,9 +145,11 @@ const ResultsPage = (props: ResultsPageProps) => {
143145
: props.searchType,
144146
get_collisions: true,
145147
slim_chunks: props.slimChunks ?? false,
148+
page_size: props.pageSize ?? 10,
146149
get_total_pages: props.getTotalPages ?? false,
147150
highlight_results: props.highlightResults ?? true,
148151
highlight_delimiters: props.highlightDelimiters ?? ["?", ".", "!"],
152+
recency_bias: props.recencyBias ?? 0.0,
149153
};
150154

151155
let searchRoute = "chunk/search";

0 commit comments

Comments
 (0)