File size: 743 Bytes
955ce73
 
c4b02b2
 
 
 
 
b5bd854
c4b02b2
95bbb7f
1373ff5
c4b02b2
 
18a8947
 
95bbb7f
18a8947
 
 
c4b02b2
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { RenderRequest } from "../../types.mts"
import { computeSha256 } from "../validators/computeSha256.mts"

export function hashRequest(request: RenderRequest) {

  // we ignore the commands associated to cache and stuff
  const hashable = {
    version: 1,
    prompt: request.prompt,
    negativePrompt: request.negativePrompt,
    identityImage: request.identityImage,
    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
}