Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

1.6 KB
Raw Blame
/**
 * Pure presentation logic for the collapsed reasoning-process char counter.
 *
 * Kept side-effect-free so it can be unit-tested without a DOM harness, matching
 * the existing pattern of `aiAgentStepPresentation.ts`. The AiAssistant template
 * consumes these helpers so its render decisions (show/hide, pulse class, text)
 * are covered by Vitest rather than only by the rendered template.
 */

/** Base CSS classes for the collapsed reasoning char counter span. */
export const REASONING_CHAR_COUNT_BASE_CLASS = "tabular-nums text-muted-foreground/60";

/** Extra class added while the model is still producing reasoning deltas. */
export const REASONING_CHAR_COUNT_PULSE_CLASS = "animate-pulse";

/**
 * Decide whether the collapsed reasoning char counter should render.
 * Visible only when there is reasoning text AND the panel is collapsed,
 * so the counter acts as a "still alive" heartbeat without forcing the
 * user to open the panel.
 *
 * @param reasoning  Accumulated reasoning text (may be empty during initial thinking).
 * @param expanded   Whether the reasoning panel is currently expanded.
 */
export function shouldShowReasoningCharCount(reasoning: string | undefined, expanded: boolean): boolean {
  return !expanded && !!reasoning && reasoning.length > 0;
}

/**
 * Return the CSS class string for the counter span.
 * Adds a pulse animation while the model is still thinking so the number
 * reads as actively growing rather than frozen.
 */
export function reasoningCharCountClass(isThinking: boolean): string {
  return isThinking ? `${REASONING_CHAR_COUNT_BASE_CLASS} ${REASONING_CHAR_COUNT_PULSE_CLASS}` : REASONING_CHAR_COUNT_BASE_CLASS;
}