> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vivix.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# asset.add

在会话过程中注册图像引用和可复用的脚本资产。资产只能新增：在 v1 中，已有的 `asset_id` 不能修改或替换。如果事件中的任一资产无效，则该事件中的所有资产都不会被注册。在 `response.script` 中引用新 ID 前，请等待 `asset.added`。

## 事件字段

**event\_id** `string`

客户端为本事件生成的 ID。

**type** `string` *required*

事件类型。必须为 `asset.add`。

**assets** `object` *required*

为物体互动或后续脚本响应注册的资产。`images`、`audio`、`speech_text` 或 `visual_prompts` 中至少提供一项资产。

**assets.images** `array`

用于视觉交互的对象参考图像。

**assets.images\[].asset\_id** `string` *required*

对象引用 ID，在会话资产中必须唯一。请依次使用 `OBJ_0`、`OBJ_1` 等。

**assets.images\[].url** `string` *required*

图像文件的 HTTPS URL。

**assets.images\[].mime\_type** `string`

图像 MIME 类型，例如 `image/png` 或 `image/jpeg`。

**assets.images\[].description** `string`

可选的视觉说明。如提供，请包含匹配的引用标签，例如对应 `asset_id: "OBJ_0"` 可写 `a dark gray cylindrical speaker<OBJ_0>`。请描述物体可见的形状、颜色和显著特征。详情请参阅[物体互动](https://docs.vivix.ai/cn/streaming-avatar/interaction/object-interaction.md)。

**assets.audio** `array`

供 `response.script.vocal.type: "audio_asset"` 使用的可复用音频资产。

**assets.audio\[].asset\_id** `string` *required*

由调用方定义的音频资产 ID，在会话内必须唯一。

**assets.audio\[].url** `string` *required*

音频文件的 HTTPS URL。Vivix 必须能够在不添加自定义请求头的情况下直接访问该 URL。

**assets.audio\[].mime\_type** `string`

音频 MIME 类型。支持 `audio/wav` 和 `audio/mpeg`。

**assets.speech\_text** `array`

供 `response.script.vocal.type: "speech_asset"` 使用的可复用准确语音文本。

**assets.speech\_text\[].asset\_id** `string` *required*

由调用方定义的语音文本资产 ID，在会话内必须唯一。

**assets.speech\_text\[].text** `string` *required*

需要合成的准确文本。在 `response.script` 中使用时，该文本也会通过输出文本事件流式返回。

**assets.speech\_text\[].format** `string`

文本格式。使用 `text`；不支持 SSML。

**assets.visual\_prompts** `array`

供 `response.script.visual.visual_prompt_asset_id` 使用的可复用视觉指令。

**assets.visual\_prompts\[].asset\_id** `string` *required*

由调用方定义的视觉提示资产 ID，在会话内必须唯一。

**assets.visual\_prompts\[].text** `string` *required*

可复用的视觉指令文本，用于描述角色动作、姿势、视线、手势或展示方式。

**assets.visual\_prompts\[].format** `string`

文本格式，例如 `text`。

```json asset.add theme={null}
{
  "event_id": "evt_asset_add_001",
  "type": "asset.add",
  "assets": {
    "images": [
      {
        "asset_id": "OBJ_0",
        "url": "https://YOUR_CDN.example/speaker.png",
        "mime_type": "image/png",
        "description": "A dark gray cylindrical speaker<OBJ_0> with a perforated grille and a flat base"
      }
    ],
    "audio": [
      {
        "asset_id": "promo_sting",
        "url": "https://cdn.example.com/audio/promo-sting.wav",
        "mime_type": "audio/wav"
      }
    ],
    "speech_text": [
      {
        "asset_id": "line_discount",
        "text": "This deal is available for the next ten minutes."
      }
    ],
    "visual_prompts": [
      {
        "asset_id": "gesture_point",
        "text": "point toward the featured product"
      }
    ]
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.