johnslegers commited on
Commit
27d0c40
·
1 Parent(s): abfb62f
Files changed (1) hide show
  1. ui/media/main.js +13 -13
ui/media/main.js CHANGED
@@ -250,7 +250,7 @@ function playSound() {
250
 
251
  async function healthCheck() {
252
  try {
253
- let res = await fetch('/ping')
254
  res = await res.json()
255
 
256
  if (res[0] == 'OK') {
@@ -381,7 +381,7 @@ async function doMakeImage(task) {
381
  let numOutputs = parseInt(reqBody['num_outputs'])
382
 
383
  try {
384
- res = await fetch('/image', {
385
  method: 'POST',
386
  headers: {
387
  'Content-Type': 'application/json'
@@ -726,7 +726,7 @@ function createTask(prompt) {
726
  if (task['isProcessing']) {
727
  task.isProcessing = false
728
  try {
729
- let res = await fetch('/image/stop')
730
  } catch (e) {
731
  console.log(e)
732
  }
@@ -793,7 +793,7 @@ async function stopAllTasks() {
793
  }
794
 
795
  try {
796
- let res = await fetch('/image/stop')
797
  } catch (e) {
798
  console.log(e)
799
  }
@@ -918,7 +918,7 @@ useBetaChannelField.addEventListener('click', async function(e) {
918
  let updateBranch = (this.checked ? 'beta' : 'main')
919
 
920
  try {
921
- let res = await fetch('/app_config', {
922
  method: 'POST',
923
  headers: {
924
  'Content-Type': 'application/json'
@@ -937,7 +937,7 @@ useBetaChannelField.addEventListener('click', async function(e) {
937
 
938
  async function getAppConfig() {
939
  try {
940
- let res = await fetch('/app_config')
941
  config = await res.json()
942
 
943
  if (config.update_branch === 'beta') {
@@ -953,7 +953,7 @@ async function getAppConfig() {
953
 
954
  async function getModels() {
955
  try {
956
- let res = await fetch('/models')
957
  models = await res.json()
958
 
959
  let activeModel = models['active']
@@ -1217,7 +1217,7 @@ async function getDiskPath() {
1217
  return
1218
  }
1219
 
1220
- let res = await fetch('/output_dir')
1221
  if (res.status === 200) {
1222
  res = await res.json()
1223
  res = res[0]
@@ -1281,14 +1281,14 @@ function changePreviewImages(val) {
1281
  let previewArr = []
1282
 
1283
  modifiers.map(x => x.modifiers).forEach(x => previewArr.push(...x.map(m => m.previews)))
1284
-
1285
  previewArr = previewArr.map(x => {
1286
  let obj = {}
1287
 
1288
  x.forEach(preview => {
1289
  obj[preview.name] = preview.path
1290
  })
1291
-
1292
  return obj
1293
  })
1294
 
@@ -1335,7 +1335,7 @@ function resizeModifierCards(val) {
1335
 
1336
  async function loadModifiers() {
1337
  try {
1338
- let res = await fetch('/modifiers.json?v=2')
1339
  if (res.status === 200) {
1340
  res = await res.json()
1341
 
@@ -1371,7 +1371,7 @@ async function loadModifiers() {
1371
  // remove modifier from active array
1372
  activeTags = activeTags.filter(x => x.name != modifierName)
1373
  modifierCard.classList.remove(activeCardClass)
1374
-
1375
  modifierCard.querySelector('.modifier-card-image-overlay').innerText = '+'
1376
  } else {
1377
  // add modifier to active array
@@ -1408,4 +1408,4 @@ async function loadModifiers() {
1408
  } catch (e) {
1409
  console.log('error fetching modifiers', e)
1410
  }
1411
- }
 
250
 
251
  async function healthCheck() {
252
  try {
253
+ let res = await fetch('ping')
254
  res = await res.json()
255
 
256
  if (res[0] == 'OK') {
 
381
  let numOutputs = parseInt(reqBody['num_outputs'])
382
 
383
  try {
384
+ res = await fetch('image', {
385
  method: 'POST',
386
  headers: {
387
  'Content-Type': 'application/json'
 
726
  if (task['isProcessing']) {
727
  task.isProcessing = false
728
  try {
729
+ let res = await fetch('image/stop')
730
  } catch (e) {
731
  console.log(e)
732
  }
 
793
  }
794
 
795
  try {
796
+ let res = await fetch('image/stop')
797
  } catch (e) {
798
  console.log(e)
799
  }
 
918
  let updateBranch = (this.checked ? 'beta' : 'main')
919
 
920
  try {
921
+ let res = await fetch('app_config', {
922
  method: 'POST',
923
  headers: {
924
  'Content-Type': 'application/json'
 
937
 
938
  async function getAppConfig() {
939
  try {
940
+ let res = await fetch('app_config')
941
  config = await res.json()
942
 
943
  if (config.update_branch === 'beta') {
 
953
 
954
  async function getModels() {
955
  try {
956
+ let res = await fetch('models')
957
  models = await res.json()
958
 
959
  let activeModel = models['active']
 
1217
  return
1218
  }
1219
 
1220
+ let res = await fetch('output_dir')
1221
  if (res.status === 200) {
1222
  res = await res.json()
1223
  res = res[0]
 
1281
  let previewArr = []
1282
 
1283
  modifiers.map(x => x.modifiers).forEach(x => previewArr.push(...x.map(m => m.previews)))
1284
+
1285
  previewArr = previewArr.map(x => {
1286
  let obj = {}
1287
 
1288
  x.forEach(preview => {
1289
  obj[preview.name] = preview.path
1290
  })
1291
+
1292
  return obj
1293
  })
1294
 
 
1335
 
1336
  async function loadModifiers() {
1337
  try {
1338
+ let res = await fetch('modifiers.json?v=2')
1339
  if (res.status === 200) {
1340
  res = await res.json()
1341
 
 
1371
  // remove modifier from active array
1372
  activeTags = activeTags.filter(x => x.name != modifierName)
1373
  modifierCard.classList.remove(activeCardClass)
1374
+
1375
  modifierCard.querySelector('.modifier-card-image-overlay').innerText = '+'
1376
  } else {
1377
  // add modifier to active array
 
1408
  } catch (e) {
1409
  console.log('error fetching modifiers', e)
1410
  }
1411
+ }