---
name: "deletePanelAgentMemory"
mode: "kit"
versionRequirements:
  - { name: "@tuya-miniapp/cloud-api", version: "1.0.6" }
---

## deletePanelAgentMemory

> [VERSION] @tuya-miniapp/cloud-api >= 1.0.6

> 💡 接口依赖云能力，需在 [小程序开发者平台](https://platform.tuya.com/miniapp/)开发设置 - 云能力 进行授权配置。

### 描述

删除角色记忆。

### 参数

`Params`

| 参数 | 类型 | 必填 | 默认值 | 描述 |
| --- | --- | --- | --- | --- |
| `params` | `DeletePanelAgentMemoryParams` | 是 | - | 请求体 |

### 引用对象

##### `interface` DeletePanelAgentMemoryParams

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `devId` | `string` | 设备ID |
| `bindRoleType` | `0 \| 1 \| 2` | 0-自定义智能体角色,1-智能体角色模板,2-单角色场景默认角色 |
| `roleId` | `string` | 角色ID（会根据bindRoleType决定具体含义） |
| `clearAllMemory` | `boolean` | 是否清除全部记忆 |
| `memoryKeys` | `string` | 待删除记忆的memoryKey（多个用逗号隔开） |


### 示例代码

#### 请求示例

```typescript
import { deletePanelAgentMemory } from '@tuya-miniapp/cloud-api';

// 删除指定记忆
const params1 = {
  devId: 'your_device_id',
  bindRoleType: 0,
  roleId: 'role_12345',
  clearAllMemory: false,
  memoryKeys: 'memory_001,memory_002',
};

// 清除全部记忆
const params2 = {
  devId: 'your_device_id',
  bindRoleType: 0,
  roleId: 'role_12345',
  clearAllMemory: true,
};

deletePanelAgentMemory(params1)
  .then(result => {
    console.log('删除结果:', result);
  })
  .catch(error => {
    console.error('删除记忆失败:', error);
  });
```

#### 返回示例

```json
true
```
