Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
studio: handle reasoning_content in GGUF streaming
Daniel Han961720c1b17d
diff --git a/studio/backend/core/inference/llama_cpp.py b/studio/backend/core/inference/llama_cpp.pyindex 21a25d51b2e..2f68958bbd8 100644--- a/studio/backend/core/inference/llama_cpp.py+++ b/studio/backend/core/inference/llama_cpp.py@@ -592,6 +592,7 @@ class LlamaCppBackend:url = f"{self.base_url}/v1/chat/completions"cumulative = ""+ in_thinking = Falsetry:with httpx.Client(timeout = None) as client:@@ -615,6 +616,9 @@ class LlamaCppBackend:if not line:continueif line == "data: [DONE]":+ if in_thinking:+ cumulative += "</think>"+ yield cumulativereturnif not line.startswith("data: "):continue@@ -624,8 +628,23 @@ class LlamaCppBackend:choices = data.get("choices", [])if choices:delta = choices[0].get("delta", {})++ # Handle reasoning/thinking tokens+ # llama-server sends these as "reasoning_content"+ # Wrap in <think> tags for the frontend parser+ reasoning = delta.get("reasoning_content", "")+ if reasoning:+ if not in_thinking:+ cumulative += "<think>"+ in_thinking = True+ cumulative += reasoning+ yield cumulative+token = delta.get("content", "")if token:+ if in_thinking:+ cumulative += "</think>"+ in_thinking = Falsecumulative += tokenyield cumulativeexcept json.JSONDecodeError: