diff --git a/packages/frontend/pages/logs/index.tsx b/packages/frontend/pages/logs/index.tsx index 6cacaa3a..cad14a91 100644 --- a/packages/frontend/pages/logs/index.tsx +++ b/packages/frontend/pages/logs/index.tsx @@ -229,9 +229,16 @@ export default function Logs() { clearOnDefault: true, }) - const { view, update: updateView, remove: removeView } = useView(viewId) + + const { + view, + update: updateView, + remove: removeView, + loading: viewLoading, + } = useView(viewId) const serializedChecks = useMemo(() => { + // TODO: find a better way, because it will call two times /runs if (view) { return serializeLogic(view.data) } @@ -454,7 +461,13 @@ export default function Logs() { return ( {view && ( - + /> */} { @@ -544,12 +557,12 @@ export default function Logs() { - } onClick={() => duplicateView()} > Duplicate - + */} } diff --git a/packages/shared/checks/index.ts b/packages/shared/checks/index.ts index 12cc0f7e..0af65aa3 100644 --- a/packages/shared/checks/index.ts +++ b/packages/shared/checks/index.ts @@ -517,45 +517,45 @@ export const CHECKS: Check[] = [ }, ], }, - { - id: "tokens", - name: "Tokens", - disableInEvals: true, - uiType: "basic", - params: [ - { - type: "select", - id: "field", - width: 100, - defaultValue: "total", - options: [ - { - label: "Completion", - value: "completion", - }, - { - label: "Prompt", - value: "prompt", - }, - { - label: "Total", - value: "total", - }, - ], - }, - { - type: "label", - label: "Tokens", - }, - NUMBER_PARAM, - { - type: "number", - min: 0, - id: "tokens", - width: 70, - }, - ], - }, + // { + // id: "tokens", + // name: "Tokens", + // disableInEvals: true, + // uiType: "basic", + // params: [ + // { + // type: "select", + // id: "field", + // width: 100, + // defaultValue: "total", + // options: [ + // { + // label: "Completion", + // value: "completion", + // }, + // { + // label: "Prompt", + // value: "prompt", + // }, + // { + // label: "Total", + // value: "total", + // }, + // ], + // }, + // { + // type: "label", + // label: "Tokens", + // }, + // NUMBER_PARAM, + // { + // type: "number", + // min: 0, + // id: "tokens", + // width: 70, + // }, + // ], + // }, { id: "languages", name: "Language", diff --git a/packages/shared/checks/serialize.ts b/packages/shared/checks/serialize.ts index a63bbaaf..20461a2b 100644 --- a/packages/shared/checks/serialize.ts +++ b/packages/shared/checks/serialize.ts @@ -43,6 +43,9 @@ function deserializeParamValue( case "number": return Number(decodeURIComponent(value)) case "date": + if (value === "lt" || value === "gt") { + return decodeURIComponent(value) + } return new Date(decodeURIComponent(value)) default: return undefined @@ -62,6 +65,14 @@ export function serializeLogic(logic: CheckLogic): string { return all.filter(Boolean).join(".") } else if (param && typeof param === "object" && param.params) { const data = Object.entries(param.params) + .sort(([keyA], [keyB]) => { + if (keyA === "operator") { + return -1 + } + if (keyB === "operator") { + return 1 + } + }) .map(([key, value]) => { const filterParam = CHECKS.find( (filter) => filter.id === param.id,