Fix docs modal: move markup before script so listeners attach
Browse filesThe 'How to use' button wasn't opening the modal because the modal
markup was placed AFTER the </script> tag, so when the script ran,
document.getElementById('docsOverlay') returned null and the click
handler was attached to nothing.
Move the modal <div> block to before the <script> tag so the IDs
exist at the time the script wires them up.
Co-Authored-By: Claude <noreply@anthropic.com>
- index.html +45 -44
index.html
CHANGED
|
@@ -215,6 +215,51 @@
|
|
| 215 |
</div>
|
| 216 |
</div>
|
| 217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
<script>
|
| 219 |
"use strict";
|
| 220 |
|
|
@@ -487,49 +532,5 @@ $("copySnippet").addEventListener("click", () => {
|
|
| 487 |
});
|
| 488 |
</script>
|
| 489 |
|
| 490 |
-
<div class="docs-overlay" id="docsOverlay">
|
| 491 |
-
<div class="docs-modal" id="docsModal">
|
| 492 |
-
<div class="docs-header">
|
| 493 |
-
<h3>How to use Inkling via Inference Providers</h3>
|
| 494 |
-
<button class="docs-close" id="closeDocs" type="button" aria-label="Close">×</button>
|
| 495 |
-
</div>
|
| 496 |
-
<div class="docs-body">
|
| 497 |
-
<p>Reach the model through Hugging Face's OpenAI-compatible router. Set <code>HF_TOKEN</code> in your environment and use the <code>thinkingmachines/Inkling:together</code> model id.</p>
|
| 498 |
-
<pre class="docs-snippet" id="docsCode"><button class="copy-btn" id="copySnippet" type="button">Copy</button>import os
|
| 499 |
-
from openai import OpenAI
|
| 500 |
-
|
| 501 |
-
client = OpenAI(
|
| 502 |
-
base_url="https://router.huggingface.co/v1",
|
| 503 |
-
api_key=os.environ["HF_TOKEN"],
|
| 504 |
-
)
|
| 505 |
-
|
| 506 |
-
stream = client.chat.completions.create(
|
| 507 |
-
model="thinkingmachines/Inkling:together",
|
| 508 |
-
messages=[
|
| 509 |
-
{
|
| 510 |
-
"role": "user",
|
| 511 |
-
"content": [
|
| 512 |
-
{
|
| 513 |
-
"type": "text",
|
| 514 |
-
"text": "Describe this image in one sentence."
|
| 515 |
-
},
|
| 516 |
-
{
|
| 517 |
-
"type": "image_url",
|
| 518 |
-
"image_url": {
|
| 519 |
-
"url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
|
| 520 |
-
}
|
| 521 |
-
}
|
| 522 |
-
]
|
| 523 |
-
}
|
| 524 |
-
],
|
| 525 |
-
stream=True,
|
| 526 |
-
)
|
| 527 |
-
|
| 528 |
-
for chunk in stream:
|
| 529 |
-
print(chunk.choices[0].delta.content, end="")</pre>
|
| 530 |
-
<p class="docs-footer">The <code>:auto</code> suffix routes to your preferred provider in settings; you can also use <code>:cheapest</code> or <code>:fastest</code>.</p>
|
| 531 |
-
</div>
|
| 532 |
-
</div>
|
| 533 |
-
</div>
|
| 534 |
</body>
|
| 535 |
</html>
|
|
|
|
| 215 |
</div>
|
| 216 |
</div>
|
| 217 |
|
| 218 |
+
<div class="docs-overlay" id="docsOverlay">
|
| 219 |
+
<div class="docs-modal" id="docsModal">
|
| 220 |
+
<div class="docs-header">
|
| 221 |
+
<h3>How to use Inkling via Inference Providers</h3>
|
| 222 |
+
<button class="docs-close" id="closeDocs" type="button" aria-label="Close">×</button>
|
| 223 |
+
</div>
|
| 224 |
+
<div class="docs-body">
|
| 225 |
+
<p>Reach the model through Hugging Face's OpenAI-compatible router. Set <code>HF_TOKEN</code> in your environment and use the <code>thinkingmachines/Inkling:together</code> model id.</p>
|
| 226 |
+
<pre class="docs-snippet" id="docsCode"><button class="copy-btn" id="copySnippet" type="button">Copy</button>import os
|
| 227 |
+
from openai import OpenAI
|
| 228 |
+
|
| 229 |
+
client = OpenAI(
|
| 230 |
+
base_url="https://router.huggingface.co/v1",
|
| 231 |
+
api_key=os.environ["HF_TOKEN"],
|
| 232 |
+
)
|
| 233 |
+
|
| 234 |
+
stream = client.chat.completions.create(
|
| 235 |
+
model="thinkingmachines/Inkling:together",
|
| 236 |
+
messages=[
|
| 237 |
+
{
|
| 238 |
+
"role": "user",
|
| 239 |
+
"content": [
|
| 240 |
+
{
|
| 241 |
+
"type": "text",
|
| 242 |
+
"text": "Describe this image in one sentence."
|
| 243 |
+
},
|
| 244 |
+
{
|
| 245 |
+
"type": "image_url",
|
| 246 |
+
"image_url": {
|
| 247 |
+
"url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
|
| 248 |
+
}
|
| 249 |
+
}
|
| 250 |
+
]
|
| 251 |
+
}
|
| 252 |
+
],
|
| 253 |
+
stream=True,
|
| 254 |
+
)
|
| 255 |
+
|
| 256 |
+
for chunk in stream:
|
| 257 |
+
print(chunk.choices[0].delta.content, end="")</pre>
|
| 258 |
+
<p class="docs-footer">The <code>:auto</code> suffix routes to your preferred provider in settings; you can also use <code>:cheapest</code> or <code>:fastest</code>.</p>
|
| 259 |
+
</div>
|
| 260 |
+
</div>
|
| 261 |
+
</div>
|
| 262 |
+
|
| 263 |
<script>
|
| 264 |
"use strict";
|
| 265 |
|
|
|
|
| 532 |
});
|
| 533 |
</script>
|
| 534 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 535 |
</body>
|
| 536 |
</html>
|