Skip to content

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.

804 B
Raw Blame
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved.

from pathlib import Path


CHAT_API = (
    Path(__file__).resolve().parents[2]
    / "studio"
    / "frontend"
    / "src"
    / "features"
    / "chat"
    / "api"
    / "chat-api.ts"
)


def test_length_detection_classifies_visible_and_reasoning_content():
    source = CHAT_API.read_text(encoding = "utf-8")

    assert "return value.trim().length > 0;" in source
    assert 'record.type === "thinking" || record.type === "reasoning"' in source
    assert 'record.type === "text" || record.type === "output_text"' in source
    assert "sawAssistantContent ||= contentState.hasAssistantContent;" in source
    assert "sawReasoningContent ||= contentState.hasReasoningContent;" in source