Skip to content

Commit

Permalink
refine(frontend): refine admin pages
Browse files Browse the repository at this point in the history
  • Loading branch information
634750802 committed Jan 2, 2025
1 parent 85872a9 commit 812224f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions frontend/app/src/api/site-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface PublicWebsiteSettings {
'custom_js_button_img_src': string;
'custom_js_logo_src': string;
'ga_id': string | null;
'max_upload_file_size': number | null;
'enable_post_verifications': boolean;
'enable_post_verifications_for_widgets': boolean;
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/src/components/data-table-remote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function DataTableRemote<TData, TValue> ({
defaultSorting = [],
}: DataTableRemoteProps<TData, TValue>) {
const [pagination, setPagination] = useState<PaginationState>(() => {
return { pageIndex: 0, pageSize: 10 };
return { pageIndex: 0, pageSize: 20 };
});
const [rowSelection, setRowSelection] = useState({});
const [columnFilters, setColumnFilters] = useState<ColumnFilter[]>([]);
Expand Down Expand Up @@ -236,7 +236,7 @@ function getSortingSearchString (sorting: SortingState) {
return sorting.map(({ id, desc }) => `${id}:${desc ? 'desc' : 'asc'}`).join(',');
}

const sizes = [10, 20, 50, 100];
const sizes = [20, 50, 100];

function TablePagination ({ className, limit = 4, loading, table }: { className?: string, limit?: number, loading: boolean, table: ReactTable<any> }) {
const options = table.getPageOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { withCreateEntityForm as withCreateEntityForm } from '@/components/form/
import { formFieldLayout } from '@/components/form/field-layout';
import { FileInput } from '@/components/form/widgets/FileInput';
import { zodFile } from '@/lib/zod';
import Link from 'next/link';
import type { ComponentProps } from 'react';
import { z } from 'zod';

Expand Down Expand Up @@ -41,7 +42,7 @@ export function CreateEvaluationDatasetForm ({ transitioning, onCreated }: Omit<
<field.Basic name="name" label="Name" required>
<FormInput />
</field.Basic>
<field.Basic name="upload_file" label="Upload File">
<field.Basic name="upload_file" label="Upload File" description={<>Evaluation dataset CSV file. See the <Link className='underline' href='/docs/evaluation#prerequisites'>documentation</Link> for the format.</>}>
<FileInput accept={['.csv']} />
</field.Basic>
</FormImpl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function CreateEvaluationTaskForm ({ transitioning, onCreated }: Omit<Com
<field.Basic name="chat_engine" label="Chat Engine">
<ChatEngineSelect />
</field.Basic>
<field.Basic name="run_size" label="Run Size">
<field.Basic name="run_size" label="Run Size" description="Number of evaluation dataset items to run. Default to run whole dataset.">
<FormInput type="number" min={1} step={1} />
</field.Basic>
</FormImpl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const helper = createColumnHelper<EvaluationTaskItem>();
const columns = [
helper.accessor('id', { header: 'ID', cell: mono }),
helper.accessor('status', { header: 'Status', cell: evaluationTaskStatusCell, meta: { colSpan: context => context.row.original.status === 'error' ? 3 : 1 } }),
helper.accessor('factual_correctness', {
header: 'factual_correctness',
helper.accessor('semantic_similarity', {
header: 'semantic_similarity',
cell: context => percent(context, {
colorStops: [
{ checkpoint: 0, color: 'hsl(var(--destructive))' },
Expand All @@ -30,8 +30,8 @@ const columns = [
}),
meta: { colSpan: context => context.row.original.status === 'error' ? 0 : 1 }
}),
helper.accessor('semantic_similarity', {
header: 'semantic_similarity',
helper.accessor('factual_correctness', {
header: 'factual_correctness',
cell: context => percent(context, {
colorStops: [
{ checkpoint: 0, color: 'hsl(var(--destructive))' },
Expand Down
6 changes: 6 additions & 0 deletions frontend/app/src/components/settings/WebsiteSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,16 @@ export function WebsiteSettings ({ schema }: { schema: AllSettings }) {
<SettingsField name="social_twitter" item={schema.social_twitter} />
<SettingsField name="social_discord" item={schema.social_discord} />
</section>
<Separator />
<section className="space-y-6">
<h2 className="text-lg font-medium">Analytics</h2>
<SettingsField name="ga_id" item={schema.ga_id} />
</section>
<Separator />
<section className="space-y-6">
<h2 className="text-lg font-medium">Uploads</h2>
<SettingsField name="max_upload_file_size" item={schema.max_upload_file_size} />
</section>
</div>
);
}

0 comments on commit 812224f

Please sign in to comment.