Skip to content

Commit 847b614

Browse files
authored
Merge pull request #60 from TencentCloudBase/dev
Dev
2 parents a5cd148 + 53531d8 commit 847b614

File tree

15 files changed

+31
-57
lines changed

15 files changed

+31
-57
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [1.12.2](https://github.com/TencentCloudBase/cloudbase-agent-ui/compare/v1.12.1...v1.12.2) (2025-05-09)
6+
7+
8+
### Bug Fixes
9+
10+
* fix readme ([076cc4b](https://github.com/TencentCloudBase/cloudbase-agent-ui/commit/076cc4b1f5029a5a324a50daee56b55e18031455))
11+
* fix readme ([0864a14](https://github.com/TencentCloudBase/cloudbase-agent-ui/commit/0864a143ce28431db5ba975bef1037c7549cbac6))
12+
513
### [1.12.1](https://github.com/TencentCloudBase/cloudbase-agent-ui/compare/v1.12.0...v1.12.1) (2025-05-07)
614

715
## [1.12.0](https://github.com/TencentCloudBase/cloudbase-agent-ui/compare/v1.11.0...v1.12.0) (2025-05-06)

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,24 +147,25 @@ Page({
147147

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

150+
#### 4. agent-ui 组件工具卡片组件中配置自定义组件映射
150151

151-
#### 4. 开发自定义卡片组件
152+
![](https://qcloudimg.tencent-cloud.cn/raw/b4cd35ccaa3e72189934ed59d35f7ae5.png)
153+
154+
如图所示,示例中添加了腾讯地图自定义卡片组件引用
155+
156+
#### 5. 自定义卡片组件开发
152157

153-
- 参照本工程中 apps/miniprogram-agent-ui/miniprogram/components/toolCard 目录内自定义工具卡片组件实现
158+
- 参照本工程中 apps/miniprogram-agent-ui/miniprogram/components/toolCard 目录内自定义腾讯地图卡片组件实现
154159

155160
![](https://qcloudimg.tencent-cloud.cn/raw/14a4a82810f0b45bde0c124cc8f3ed1c.png)
156161

157-
#### 5. 卡片组件引用配置
162+
#### 6. 自定义卡片组件引用配置
158163

159164
- 自定义卡片组件引用声明配置(可在用户小程序项目全局app.json中配置 或 agent-ui组件index.json中配置)
160165

161166
![](https://qcloudimg.tencent-cloud.cn/raw/cd1dc376a1e238f3186a2209e5875698.png)
162167

163-
- agent-ui 组件内 customCard/index.wxml 中添加自定义组件
164-
165-
![](https://qcloudimg.tencent-cloud.cn/raw/b4cd35ccaa3e72189934ed59d35f7ae5.png)
166-
167-
#### 6. 卡片效果
168+
#### 7. 卡片效果
168169

169170
<img src="https://qcloudimg.tencent-cloud.cn/raw/82adcd08eec9443f8b8a336342a4fa23.png" width="375px">
170171

apps/miniprogram-agent-ui/miniprogram/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ App({
1010
// env 参数决定接下来小程序发起的云开发调用(wx.cloud.xxx)会默认请求到哪个云环境的资源
1111
// 此处请填入环境 ID, 环境 ID 可打开云控制台查看
1212
// 如不填则使用默认环境(第一个创建的环境)
13-
env: "luke-agent-dev-7g1nc8tqc2ab76af",
13+
env: "luke-personal-test-new-8d0d90f5f",
1414
traceUser: true,
1515
});
1616
}

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

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ Component({
172172
allowMultiConversation,
173173
allowVoice,
174174
} = this.data.agentConfig;
175-
console.log("allowWebSearch", allowWebSearch);
176175
allowWebSearch = allowWebSearch === undefined ? true : allowWebSearch;
177176
allowUploadFile = allowUploadFile === undefined ? true : allowUploadFile;
178177
allowPullRefresh = allowPullRefresh === undefined ? true : allowPullRefresh;
@@ -439,7 +438,6 @@ Component({
439438
const res = await this.fetchConversationList(true, this.data.bot.botId);
440439
if (res) {
441440
const { data } = res;
442-
console.log("default conversation", data);
443441
if (data && !data.code) {
444442
// 区分旧的默认会话结构与新的默认会话结构
445443
if (data.data) {
@@ -487,7 +485,6 @@ Component({
487485
method: "GET",
488486
header: {},
489487
success: (res) => {
490-
console.log("conversation list res", res);
491488
resolve(res);
492489
},
493490
fail(e) {
@@ -517,7 +514,6 @@ Component({
517514
},
518515
method: "POST",
519516
success: (res) => {
520-
console.log("create conversation res", res);
521517
resolve(res);
522518
},
523519
fail(e) {
@@ -567,7 +563,6 @@ Component({
567563
page: this.data.conversationPageOptions.page + 1,
568564
},
569565
});
570-
console.log("conversationPageOptions", this.data.conversationPageOptions);
571566
// 调用分页接口查询更多
572567
if (this.data.bot.botId) {
573568
const res = await this.fetchConversationList(false, this.data.bot.botId);
@@ -598,19 +593,16 @@ Component({
598593
try {
599594
if (this.data.bot.botId) {
600595
const res = await this.fetchConversationList(false, this.data.bot.botId);
601-
console.log("res", res);
602596
if (res) {
603597
const { data } = res;
604598
if (data && !data.code) {
605599
// TODO: 临时倒序处理
606600
const sortData = data.data.sort(
607601
(a, b) => new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
608602
);
609-
console.log("sortData", sortData);
610603
const finalConData = this.data.defaultConversation
611604
? sortData.concat(this.data.defaultConversation)
612605
: sortData;
613-
console.log("finalConData", finalConData);
614606
this.setData({
615607
conversations: finalConData,
616608
transformConversations: this.transformConversationList(finalConData),
@@ -644,7 +636,6 @@ Component({
644636
earlyCon.push(item);
645637
}
646638
}
647-
console.log("todayCon curMonthCon earlyCon", todayCon, curMonthCon, earlyCon);
648639
return {
649640
todayCon,
650641
curMonthCon,
@@ -718,10 +709,12 @@ Component({
718709
const transformToolCallObj = {
719710
id: curParam.tool_call.id,
720711
name: this.transformToolName(curParam.tool_call.function.name),
712+
rawParams: curParam.tool_call.function.arguments,
721713
callParams: "```json\n\n" + JSON.stringify(curParam.tool_call.function.arguments, null, 2) + "\n```",
722714
content: ((curContent && curContent.content) || "").replaceAll("\t", "").replaceAll("\n", "\n\n"),
723715
};
724716
if (curResult) {
717+
transformToolCallObj.rawResult = curResult.result;
725718
transformToolCallObj.callResult = "```json\n\n" + JSON.stringify(curResult.result, null, 2) + "\n```";
726719
}
727720
if (curError) {
@@ -1847,7 +1840,6 @@ Component({
18471840
},
18481841
method: "POST",
18491842
success: (res) => {
1850-
console.log("create text-to-speech task res", res);
18511843
resolve(res);
18521844
},
18531845
fail(e) {
@@ -1856,7 +1848,6 @@ Component({
18561848
},
18571849
});
18581850
});
1859-
console.log("text-to-speech", res);
18601851
const { data } = res;
18611852
if (data && data.TaskId) {
18621853
const taskId = data.TaskId;
@@ -1873,7 +1864,6 @@ Component({
18731864
},
18741865
method: "GET",
18751866
success: (res) => {
1876-
console.log("create text-to-speech task res", res);
18771867
resolve(res);
18781868
},
18791869
fail(e) {
@@ -1882,7 +1872,6 @@ Component({
18821872
},
18831873
});
18841874
});
1885-
console.log("query task res", res);
18861875
const { data } = res;
18871876
if (data.code || data.Status === 2) {
18881877
loopQueryStatus = false;
@@ -2033,7 +2022,6 @@ Component({
20332022
},
20342023
chooseSpeed(e) {
20352024
const speed = e.currentTarget.dataset.speed;
2036-
console.log("choose speed", speed);
20372025
const audioContext = this.data.audioContext;
20382026
audioContext.showSpeedList = !this.data.audioContext.showSpeedList;
20392027
audioContext.currentSpeed = Number(speed);
@@ -2081,7 +2069,6 @@ Component({
20812069
});
20822070
return;
20832071
}
2084-
console.log("touchMove");
20852072
if (!this.data.longPressTriggered) return;
20862073
const { clientY } = e.touches[0];
20872074
const deltaY = clientY - this.data.startY;
@@ -2147,7 +2134,6 @@ Component({
21472134
},
21482135
startRecord() {
21492136
console.log("startRecord sendStatus", this.data.sendStatus);
2150-
console.log("recorderManager", this.data.recorderManager);
21512137
if (this.data.recorderManager && this.data.sendStatus === 1) {
21522138
console.log("开始录音");
21532139
this.data.recorderManager.start(this.data.recordOptions);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
padding: 0rpx !important;
108108
width: 64rpx !important;
109109
height: 64rpx;
110+
border: none !important;
110111
}
111112

112113
.avatar {

apps/miniprogram-agent-ui/miniprogram/components/toolCard/business-list/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,10 @@ Component({
4343
const { name, toolData } = this.data;
4444
// 将详细的结构化地址转换为经纬度坐标
4545
if (name === "placeSearchNearby") {
46-
console.log("toolData", toolData);
4746
const { content } = toolData;
4847
if (content[0].type === "text") {
4948
const contentData = JSON.parse(content[0].text);
5049
const { data } = contentData;
51-
console.log("placeSearchNearby data", data);
5250
this.setData({
5351
restaurants: data.map((item, index) => ({
5452
// ...item,

apps/miniprogram-agent-ui/miniprogram/components/toolCard/food-list/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ Component({
4141
methods: {
4242
// 添加点击事件处理函数
4343
onFoodItemTap: function (e) {
44-
console.log("tofood e", e);
4544
const foodId = e.currentTarget.dataset.id;
4645
const foodItem = this.data.foodList.find((item) => item.id === foodId);
4746

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,9 @@ Component({
3939
const { name, toolData } = this.data;
4040
// 将详细的结构化地址转换为经纬度坐标
4141
if (name === "geocoder") {
42-
console.log("toolData", toolData);
4342
const { content } = toolData;
4443
if (content[0].type === "text") {
4544
const contentData = JSON.parse(content[0].text);
46-
console.log("geocoder data", contentData);
4745
const {
4846
result: {
4947
location: { lat, lng },
@@ -72,7 +70,6 @@ Component({
7270
const { location } = this.data.toolParams;
7371
const locationInfo = location.split(",");
7472
const contentData = JSON.parse(content[0].text);
75-
console.log("placeSearchNearby data", contentData);
7673
const { data } = contentData;
7774
this.setData({
7875
latitude: locationInfo[0],
@@ -91,14 +88,12 @@ Component({
9188
}
9289
// 路线规划
9390
if (name === "directionDriving") {
94-
console.log("toolData", toolData);
9591
const { content } = toolData;
9692
if (content[0].type === "text") {
9793
const { from, to } = this.data.toolParams;
9894
const fromInfo = from.split(",");
9995
const toInfo = to.split(",");
10096
const contentData = JSON.parse(content[0].text);
101-
console.log("directionDriving data", contentData);
10297
const {
10398
result: { routes },
10499
} = contentData;
@@ -107,7 +102,6 @@ Component({
107102
const firstRoute = routes[0];
108103
const { polyline, steps } = firstRoute; //TODO: 需解压转化为经纬度坐标对数组
109104
const transformPolyline = this.transformRawPolyline(polyline);
110-
console.log("transformPolyline", transformPolyline);
111105
const startAndEndPair = [
112106
{
113107
id: 1,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,12 @@ Component({
3434
// 根据 name 区分处理不同 tool 调用情况
3535
const { name, toolData } = this.data;
3636
if (name === "weather") {
37-
console.log("toolData", toolData);
3837
const { content } = toolData;
3938
if (content[0].type === "text") {
4039
const contentData = JSON.parse(content[0].text);
4140
const {
4241
result: { forecast },
4342
} = contentData;
44-
console.log("forecast", forecast);
4543
const isDay = this.checkIsDay();
4644
if (forecast.length) {
4745
const todayForecast = forecast[0];
@@ -118,11 +116,13 @@ Component({
118116
: "rainy",
119117
: "snowy",
120118
雷阵雨: "thunderstorm",
119+
阵雨: "rainy",
121120
大雨: "rainy",
122121
中雨: "rainy",
123122
小雨: "rainy",
124123
晴间多云: "sunnyovercast",
125124
};
125+
126126
return weatherMap[weather] || "sunny";
127127
},
128128
},

apps/miniprogram-agent-ui/miniprogram/components/toolCard/weather/index.wxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<view class="temp-container">
44
<!-- <view class="temp-circle {{isDay ? 'day-circle' : 'night-circle'}}"></view> -->
55
<view style="display: flex;align-items: center;flex-direction: row;">
6-
<image class="temp-circle" src="{{'./assets/' + (isDay ? today.dayweatherIcon : today.nightweatherIcon) + '.svg'}}" mode="aspectFit"></image>
6+
<image wx:if="{{today.dayweatherIcon}}" class="temp-circle" src="{{'./assets/' + (isDay ? today.dayweatherIcon : today.nightweatherIcon) + '.svg'}}" mode="aspectFit"></image>
77
<text class="high-low-text">{{isDay ? today.dayweather : today.nightweather}}</text>
88
</view>
99
</view>

0 commit comments

Comments
 (0)