For AI agents: the complete documentation index is available at /en/llms.txt, the full documentation bundle is available at /en/llms-full.txt, and this page is available as Markdown at /en/reference/sdk/sapi/runtime/functions/generateId.md.
  • English
  • Function: generateId()

    function generateId(type: IDType): string;

    Defined in: sapi/runtime/tools.ts:235

    生成带有业务类型前缀的随机短 ID(例如 CH_a1b2c3d4)。

    Parameters

    ParameterTypeDescription
    typeIDType业务实体 ID 类型前缀。

    Returns

    string

    带前缀的唯一随机字符串。