Skip to content

Commit ee872c8

Browse files
committed
fix: fix toolname parse
1 parent 53531d8 commit ee872c8

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ Page({
147147

148148
![](https://qcloudimg.tencent-cloud.cn/raw/b45a95e06ec0df8dab5c9d9ec7707faa.png)
149149

150-
#### 4. agent-ui 组件工具卡片组件中配置自定义组件映射
150+
#### 4. 实现 Agent UI customCard 组件
151+
152+
- 在agent-ui customCard 组件(agent-ui/customCard/index.wxml) 中添加自定义逻辑,可根据不同 tool 类型渲染不同自定义组件
151153

152154
![](https://qcloudimg.tencent-cloud.cn/raw/b4cd35ccaa3e72189934ed59d35f7ae5.png)
153155

apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,8 @@ Component({
398398
},
399399
transformToolName: function (str) {
400400
if (str) {
401-
const strArr = str.split("/");
402-
if (strArr[1]) {
403-
return strArr[1];
404-
} else if (strArr[0]) {
405-
return strArr[0];
406-
}
401+
const strArr = str.split(/\/+/);
402+
return strArr[strArr.length - 1];
407403
}
408404
return "";
409405
},

0 commit comments

Comments
 (0)