bibibi12345 commited on
Commit
ce3b21b
·
2 Parent(s): 8931d96 3119427

fixed model list

Browse files
Files changed (1) hide show
  1. server.js +21 -0
server.js CHANGED
@@ -67,16 +67,24 @@ app.use(helmet.contentSecurityPolicy({
67
  directives: {
68
  "default-src": ["'self'"],
69
  // Allow SPA inline scripts but forbid inline event attributes per CSP3
 
70
  "script-src": ["'self'", "'unsafe-inline'"],
71
  "script-src-attr": ["'none'"],
72
  // Permit external stylesheet from Baomitu CDN via style-src-elem
 
 
73
  "style-src": ["'self'", "'unsafe-inline'"],
74
  "style-src-elem": ["'self'", "'unsafe-inline'", "https://lib.baomitu.com"],
 
75
  "img-src": ["'self'", "data:", "blob:"],
76
  // Allow Baomitu icon fonts
77
  "font-src": ["'self'", "data:", "https://lib.baomitu.com"],
78
  // Allow CSS sourcemap requests to Baomitu CDN
79
  "connect-src": ["'self'", "https://image.chutes.ai", "https://lib.baomitu.com"],
 
 
 
 
80
  "media-src": ["'self'", "data:", "blob:"],
81
  "frame-src": ["'self'", "https://huggingface.co", "https://*.huggingface.co", "https://*.hf.space"],
82
  "frame-ancestors": ["'self'", "https://huggingface.co", "https://*.huggingface.co", "https://*.hf.space"]
@@ -317,6 +325,11 @@ app.post('/api/generate', async (req, res) => {
317
  const parsed = parseFloat(raw);
318
  return Number.isNaN(parsed) ? 7.5 : parsed;
319
  })(), 0, 20),
 
 
 
 
 
320
  num_inference_steps: clamp(parseInt(body.num_inference_steps ?? (body.input_args ? body.input_args.num_inference_steps : 25), 10) || 25, 1, 100),
321
  // Seed: support top-level or input_args.seed; if missing/null -> null (omit from payload)
322
  seed: (() => {
@@ -500,6 +513,14 @@ app.post('/api/generate', async (req, res) => {
500
  shift: (inputExtras && inputExtras.shift !== undefined) ? Number(inputExtras.shift) : 3.0,
501
  max_sequence_length: (inputExtras && inputExtras.max_sequence_length !== undefined) ? Number(inputExtras.max_sequence_length) : 512,
502
  ...(flat.seed !== null ? { seed: flat.seed } : {})
 
 
 
 
 
 
 
 
503
  } : null;
504
 
505
  // Minimal payload (some models reject extended fields). Include size/steps/seed for hunyuan-image-3 compatibility
 
67
  directives: {
68
  "default-src": ["'self'"],
69
  // Allow SPA inline scripts but forbid inline event attributes per CSP3
70
+ // Allow SPA inline scripts but forbid inline event attributes per CSP3
71
  "script-src": ["'self'", "'unsafe-inline'"],
72
  "script-src-attr": ["'none'"],
73
  // Permit external stylesheet from Baomitu CDN via style-src-elem
74
+ "script-src-attr": ["'none'"],
75
+ // Permit external stylesheet from Baomitu CDN via style-src-elem
76
  "style-src": ["'self'", "'unsafe-inline'"],
77
  "style-src-elem": ["'self'", "'unsafe-inline'", "https://lib.baomitu.com"],
78
+ "style-src-elem": ["'self'", "'unsafe-inline'", "https://lib.baomitu.com"],
79
  "img-src": ["'self'", "data:", "blob:"],
80
  // Allow Baomitu icon fonts
81
  "font-src": ["'self'", "data:", "https://lib.baomitu.com"],
82
  // Allow CSS sourcemap requests to Baomitu CDN
83
  "connect-src": ["'self'", "https://image.chutes.ai", "https://lib.baomitu.com"],
84
+ // Allow Baomitu icon fonts
85
+ "font-src": ["'self'", "data:", "https://lib.baomitu.com"],
86
+ // Allow CSS sourcemap requests to Baomitu CDN
87
+ "connect-src": ["'self'", "https://image.chutes.ai", "https://lib.baomitu.com"],
88
  "media-src": ["'self'", "data:", "blob:"],
89
  "frame-src": ["'self'", "https://huggingface.co", "https://*.huggingface.co", "https://*.hf.space"],
90
  "frame-ancestors": ["'self'", "https://huggingface.co", "https://*.huggingface.co", "https://*.hf.space"]
 
325
  const parsed = parseFloat(raw);
326
  return Number.isNaN(parsed) ? 7.5 : parsed;
327
  })(), 0, 20),
328
+ guidance_scale: clamp((() => {
329
+ const raw = body.guidance_scale ?? (body.input_args ? body.input_args.guidance_scale : undefined);
330
+ const parsed = parseFloat(raw);
331
+ return Number.isNaN(parsed) ? 7.5 : parsed;
332
+ })(), 0, 20),
333
  num_inference_steps: clamp(parseInt(body.num_inference_steps ?? (body.input_args ? body.input_args.num_inference_steps : 25), 10) || 25, 1, 100),
334
  // Seed: support top-level or input_args.seed; if missing/null -> null (omit from payload)
335
  seed: (() => {
 
513
  shift: (inputExtras && inputExtras.shift !== undefined) ? Number(inputExtras.shift) : 3.0,
514
  max_sequence_length: (inputExtras && inputExtras.max_sequence_length !== undefined) ? Number(inputExtras.max_sequence_length) : 512,
515
  ...(flat.seed !== null ? { seed: flat.seed } : {})
516
+ prompt: flat.prompt,
517
+ height: flat.height,
518
+ width: flat.width,
519
+ num_inference_steps: flat.num_inference_steps,
520
+ guidance_scale: flat.guidance_scale,
521
+ shift: (inputExtras && inputExtras.shift !== undefined) ? Number(inputExtras.shift) : 3.0,
522
+ max_sequence_length: (inputExtras && inputExtras.max_sequence_length !== undefined) ? Number(inputExtras.max_sequence_length) : 512,
523
+ ...(flat.seed !== null ? { seed: flat.seed } : {})
524
  } : null;
525
 
526
  // Minimal payload (some models reject extended fields). Include size/steps/seed for hunyuan-image-3 compatibility