Docs: Update Gemini benchmark results

This commit is contained in:
github-actions[bot]
2025-11-18 22:04:41 +00:00
parent 31a18dd4ee
commit 33b8150958
220 changed files with 3259 additions and 1494 deletions

View File

@@ -1,43 +1,27 @@
const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: rng, workHours: wh }) => {
const { DateTime: DT, Interval: IV } = await import('https://cdn.jsdelivr.net/npm/luxon@3.4.4/+esm');
const z = { zone: 'utc' }, parse = s => DT.fromISO(s, z);
const range = IV.fromDateTimes(parse(rng.start), parse(rng.end));
const busy = [...calA, ...calB]
.map(s => IV.fromDateTimes(parse(s.start), parse(s.end)))
.filter(i => i.isValid)
.sort((a, b) => a.start - b.start);
const merged = busy.reduce((acc, curr) => {
const last = acc[acc.length - 1];
if (last && (last.overlaps(curr) || last.abutsStart(curr))) {
acc[acc.length - 1] = last.union(curr);
} else acc.push(curr);
return acc;
}, []);
const slots = [];
let day = range.start.startOf('day');
const { DateTime: D, Interval: I } = await import('https://cdn.jsdelivr.net/npm/luxon@3.4.4/+esm');
const Z = 'utc', parse = t => D.fromISO(t, { zone: Z });
const busy = I.merge([...calA, ...calB].map(x => I.fromDateTimes(parse(x.start), parse(x.end))));
const search = I.fromDateTimes(parse(rng.start), parse(rng.end));
const [sH, sM] = wh.start.split(':'), [eH, eM] = wh.end.split(':');
const slots = [];
while (day < range.end) {
const wStart = day.set({ hour: sH, minute: sM }), wEnd = day.set({ hour: eH, minute: eM });
let work = IV.fromDateTimes(wStart, wEnd).intersection(range);
let curr = search.start.startOf('day');
while (curr < search.end) {
const wStart = curr.set({ hour: sH, minute: sM }), wEnd = curr.set({ hour: eH, minute: eM });
const work = I.fromDateTimes(wStart, wEnd).intersection(search);
if (work && work.isValid) {
let cursor = work.start;
while (cursor < work.end) {
const block = merged.find(b => b.end > cursor && b.start < work.end);
const limit = (block && block.start < work.end) ? block.start : work.end;
while (cursor.plus({ minutes: dur }) <= limit) {
slots.push({ start: cursor.toISO(), end: cursor.plus({ minutes: dur }).toISO() });
cursor = cursor.plus({ minutes: dur });
if (work?.isValid) {
let free = [work];
busy.forEach(b => free = free.flatMap(f => f.difference(b)));
free.forEach(f => {
let t = f.start;
while (t.plus({ minutes: dur }) <= f.end) {
slots.push({ start: t.toISO(), end: (t = t.plus({ minutes: dur })).toISO() });
}
cursor = block ? (block.end > cursor ? block.end : cursor) : work.end;
}
});
}
day = day.plus({ days: 1 });
curr = curr.plus({ days: 1 });
}
return slots;
};