SenY commited on
Commit
9399d36
1 Parent(s): 0290203

Upload index.html

Browse files
Files changed (1) hide show
  1. index.html +19 -4
index.html CHANGED
@@ -335,7 +335,7 @@
335
  const text = `「 ${query} 」をテーマに画像生成AIに送るプロンプトを考えてください。
336
  背景や小物のディテイール、構図、視覚効果など視覚的な情報のみに言及すること。
337
  その上で長文を日本語と英語で返信してください。
338
- 返答は以下のフォーマットのjson形式でのみ行う。json以外の内容をレスポンスに含めないこと。
339
  \`\`\`json
340
  {
341
  "results": [
@@ -369,7 +369,13 @@
369
  temperature: 1,
370
  top_p: 1,
371
  top_k: 32
372
- }
 
 
 
 
 
 
373
  };
374
 
375
  console.debug(text);
@@ -397,6 +403,7 @@
397
  console.debug(responseText);
398
 
399
  let jsonString = responseText.replace(/```json|```/g, '').trim();
 
400
  console.debug(jsonString);
401
  // JSONをパース
402
  const parsedData = JSON5.parse(jsonString);
@@ -411,9 +418,17 @@
411
  document.getElementById('promptEn').value = promptEn.replace(/\. ?/g, '.\n\n');
412
  document.getElementById('promptEn').value = document.getElementById('promptEn').value.replace(/^ */g, '');
413
  document.getElementById('promptMyLanguage').value = promptMyLanguage.replace(/\。 ?/g, '。\n\n');
 
 
 
 
 
 
 
 
 
 
414
 
415
- let danbooruTags = parsedData.results.find(x => x.language === 'danbooru').tags.map(x => x.replace("_", " "));
416
- document.getElementById('danbooruTags').value = danbooruTags.join(", ");
417
 
418
  // ローディングアイコンを非表示
419
  document.getElementById('loading').classList.add('d-none');
 
335
  const text = `「 ${query} 」をテーマに画像生成AIに送るプロンプトを考えてください。
336
  背景や小物のディテイール、構図、視覚効果など視覚的な情報のみに言及すること。
337
  その上で長文を日本語と英語で返信してください。
338
+ 返答は以下のフォーマットのjson形式でのみ行う。json以外の内容をレスポンスに含めないこと。また、出力されるjsonには改行コード(\\n)や空白は含めないこと。
339
  \`\`\`json
340
  {
341
  "results": [
 
369
  temperature: 1,
370
  top_p: 1,
371
  top_k: 32
372
+ },
373
+ safetySettings: [
374
+ {
375
+ category: "HARM_CATEGORY_SEXUALLY_EXPLICIT",
376
+ threshold: "BLOCK_NONE"
377
+ }
378
+ ]
379
  };
380
 
381
  console.debug(text);
 
403
  console.debug(responseText);
404
 
405
  let jsonString = responseText.replace(/```json|```/g, '').trim();
406
+ jsonString = jsonString.replace(/\\n/g, '');
407
  console.debug(jsonString);
408
  // JSONをパース
409
  const parsedData = JSON5.parse(jsonString);
 
418
  document.getElementById('promptEn').value = promptEn.replace(/\. ?/g, '.\n\n');
419
  document.getElementById('promptEn').value = document.getElementById('promptEn').value.replace(/^ */g, '');
420
  document.getElementById('promptMyLanguage').value = promptMyLanguage.replace(/\。 ?/g, '。\n\n');
421
+
422
+ let danbooruTags = parsedData.results.find(x => x.language === 'danbooru');
423
+ if(danbooruTags.tags){
424
+ danbooruTags = danbooruTags.tags.map(x => x.replace("_", " "));
425
+ document.getElementById('danbooruTags').value = danbooruTags.join(", ");
426
+ }
427
+ if(danbooruTags.text){
428
+ danbooruTags = danbooruTags.text.map(x => x.replace("_", " "));
429
+ document.getElementById('danbooruTags').value = danbooruTags.join(", ");
430
+ }
431
 
 
 
432
 
433
  // ローディングアイコンを非表示
434
  document.getElementById('loading').classList.add('d-none');