diff --git a/public/src/uncloseai-embed-modal.js b/public/src/uncloseai-embed-modal.js index 29c96f4..1ee6801 100644 --- a/public/src/uncloseai-embed-modal.js +++ b/public/src/uncloseai-embed-modal.js @@ -247,6 +247,15 @@ async function openUncloseaiEmbeddedModalNew() { document.head.appendChild(link); } + // Load highlight.js CSS for code block syntax highlighting + if (!document.querySelector('link[href*="highlight"]')) { + const hljsLink = document.createElement("link"); + hljsLink.rel = "stylesheet"; + hljsLink.href = + "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/styles/a11y-dark.min.css"; + document.head.appendChild(hljsLink); + } + // Ensure ChunkFive font is loaded and text colors are enforced initializeChunkFiveFont(); diff --git a/public/uncloseai-js-styleguide.html b/public/uncloseai-js-styleguide.html index c7dfbf4..8eca4cd 100644 --- a/public/uncloseai-js-styleguide.html +++ b/public/uncloseai-js-styleguide.html @@ -553,9 +553,27 @@

Heading scale factor: 1.125 (major second). h1 through h6 computed via calc(1rem * var(--heading-scale)^n).

Code

-
// Example: one-line installation
-<script src="https://uncloseai.com/uncloseai.js" type="module"></script>
-

Code blocks use highlight.js with the a11y-dark theme. Inline code uses the default PicoCSS monospace styling.

+

Code blocks use highlight.js v11.10.0 with the a11y-dark theme. The modal auto-loads this stylesheet on any host page. Inline code uses PicoCSS monospace styling.

+ +
// JavaScript: one-line installation
+const script = document.createElement("script");
+script.src = "https://uncloseai.com/uncloseai.js";
+script.type = "module";
+document.head.appendChild(script);
+ +
# Python: streaming chat with uncloseai
+class UncloseAI:
+    def __init__(self):
+        self.endpoints = []
+
+    def chat_stream(self, model, messages):
+        for chunk in self._sse_stream(model, messages):
+            yield chunk["choices"][0]["delta"]["content"]
+ +
# Bash: test the TTS endpoint
+curl -X POST https://speech.ai.unturf.com/v1/audio/speech \
+  -H "Content-Type: application/json" \
+  -d '{"model":"tts-1","voice":"alloy","input":"Hello world"}'