Slash Command Keyboard Handler (Chat/slashKeyboardUtils.ts)

QwenPaw · console/src/pages/Chat/slashKeyboardUtils.ts · typescript · Apache-2.0
ui, chat, tag:keyboard, tag:suggestions

Handles keyboard events for slash command suggestions in chat UI

// Source: https://github.com/agentscope-ai/QwenPaw | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * slashKeyboardUtils.ts — extracted keyboard logic for slash suggestions (#3274)
 *
 * These pure functions encapsulate the keyboard-event decision logic used in
 * Chat/index.tsx so they can be unit-tested without mounting the full component.
 */

/**
 * Returns true when the slash-suggestion popup should be considered open.
 * The popup is open when the textarea value starts with "/" and contains
 * no whitespace after the slash (i.e. the user is still typing the command).
 */
export function isSuggestionPopupOpen(value: string): boolean {
  return value.startsWith("/") && !/

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key