产品动态
关于云联络中心术语更新

@vue/cli版本在 5.0.0 以上,您可使用以下示例代码升级@vue/cli版本至 v5.0.8。@vue/cli创建,集成 UIKit 后运行项目如有报错,请查阅常见问题解决。npm install -g @vue/cli@5.0.8 sass sass-loader@10.1.1
vue create ai-desk-example

cd ai-desk-example
npm i vue@2.7.9 vue-template-compiler@2.7.9
npm i @vue/composition-api unplugin-vue2-script-setup vue@2.6.14 vue-template-compiler@2.6.14
npm create vite@latest

cd ai-desk-examplenpm install
npm i -D sass sass-loader
echo -n > src/style.css
Clear-Content -Path src/style.css
echo. > src\\style.css
npm i @tencentcloud/ai-desk-customer-vue@latest
mkdir -p ./src/ai-desk-customer-vue && rsync -av --exclude={'node_modules','excluded-list.txt'} ./node_modules/@tencentcloud/ai-desk-customer-vue/ ./src/ai-desk-customer-vue
npm i @tencentcloud/ai-desk-customer-vue@latest
xcopy .\\node_modules\\@tencentcloud\\ai-desk-customer-vue .\\src\\ai-desk-customer-vue /i /e /exclude:.\\node_modules\\@tencentcloud\\ai-desk-customer-vue\\excluded-list.txt
<template><CustomerServiceChat:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"/></template><script setup lang="ts">import TUICustomerServer, { CustomerServiceChat } from './ai-desk-customer-vue';import { onMounted } from "vue";onMounted(() => {const SDKAppID = 0; // Your SDKAppID,即开通了智能客服 Desk 的应用 IDconst userID = ''; // Your userID,可复用您 app 的账号体系,或随机生成const userSig = ''; // Your userSig,接入阶段可控制台生成,生产阶段请务必由服务端生成TUICustomerServer.init(SDKAppID, userID, userSig);});</script><style scoped></style>
<template><div id="app"><CustomerServiceChat:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"/></div></template><script lang="ts" setup>import TUICustomerServer, { CustomerServiceChat } from './ai-desk-customer-vue';import vue from './ai-desk-customer-vue/adapter-vue';const { onMounted } = vue;onMounted(() => {const SDKAppID = 0; // Your SDKAppIDconst userID = ''; // Your userIDconst userSig = ''; // Your userSigTUICustomerServer.init(SDKAppID, userID, userSig);});</script><style lang="scss"></style>
<template><div id="app"><CustomerServiceChat:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"/></div></template><script lang="ts" setup>import TUICustomerServer, { CustomerServiceChat } from './ai-desk-customer-vue';import vue from './ai-desk-customer-vue/adapter-vue';const { onMounted } = vue;onMounted(() => {const SDKAppID = 0; // Your SDKAppIDconst userID = ''; // Your userIDconst userSig = ''; // Your userSigTUICustomerServer.init(SDKAppID, userID, userSig);});</script><style lang="scss"></style>
main.ts/main.js 中引入 VueCompositionAPI。import VueCompositionAPI from "@vue/composition-api";Vue.use(VueCompositionAPI);
vue.config.js 中增加,若没有该文件请新建。const ScriptSetup = require("unplugin-vue2-script-setup/webpack").default;module.exports = {parallel: false, // disable thread-loader, which is not compactible with this pluginconfigureWebpack: {plugins: [ScriptSetup({/* options */}),],},chainWebpack(config) {// disable type check and let `vue-tsc` handles itconfig.plugins.delete("fork-ts-checker");},};
src/ai-desk-customer-vue/adapter-vue-web.ts 文件最后, 替换导出源:// 初始写法export * from "vue";// 替换为export * from "@vue/composition-api";
App.vue中的 SDKAppID、userID、userSig 。

administrator。
module.exports = defineConfig({devServer: {client: {overlay: false,},},});
module.exports = {devServer: {overlay: false,},};
{"exclude": ["node_modules","src/ai-desk-customer-vue",]}
npm run serve
npm run dev
语言代码(userLang) | 语言 |
zh_cn | 简体中文 |
en | 英文 |
zh_tw | 繁体中文 |
ja | 日语 |
id | 印尼语 |
ms | 马来语 |
vi | 越南语 |
th | 泰语 |
fil | 菲律宾语 |
ru | 俄语 |
userLang="en"。如果您不指定userLang, UIKit 会使用浏览器设置的语言。<template><CustomerServiceChat:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"userLang="en"/></template>
TUICustomerServer.changeLanguage接口,并通过切换 页面/组件 key 的方式,实现语言动态修改与展示。<template><CustomerServiceChat:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }":key="locale":userLang="locale"/></template><script setup lang="ts">import TUICustomerServer, { CustomerServiceChat } from './ai-desk-customer-vue';import { onMounted, ref } from "vue";const locale = ref('en');const changeLanguage = (language: string) => {TUICustomerServer.changeLanguage(language).then(() => {locale.value = language;});}</script><style scoped lang="scss"></style>

