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

## updatePanelAgentCustomRole

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

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

### 描述

修改自定义角色。

### 参数

`Params`

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

### 引用对象

##### `interface` UpdatePanelAgentCustomRoleParams

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `devId` | `string` | 设备ID |
| `roleId` | `string` | 角色ID |
| `roleName` | `string` | 角色名称 |
| `roleDesc` | `string` | 角色描述 |
| `roleIntroduce` | `string` | 角色介绍 |
| `roleVariables` | `Record<string, any>` | 角色变量 |
| `roleImgUrl` | `string` | 角色图像 |
| `useLangCode` | `string` | 角色使用语言 |
| `useTimbreId` | `string` | 角色使用音色 |
| `useLlmId` | `string` | 角色使用语言模型 |
| `memoryInfo` | `string` | 记忆体 |
| `speed` | `string` | 音色速度 |
| `tone` | `string` | 音色语气 |
| `needBind` | `string` | 是否需要绑定 |


### 示例代码

#### 请求示例

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

const params = {
  devId: 'your_device_id',
  roleId: 'role_custom_12345',
  roleName: '智能助手小美v2',
  roleDesc: '更加温柔贴心的智能助手',
  roleIntroduce: '我是小美，您的专属智能助手，现在更加贴心了！',
  roleVariables: {
    personality: 'very_friendly',
    expertise: 'advanced',
  },
  roleImgUrl: 'https://example.com/new_avatar.jpg',
  useLangCode: 'zh-CN',
  useTimbreId: 'timbre_002',
  useLlmId: '1002',
  memoryInfo: '用户喜欢详细的解答',
  speed: '0.9',
  tone: '0.7',
  needBind: 'true',
};

updatePanelAgentCustomRole(params)
  .then(result => {
    console.log('更新结果:', result);
  })
  .catch(error => {
    console.error('更新自定义角色失败:', error);
  });
```

#### 返回示例

```json
true
```
