feat: add help view
Some checks failed
Deploy to GitHub Pages / build_site (push) Failing after 1m20s
Some checks failed
Deploy to GitHub Pages / build_site (push) Failing after 1m20s
This commit is contained in:
@@ -26,9 +26,11 @@
|
||||
import NestedSettings from "$lib/settings/panels/NestedSettings.svelte";
|
||||
import { createPerformanceStore } from "$lib/performance";
|
||||
import { type PerformanceData } from "$lib/performance/store";
|
||||
import { RemoteRuntimeExecutor } from "$lib/remote-runtime-executor";
|
||||
|
||||
const nodeRegistry = new RemoteNodeRegistry("");
|
||||
const workerRuntime = new WorkerRuntimeExecutor();
|
||||
// const remoteRuntime = new RemoteRuntimeExecutor("/runtime");
|
||||
|
||||
let performanceData: PerformanceData;
|
||||
let viewerPerformance = createPerformanceStore();
|
||||
@@ -44,6 +46,8 @@
|
||||
? JSON.parse(localStorage.getItem("graph")!)
|
||||
: templates.plant;
|
||||
|
||||
console.log({ graph });
|
||||
|
||||
let manager: GraphManager;
|
||||
let managerStatus: Writable<"loading" | "error" | "idle">;
|
||||
$: if (manager) {
|
||||
@@ -75,6 +79,7 @@
|
||||
isWorking = true;
|
||||
try {
|
||||
let a = performance.now();
|
||||
// res = await remoteRuntime.execute(_graph, _settings);
|
||||
res = await workerRuntime.execute(_graph, _settings);
|
||||
let b = performance.now();
|
||||
let perfData = await workerRuntime.getPerformanceData();
|
||||
@@ -120,9 +125,9 @@
|
||||
<Grid.Row>
|
||||
<Grid.Cell>
|
||||
<Viewer
|
||||
centerCamera={$AppSettings.centerCamera}
|
||||
result={res}
|
||||
perf={viewerPerformance}
|
||||
centerCamera={$AppSettings.centerCamera}
|
||||
/>
|
||||
</Grid.Cell>
|
||||
<Grid.Cell>
|
||||
@@ -133,8 +138,9 @@
|
||||
bind:manager
|
||||
bind:activeNode
|
||||
bind:keymap
|
||||
showGrid={$AppSettings?.showNodeGrid}
|
||||
snapToGrid={$AppSettings?.snapToGrid}
|
||||
showGrid={$AppSettings.showNodeGrid}
|
||||
snapToGrid={$AppSettings.snapToGrid}
|
||||
bind:showHelp={$AppSettings.showHelp}
|
||||
bind:settings={graphSettings}
|
||||
bind:settingTypes={graphSettingTypes}
|
||||
on:result={(ev) => handleResult(ev.detail, $graphSettings)}
|
||||
|
||||
29
app/src/routes/runtime/+server.ts
Normal file
29
app/src/routes/runtime/+server.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import type { RequestHandler } from "./$types";
|
||||
import { MemoryRuntimeExecutor } from "$lib/runtime-executor";
|
||||
import { RemoteNodeRegistry } from "$lib/node-registry-client";
|
||||
import { createPerformanceStore } from "$lib/performance";
|
||||
|
||||
const registry = new RemoteNodeRegistry("");
|
||||
const runtime = new MemoryRuntimeExecutor(registry);
|
||||
const performanceStore = createPerformanceStore();
|
||||
runtime.perf = performanceStore;
|
||||
|
||||
|
||||
export const POST: RequestHandler = async ({ request, fetch }) => {
|
||||
|
||||
const { graph, settings } = await request.json();
|
||||
|
||||
registry.fetch = fetch;
|
||||
|
||||
await registry.load(graph.nodes.map(node => node.type))
|
||||
|
||||
const res = await runtime.execute(graph, settings);
|
||||
|
||||
let headers: Record<string, string> = { "Content-Type": "application/octet-stream" };
|
||||
if (runtime.perf) {
|
||||
headers["performance"] = JSON.stringify(runtime.perf.get());
|
||||
}
|
||||
|
||||
return new Response(res, { headers });
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user