yxmiler commited on
Commit
56e8063
·
verified ·
1 Parent(s): 5a3a682

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +7 -1
index.js CHANGED
@@ -608,6 +608,7 @@ async function handleResponse(response, model, res, isStream) {
608
  if (!data.trim()) continue;
609
  if (data === "[DONE]") continue;
610
  const linejosn = JSON.parse(data);
 
611
  if (linejosn?.error) {
612
  Logger.error(JSON.stringify(linejosn, null, 2), 'Server');
613
  stream.destroy();
@@ -761,7 +762,12 @@ async function handleImageResponse(imageUrl) {
761
  } else {
762
  Logger.info("生图成功", 'Server');
763
  const result = await responseURL.json();
764
- return `![image](${result.data.links.url})`
 
 
 
 
 
765
  }
766
  }
767
  }
 
608
  if (!data.trim()) continue;
609
  if (data === "[DONE]") continue;
610
  const linejosn = JSON.parse(data);
611
+ Logger.info(linejosn, 'Server');
612
  if (linejosn?.error) {
613
  Logger.error(JSON.stringify(linejosn, null, 2), 'Server');
614
  stream.destroy();
 
762
  } else {
763
  Logger.info("生图成功", 'Server');
764
  const result = await responseURL.json();
765
+ try {
766
+ var url = result.data.links.url
767
+ return `![image](${result.data.links.url})`
768
+ } catch (error) {
769
+ return error
770
+ }
771
  }
772
  }
773
  }