ancient-butcher-87124
02/28/2025, 3:37 PMrhythmic-winter-76521
03/01/2025, 1:27 PMbrave-garden-34482
03/03/2025, 3:33 AMblue-shoe-54123
03/04/2025, 1:34 AMbrash-painter-16500
03/04/2025, 2:21 AMgorgeous-engine-26141
03/04/2025, 2:08 PMelegant-library-40999
03/04/2025, 2:35 PMcareful-notebook-54211
03/04/2025, 6:02 PMworried-photographer-57480
03/04/2025, 6:07 PMenough-activity-13508
03/04/2025, 7:25 PMhandsome-nightfall-65913
03/05/2025, 8:08 AMenough-activity-13508
03/05/2025, 6:29 PMnice-country-82959
03/05/2025, 11:36 PM{
type: 'chart',
chartType: 'LineChart',
props: {
data: customChartData, // Use the custom data instead of imported data
x: 'ISOWeek',
y: 'Cases',
title: 'Cool right?',
series: 'DataType',
chartAreaHeight: 300,
echartsOptions: {
xAxis: {
min: 1,
max: 10
}
}
}
},
{
type: 'text',
content: 'Test please work'
}
{#if showChart}
{#each messages as message}
{#if message.type === 'text'}
<p>{message.content}</p>
{:else if message.type === 'chart' && components[message.chartType]}
<svelte:component this={components[message.chartType]} {...message.props} />
{/if}
{/each}
{/if}
I am really excited about the direction of this. I'm working to try to make AI generated dashboards.nice-country-82959
03/05/2025, 11:37 PMlemon-crayon-44298
03/08/2025, 11:49 AMexport default {
async fetch(request, env, context) {
try {
const url = new URL(request.url);
const path = url.pathname.slice(1); // Remove leading slash
// The bucket only has these files anyway.
const allowedWasmFiles = [
'duckdb-mvp.DuKjbjvP.wasm',
'duckdb-eh.DrTJ_0hP.wasm'
];
if (!allowedWasmFiles.includes(path) && !path.endsWith('.wasm')) {
return new Response("Not found", { status: 404 });
}
// Check what compression formats the client supports
const acceptEncoding = request.headers.get('Accept-Encoding') || '';
let objectKey = path;
let contentEncoding = null;
let compressionType = 'none'; // Track for cache key
// Try Brotli first (better compression) if client supports it
if (acceptEncoding.includes('br')) {
const brKey = `${path}.br`;
const brObject = await env.WASM_BUCKET.head(brKey);
if (brObject) {
objectKey = brKey;
contentEncoding = 'br';
compressionType = 'br';
console.log(`Using Brotli compressed version: ${brKey}`);
}
}
// Create a compression-specific cache key
const cacheKeyUrl = new URL(url);
cacheKeyUrl.searchParams.append('compression', compressionType);
const cacheKey = new Request(cacheKeyUrl.toString(), request);
const cache = caches.default;
// Try to get from cache first
let response = await cache.match(cacheKey);
if (response) {
console.log(`Cache hit for: ${cacheKeyUrl} (${compressionType})`);
return response;
}
// If not in cache, fetch from bucket
console.log(`Cache miss for: ${cacheKeyUrl}, fetching from bucket`);
const object = await env.WASM_BUCKET.get(objectKey);
if (!object) {
return new Response("File not found", { status: 404 });
}
// Set appropriate headers
const headers = new Headers();
headers.set('Content-Type', 'application/wasm');
headers.set('Access-Control-Allow-Origin', '*');
// If we're serving a compressed version, add Content-Encoding header
if (contentEncoding) {
headers.set('Content-Encoding', contentEncoding);
}
// Cache control headers
headers.set('Cache-Control', 'public, max-age=86400');
headers.set('ETag', object.httpEtag);
// Additional security/performance headers
headers.set('Timing-Allow-Origin', '*');
headers.set('X-Content-Type-Options', 'nosniff');
// Create the response
response = new Response(object.body, { headers });
// Store in cache with compression-specific key
context.waitUntil(cache.put(cacheKey, response.clone()));
return response;
} catch (e) {
console.error(`Error: ${e.message}`);
return new Response('Error thrown: ' + e.message, { status: 500 });
}
}
};
and a wrangler.toml in the same folder as above file
name = "wasm-server"
main = "worker.js"
compatibility_date = "2023-10-01"
[[r2_buckets]]
binding = 'WASM_BUCKET'
bucket_name = 'TODO_CHANGE_TO_BUCKET_NAME'
You just need to modify TODO_CHANGE_TO_BUCKET_NAME to the name of your bucket.
I put the compressed files, and the non compressed files in the aforementioned bucket and spin a worker.
Then lastly,
change and add following in package.json:
"build": "evidence build && npm run fix-wasm",
"fix-wasm": "sed -i \"s|/_app/immutable/assets/|<https://URL_OF_YOUR_WORKER.workers.dev/%7Cg>\" \"build/_app/immutable/chunks/\"*.js && rm \"build/_app/immutable/assets/duckdb-\"*.wasm"
In the end, download is very fast, pretty much instant.many-jackal-21269
03/08/2025, 11:17 PMnpm run dev
my screen looks like this?faint-intern-10806
03/10/2025, 9:30 AMgorgeous-engine-26141
03/10/2025, 8:33 PMAreaMap
, or is it just me? I've been testing a few different maps, and I don't seem to be able to get evidence to render any AreaMap
. I'm only able to generate PointMap
.
All my AreaMap
look like this:jolly-apartment-92631
03/11/2025, 3:33 PMflaky-alarm-54453
03/11/2025, 6:06 PMblue-shoe-54123
03/12/2025, 3:33 AMjolly-nest-92859
03/12/2025, 5:14 AM<LineChart data={just_anomaly_ad_views} x="Day" y={["lower_bound","Ads_in_View","upper_bound"]} colorPalette={["lightgrey","#0D0D0D","lightgrey"]}>
{#each just_anomaly_views as anomaly}
<ReferencePoint x={anomaly.Day} y={anomaly._in_View} symbolSize={anomaly.is_anomaly ? 10 : 0} label={anomaly.is_anomaly ? 'Anomaly' : ''} labelPosition="bottom" color={anomaly.is_anomaly ? (anomaly.in_View < anomaly.lower_bound ? "negative" : "positive") : "#f2dbff"}/>
{/each}
</LineChart>
hallowed-notebook-46272
03/12/2025, 7:22 AMhandsome-nightfall-65913
03/13/2025, 4:37 AMnarrow-spoon-89545
03/13/2025, 9:17 AMjolly-nest-92859
03/14/2025, 1:49 AMgorgeous-engine-26141
03/14/2025, 1:15 PMPointMap
?
https://docs.evidence.dev/components/maps/point-map/lemon-coat-55573
03/14/2025, 4:40 PMstocky-advantage-3793
03/16/2025, 8:20 PMsilly-football-39744
03/17/2025, 2:57 PM