Skip to content
Merged

Dev #68

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

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.

### [1.13.2](https://github.com/TencentCloudBase/cloudbase-agent-ui/compare/v1.13.1...v1.13.2) (2025-05-29)


### Bug Fixes

* 添加输出token超限报错 ([26e7d47](https://github.com/TencentCloudBase/cloudbase-agent-ui/commit/26e7d47aef38a1d59aec7b729e2844995e947d96))
* 修复agent-ui 联网查询无结果展示问题 ([5bb2958](https://github.com/TencentCloudBase/cloudbase-agent-ui/commit/5bb2958578d498d3095b4c848d3b04f8e5b77816))
* 修复token数超限问题 ([20d40bb](https://github.com/TencentCloudBase/cloudbase-agent-ui/commit/20d40bbf5a6399c7866cd67e695ca0e5c5a7584e))
* fix error handle logic ([189b9fe](https://github.com/TencentCloudBase/cloudbase-agent-ui/commit/189b9fe059eb58a2b30fad71e280d5e65b85c850))

### [1.13.1](https://github.com/TencentCloudBase/cloudbase-agent-ui/compare/v1.13.0...v1.13.1) (2025-05-21)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1408,6 +1408,7 @@ Component({
finish_reason,
search_results,
error,
usage,
} = dataJson;
const newValue = [...this.data.chatRecords];
// 取最后一条消息更新
Expand All @@ -1416,7 +1417,7 @@ Component({
lastValue.role = role || "assistant";
lastValue.record_id = record_id;
// 优先处理错误,直接中断
if (finish_reason === "error" || finish_reason === "content_filter") {
if (finish_reason === "error" || finish_reason === "content_filter" || error) {
lastValue.search_info = null;
lastValue.reasoning_content = "";
lastValue.knowledge_meta = [];
Expand Down Expand Up @@ -1569,6 +1570,16 @@ Component({
}
}
}
// 超出token数限制
if (type === "finish" && finish_reason === "length") {
const completionTokens = usage?.completionTokens || 0;
lastValue.error = completionTokens
? `当前输出token长度为 ${completionTokens},已超过最大限制,请重新提问`
: "已超过最大限制,请重新提问";
this.setData({
[`chatRecords[${lastValueIndex}].error`]: lastValue.error,
});
}
} catch (e) {
console.log("err", event, e);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
已匹配 {{item.db_len}} 张数据表
</view>
<!-- 联网搜索 -->
<FoldedCard wx:if="{{item.search_info}}" initStatus="{{false}}" showBgColor="{{true}}">
<FoldedCard wx:if="{{item.search_info && item.search_info.search_results}}" initStatus="{{false}}" showBgColor="{{true}}">
<view slot="title" style="opacity: 0.7;font-size: 14px;display: flex; align-items: center; gap: 8px;">
<image src="./imgs/search.svg" mode="aspectFill" style="width: 36rpx;height: 36rpx;" />
<text>已参考 {{item.search_info.search_results.length}} 个网页</text>
Expand Down
13 changes: 12 additions & 1 deletion components/agent-ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1408,6 +1408,7 @@ Component({
finish_reason,
search_results,
error,
usage,
} = dataJson;
const newValue = [...this.data.chatRecords];
// 取最后一条消息更新
Expand All @@ -1416,7 +1417,7 @@ Component({
lastValue.role = role || "assistant";
lastValue.record_id = record_id;
// 优先处理错误,直接中断
if (finish_reason === "error" || finish_reason === "content_filter") {
if (finish_reason === "error" || finish_reason === "content_filter" || error) {
lastValue.search_info = null;
lastValue.reasoning_content = "";
lastValue.knowledge_meta = [];
Expand Down Expand Up @@ -1569,6 +1570,16 @@ Component({
}
}
}
// 超出token数限制
if (type === "finish" && finish_reason === "length") {
const completionTokens = usage?.completionTokens || 0;
lastValue.error = completionTokens
? `当前输出token长度为 ${completionTokens},已超过最大限制,请重新提问`
: "已超过最大限制,请重新提问";
this.setData({
[`chatRecords[${lastValueIndex}].error`]: lastValue.error,
});
}
} catch (e) {
console.log("err", event, e);
break;
Expand Down
2 changes: 1 addition & 1 deletion components/agent-ui/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
已匹配 {{item.db_len}} 张数据表
</view>
<!-- 联网搜索 -->
<FoldedCard wx:if="{{item.search_info}}" initStatus="{{false}}" showBgColor="{{true}}">
<FoldedCard wx:if="{{item.search_info && item.search_info.search_results}}" initStatus="{{false}}" showBgColor="{{true}}">
<view slot="title" style="opacity: 0.7;font-size: 14px;display: flex; align-items: center; gap: 8px;">
<image src="./imgs/search.svg" mode="aspectFill" style="width: 36rpx;height: 36rpx;" />
<text>已参考 {{item.search_info.search_results.length}} 个网页</text>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cloudbase-agent-ui",
"version": "1.13.1",
"version": "1.13.2",
"description": "微信小程序 Agent UI组件",
"main": "index.js",
"directories": {
Expand Down
Loading