Spaces:
Running
Running
Thinking levels: Off / Low / Medium / High (edge maps the level to the trained effort line)
Browse files- README.md +1 -1
- index.html +9 -5
README.md
CHANGED
|
@@ -16,7 +16,7 @@ Static chat client for the hosted OpenAI-compatible endpoint at `https://api.les
|
|
| 16 |
- Model: `gemma-4-31b-humanlike-chat`
|
| 17 |
- No API key required
|
| 18 |
- Optional system prompt for a persona, setting, or relationship, kept in the browser between reloads
|
| 19 |
-
- Thinking: off (default) or
|
| 20 |
- One conversation per page load; refreshing starts a new session
|
| 21 |
- Requests send only `model`, `messages`, `stream`, `max_tokens`, and `chat_template_kwargs`, so the endpoint defaults match the deployment gate
|
| 22 |
|
|
|
|
| 16 |
- Model: `gemma-4-31b-humanlike-chat`
|
| 17 |
- No API key required
|
| 18 |
- Optional system prompt for a persona, setting, or relationship, kept in the browser between reloads
|
| 19 |
+
- Thinking: off (default), low, medium, or high
|
| 20 |
- One conversation per page load; refreshing starts a new session
|
| 21 |
- Requests send only `model`, `messages`, `stream`, `max_tokens`, and `chat_template_kwargs`, so the endpoint defaults match the deployment gate
|
| 22 |
|
index.html
CHANGED
|
@@ -152,7 +152,9 @@
|
|
| 152 |
<label for="reasoning">Thinking</label>
|
| 153 |
<select id="reasoning">
|
| 154 |
<option value="off">Off (fastest, the default)</option>
|
| 155 |
-
<option value="
|
|
|
|
|
|
|
| 156 |
</select>
|
| 157 |
</div>
|
| 158 |
</details>
|
|
@@ -172,7 +174,7 @@
|
|
| 172 |
const API = "https://api.lessthanthreeai.com/v1";
|
| 173 |
const MODEL = "gemma-4-31b-humanlike-chat";
|
| 174 |
const INTRO = "Say something. The first reply can take a few minutes while the inference worker starts.";
|
| 175 |
-
const MAX_TOKENS = { off: 512,
|
| 176 |
|
| 177 |
const chat = document.querySelector("#chat");
|
| 178 |
const form = document.querySelector("#form");
|
|
@@ -186,9 +188,9 @@
|
|
| 186 |
const messages = [];
|
| 187 |
|
| 188 |
system.value = localStorage.getItem("systemPrompt") || "";
|
| 189 |
-
reasoning.value = localStorage.getItem("
|
| 190 |
system.addEventListener("input", () => localStorage.setItem("systemPrompt", system.value));
|
| 191 |
-
reasoning.addEventListener("change", () => localStorage.setItem("
|
| 192 |
|
| 193 |
function addMessage(role, text) {
|
| 194 |
const element = document.createElement("div");
|
|
@@ -266,7 +268,9 @@
|
|
| 266 |
? [{ role: "system", content: systemPrompt }, ...messages]
|
| 267 |
: messages;
|
| 268 |
|
| 269 |
-
const chatTemplateKwargs =
|
|
|
|
|
|
|
| 270 |
|
| 271 |
try {
|
| 272 |
const response = await fetch(`${API}/chat/completions`, {
|
|
|
|
| 152 |
<label for="reasoning">Thinking</label>
|
| 153 |
<select id="reasoning">
|
| 154 |
<option value="off">Off (fastest, the default)</option>
|
| 155 |
+
<option value="low">Low</option>
|
| 156 |
+
<option value="medium">Medium</option>
|
| 157 |
+
<option value="high">High</option>
|
| 158 |
</select>
|
| 159 |
</div>
|
| 160 |
</details>
|
|
|
|
| 174 |
const API = "https://api.lessthanthreeai.com/v1";
|
| 175 |
const MODEL = "gemma-4-31b-humanlike-chat";
|
| 176 |
const INTRO = "Say something. The first reply can take a few minutes while the inference worker starts.";
|
| 177 |
+
const MAX_TOKENS = { off: 512, low: 4096, medium: 4096, high: 8192 };
|
| 178 |
|
| 179 |
const chat = document.querySelector("#chat");
|
| 180 |
const form = document.querySelector("#form");
|
|
|
|
| 188 |
const messages = [];
|
| 189 |
|
| 190 |
system.value = localStorage.getItem("systemPrompt") || "";
|
| 191 |
+
reasoning.value = localStorage.getItem("thinkingLevel") in MAX_TOKENS ? localStorage.getItem("thinkingLevel") : "off";
|
| 192 |
system.addEventListener("input", () => localStorage.setItem("systemPrompt", system.value));
|
| 193 |
+
reasoning.addEventListener("change", () => localStorage.setItem("thinkingLevel", reasoning.value));
|
| 194 |
|
| 195 |
function addMessage(role, text) {
|
| 196 |
const element = document.createElement("div");
|
|
|
|
| 268 |
? [{ role: "system", content: systemPrompt }, ...messages]
|
| 269 |
: messages;
|
| 270 |
|
| 271 |
+
const chatTemplateKwargs = effort === "off"
|
| 272 |
+
? { enable_thinking: false, preserve_thinking: false }
|
| 273 |
+
: { enable_thinking: true, reasoning_effort: effort, preserve_thinking: false };
|
| 274 |
|
| 275 |
try {
|
| 276 |
const response = await fetch(`${API}/chat/completions`, {
|