initWithProfile 接口初始化,传入昵称和头像即可。TUICustomerServer.initWithProfile({SDKAppID,userID,userSig,nickName: '张三 1852010****',avatar: 'https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_3.png'})
toolbarButtonList。效果如下所示:
toolbarButtonList 是一个包含了一个或多个配置的数组,配置的描述如下:参数 | 类型 | 是否必填 | 说明 |
title | String | Yes | button 标题。 |
icon | String | No | button 图标 url。 |
isPreset | Number | Yes | 1:客服组件内置功能。 0:非内置功能。 |
presetId | String | No | 当 isPreset 为 1 时,可选值如下: humanService:人工服务。 serviceRating:服务评价。 endHumanService:结束对话。 |
isEnabled | Number | Yes | 1:渲染。 0:不渲染。 |
content | String | No | 当 isPreset 为 0 时,填入文本内容或者 url。 |
type | Number | Yes | 1:点击 button 后客服组件发送 content 对应的文本。 2:点击 button 后客服组件打开 content 对应的 url(小程序打开 url 可能会受限,请提前参考相关文档解决)。 3 - 点击 button 后触发指定任务流。 4 - 点击 button 后转指定的坐席,或者指定的客服分组。 |
<template><CustomerServiceChat:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }":toolbarButtonList="toolbarButtonList"/></template><script setup lang="ts">import TUICustomerServer, { CustomerServiceChat } from './ai-desk-customer-vue';import { onMounted } from 'vue';const toolbarButtonList = [{"title":"人工服务","icon":"https://tccc-im-agent-avatar-1258344699.cos.ap-nanjing.myqcloud.com/toolbar_button_1.png","type":1,"content":"","isPreset":1,"presetId":"humanService","isEnabled":1},{"title":"服务评价","icon":"https://tccc-im-agent-avatar-sg-1258344699.cos.ap-singapore.myqcloud.com/toolbar_button_2.png","type":1,"content":"","isPreset":1,"presetId":"serviceRating","isEnabled":1},{"title":"结束对话","icon":"https://tccc-im-agent-avatar-sg-1258344699.cos.ap-singapore.myqcloud.com/toolbar_button_3.png","type":1,"content":"","isPreset":1,"presetId":"endHumanService","isEnabled":1},// 发送普通文本{"title":"智能客服","type":1,"content":"智能客服","isPreset":0,"isEnabled":1},// 触发指定任务流,taskFlowID 为任务流 ID, 如果 description 为空则不会显示在消息列表中{"title":"触发指定任务流","type":3,"content":{"taskFlowID":3226, "description":"your description"},"isPreset":0,"isEnabled":1},// 转指定的人工坐席,specificMemberList 为人工坐席账号列表{"title":"转指定坐席","type":4,"content":{"specificMemberList":["agent_01@email.com"], "description":"your description"},"isPreset":0,"isEnabled":1},// 转指定的客服分组,groupID 为客服分组 ID{"title":"转指定客服分组","type":4,"content":{"groupID":111, "description":"your description"},"isPreset":0,"isEnabled":1}];onMounted(() => {const SDKAppID = 0; // Your SDKAppID,即开通了智能客服 Desk 的应用 IDconst userID = ''; // Your userID,可复用您 app 的账号体系,或随机生成const userSig = ''; // Your userSig,接入阶段可控制台生成,生产阶段请务必由服务端生成TUICustomerServer.init(SDKAppID, userID, userSig);});</script><style scoped></style>
bottomQuickOrder,效果如下所示:
bottomQuickOrder 的参数描述如下:参数 | 类型 | 是否必填 | 说明 |
header | String | Yes | 订单标题,对应上图的“智能客服高级版”。 |
desc | String | Yes | 订单描述,对应上图的“3000/月”。 |
pic | String | No | 订单图片 url。 |
url | String | Yes | 当客服坐席收到订单消息时,点击可打开此 url 对应的页面。 |
customField | Array | No | 自定义配置,例如“订单号”,“订单时间”等信息。 |
<template><CustomerServiceChat:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }":bottomQuickOrder="bottomQuickOrder"/></template><script setup lang="ts">import TUICustomerServer, { CustomerServiceChat } from './ai-desk-customer-vue';import { onMounted } from 'vue';const bottomQuickOrder = {header: "高级版智能客服(包含3个客服许可)",desc: "¥3000/月",pic: "https://static.cloudcachetci.com/qcloud/portal/kit/images/presale.a4955999.jpeg",url: 'https://your_url.com',customField: [{name: '订单号',value: '11111111111111111111'},{name: '下单时间',value: '2025-07-02 16:23'}]};onMounted(() => {const SDKAppID = 0; // Your SDKAppID,即开通了智能客服 Desk 的应用 IDconst userID = ''; // Your userID,可复用您 app 的账号体系,或随机生成const userSig = ''; // Your userSig,接入阶段可控制台生成,生产阶段请务必由服务端生成TUICustomerServer.init(SDKAppID, userID, userSig);});</script><style scoped></style>
TUICustomerServer.initWithProfile({SDKAppID,userID,userSig,nickName: '张三 1852010****',avatar: 'https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_3.png'}).then(() => {TUICustomerServer.transferToHuman({specificMemberList: ['agent_account_1', 'agent_account_2'], // 请替换为您应用的人工坐席账号description: 'your description'});});
TUICustomerServer.initWithProfile({SDKAppID,userID,userSig,nickName: '张三 1852010****',avatar: 'https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_3.png'}).then(() => {TUICustomerServer.transferToHuman({groupID: 0, // 请替换为您应用的客服分组 IDdescription: 'your description'});});
TUICustomerServer.initWithProfile({SDKAppID,userID,userSig,nickName: '张三 1852010****',avatar: 'https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_3.png'}).then(() => {TUICustomerServer.transferToTaskFlow({taskFlowID: 0, // 请替换为您应用的任务流 IDdescription: 'your description'});});

// 1. 初始化前将业务侧自定义的客服号 ID 传递给 UIKitTUICustomerServer.setCustomerServiceIDList(['customerServiceID_001', 'customerServiceID_002', 'customerServiceID_003']);// 2. 初始化时,带上要发起会话的客服号 ID,比如 'customerServiceID_002'// 如果不带上要发起会话的客服号 ID,则 UIKit 默认使用多客服号列表的第 1 个元素TUICustomerServer.initWithProfile({SDKAppID,userID,userSig,nickName: '张三 1562010****',avatar: 'your avatar url',customerServiceID: 'customerServiceID_002',});
TUICustomerServer.sendCustomMessage({to: '@customer_service_account',conversationType: 'C2C',payload: {data: JSON.stringify({src: '27',customerServicePlugin: 0,}),},}, { onlineUserOnly: true });
vue add typescript

npm install -D typescript

npm i marked@5.1.2 --legacy-peer-deps

npm i marked@6.0.0 --legacy-peer-deps
文档反馈