File size: 645 Bytes
5b3c62d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { RenderRequest } from "../types.mts"
import { computeSha256 } from "./computeSha256.mts"

export function hashRequest(request: RenderRequest) {

  // we ignore the commands associated to cache and stuff
  const hashable = {
    version: 1,
    prompt: request.prompt,
    segmentation: request.segmentation,
    actionnables: request.actionnables,
    nbFrames: request.nbFrames,
    nbSteps: request.nbSteps,
    // seed: request.seed,
    width: request.width,
    height: request.height,
    projection: request.projection,
  }

  const requestJson = JSON.stringify(hashable)
  const hash = computeSha256(requestJson)

  return hash
}