Spaces:
Sleeping
Sleeping
Update static/index.html
Browse files- static/index.html +22 -7
static/index.html
CHANGED
|
@@ -15,9 +15,10 @@
|
|
| 15 |
<div class="mb-4">
|
| 16 |
<label for="model" class="block text-sm font-medium text-gray-700">Select AI Model (Explicit Content)</label>
|
| 17 |
<select id="model" class="mt-1 block w-full p-2 border border-gray-300 rounded-md" required>
|
| 18 |
-
|
| 19 |
<option value="deepseek/deepseek-chat-v3-0324:free">DeepSeek Chat (Free)</option>
|
| 20 |
-
<option value="deepseek/deepseek-chat-v3-0324">DeepSeek Chat (Paid)</option>
|
|
|
|
| 21 |
<option value="deepseek/deepseek-r1-0528:free">DeepSeek R1 (Free)</option>
|
| 22 |
<option value="deepseek/deepseek-r1-0528">DeepSeek R1 (Paid)</option>
|
| 23 |
<option value="tngtech/deepseek-r1t2-chimera:free">DeepSeek TNG (Free)</option>
|
|
@@ -71,6 +72,20 @@
|
|
| 71 |
const generateButton = document.getElementById("generate_novel");
|
| 72 |
const outputsDiv = document.getElementById("outputs");
|
| 73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
// Handle file upload: read and populate textarea
|
| 75 |
fileInput.addEventListener("change", (event) => {
|
| 76 |
const file = event.target.files[0];
|
|
@@ -135,14 +150,14 @@
|
|
| 135 |
if (result.error) {
|
| 136 |
document.getElementById("outline").value = `Error: ${result.error}`;
|
| 137 |
} else {
|
| 138 |
-
// Structured fields
|
| 139 |
-
document.getElementById("outline").value = result.outline
|
| 140 |
-
document.getElementById("locations").value = result.locations
|
| 141 |
-
document.getElementById("objects").value = result.objects
|
| 142 |
|
| 143 |
// Fallback if no structured data
|
| 144 |
if (!result.outline && result.raw_response) {
|
| 145 |
-
document.getElementById("outline").value = result.
|
| 146 |
alert("AI output wasn't strict JSON—showing raw response as fallback in Outline. Check server logs for details.");
|
| 147 |
}
|
| 148 |
}
|
|
|
|
| 15 |
<div class="mb-4">
|
| 16 |
<label for="model" class="block text-sm font-medium text-gray-700">Select AI Model (Explicit Content)</label>
|
| 17 |
<select id="model" class="mt-1 block w-full p-2 border border-gray-300 rounded-md" required>
|
| 18 |
+
<option value="nousresearch/hermes-3-llama-3.1-70b">Hermes 3 Llama 3.1 70B (Uncensored, Explicit)</option>
|
| 19 |
<option value="deepseek/deepseek-chat-v3-0324:free">DeepSeek Chat (Free)</option>
|
| 20 |
+
<option value="deepseek/deepseek-chat-v3-0324">DeepSeek Chat (Paid)</option>
|
| 21 |
+
<option value="deepseek/deepseek-chat-v3.1">DeepSeek Chat v3.1(Paid)</option>
|
| 22 |
<option value="deepseek/deepseek-r1-0528:free">DeepSeek R1 (Free)</option>
|
| 23 |
<option value="deepseek/deepseek-r1-0528">DeepSeek R1 (Paid)</option>
|
| 24 |
<option value="tngtech/deepseek-r1t2-chimera:free">DeepSeek TNG (Free)</option>
|
|
|
|
| 72 |
const generateButton = document.getElementById("generate_novel");
|
| 73 |
const outputsDiv = document.getElementById("outputs");
|
| 74 |
|
| 75 |
+
// Helper to safely stringify for textarea
|
| 76 |
+
function safeStringify(value) {
|
| 77 |
+
if (value === null || value === undefined) return "";
|
| 78 |
+
if (typeof value === 'string') return value;
|
| 79 |
+
if (typeof value === 'object') {
|
| 80 |
+
try {
|
| 81 |
+
return JSON.stringify(value, null, 2);
|
| 82 |
+
} catch (e) {
|
| 83 |
+
return JSON.stringify(value);
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
return String(value);
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
// Handle file upload: read and populate textarea
|
| 90 |
fileInput.addEventListener("change", (event) => {
|
| 91 |
const file = event.target.files[0];
|
|
|
|
| 150 |
if (result.error) {
|
| 151 |
document.getElementById("outline").value = `Error: ${result.error}`;
|
| 152 |
} else {
|
| 153 |
+
// Structured fields with safe stringify
|
| 154 |
+
document.getElementById("outline").value = safeStringify(result.outline);
|
| 155 |
+
document.getElementById("locations").value = safeStringify(result.locations);
|
| 156 |
+
document.getElementById("objects").value = safeStringify(result.objects);
|
| 157 |
|
| 158 |
// Fallback if no structured data
|
| 159 |
if (!result.outline && result.raw_response) {
|
| 160 |
+
document.getElementById("outline").value = safeStringify(result.raw_response).substring(0, 2000) + "...";
|
| 161 |
alert("AI output wasn't strict JSON—showing raw response as fallback in Outline. Check server logs for details.");
|
| 162 |
}
|
| 163 |
}
|