From 189b9fe059eb58a2b30fad71e280d5e65b85c850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E9=9D=99=E8=BF=9C?= <837317210@qq.com> Date: Wed, 21 May 2025 21:57:54 +0800 Subject: [PATCH 1/6] fix: fix error handle logic --- .../miniprogram/components/agent-ui/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.js b/apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.js index 8f41dec..e027ffa 100644 --- a/apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.js +++ b/apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.js @@ -1416,7 +1416,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 = []; From 5bb2958578d498d3095b4c848d3b04f8e5b77816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E9=9D=99=E8=BF=9C?= <837317210@qq.com> Date: Thu, 29 May 2025 09:39:05 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dagent-ui=20?= =?UTF-8?q?=E8=81=94=E7=BD=91=E6=9F=A5=E8=AF=A2=E6=97=A0=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../miniprogram/components/agent-ui/index.wxml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.wxml b/apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.wxml index ee6f1cd..d0eadc5 100644 --- a/apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.wxml +++ b/apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.wxml @@ -86,7 +86,7 @@ 已匹配 {{item.db_len}} 张数据表 - + 已参考 {{item.search_info.search_results.length}} 个网页 From 26e7d47aef38a1d59aec7b729e2844995e947d96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E9=9D=99=E8=BF=9C?= <837317210@qq.com> Date: Thu, 29 May 2025 11:36:46 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E8=BE=93=E5=87=BA?= =?UTF-8?q?token=E8=B6=85=E9=99=90=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../miniprogram/components/agent-ui/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.js b/apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.js index e027ffa..09d3ad1 100644 --- a/apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.js +++ b/apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.js @@ -1408,6 +1408,7 @@ Component({ finish_reason, search_results, error, + usage, } = dataJson; const newValue = [...this.data.chatRecords]; // 取最后一条消息更新 @@ -1569,6 +1570,16 @@ Component({ } } } + // 超出token数限制 + if (type === "finish" && finish_reason === "length") { + const completionTokens = usage?.completion_tokens || 0; + lastValue.error = completionTokens + ? `当前输出token长度为 ${completionTokens},已超过最大限制,请重新提问` + : "已超过最大限制,请重新提问"; + this.setData({ + [`chatRecords[${lastValueIndex}].error`]: lastValue.error, + }); + } } catch (e) { console.log("err", event, e); break; From 20d40bbf5a6399c7866cd67e695ca0e5c5a7584e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E9=9D=99=E8=BF=9C?= <837317210@qq.com> Date: Thu, 29 May 2025 16:09:44 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dtoken=E6=95=B0?= =?UTF-8?q?=E8=B6=85=E9=99=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../miniprogram/components/agent-ui/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.js b/apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.js index 09d3ad1..ad2d698 100644 --- a/apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.js +++ b/apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.js @@ -1572,7 +1572,7 @@ Component({ } // 超出token数限制 if (type === "finish" && finish_reason === "length") { - const completionTokens = usage?.completion_tokens || 0; + const completionTokens = usage?.completionTokens || 0; lastValue.error = completionTokens ? `当前输出token长度为 ${completionTokens},已超过最大限制,请重新提问` : "已超过最大限制,请重新提问"; From 876df2df22dded75ff0fbc4b0803b3997be423f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E9=9D=99=E8=BF=9C?= <837317210@qq.com> Date: Thu, 29 May 2025 16:14:20 +0800 Subject: [PATCH 5/6] chore: sync agent-ui component before release --- components/agent-ui/index.js | 13 ++++++++++++- components/agent-ui/index.wxml | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/components/agent-ui/index.js b/components/agent-ui/index.js index 8f41dec..ad2d698 100644 --- a/components/agent-ui/index.js +++ b/components/agent-ui/index.js @@ -1408,6 +1408,7 @@ Component({ finish_reason, search_results, error, + usage, } = dataJson; const newValue = [...this.data.chatRecords]; // 取最后一条消息更新 @@ -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 = []; @@ -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; diff --git a/components/agent-ui/index.wxml b/components/agent-ui/index.wxml index ee6f1cd..d0eadc5 100644 --- a/components/agent-ui/index.wxml +++ b/components/agent-ui/index.wxml @@ -86,7 +86,7 @@ 已匹配 {{item.db_len}} 张数据表 - + 已参考 {{item.search_info.search_results.length}} 个网页 From 280e00651bebb92d73fd50cb061eb0fa9de11a60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E9=9D=99=E8=BF=9C?= <837317210@qq.com> Date: Thu, 29 May 2025 16:14:30 +0800 Subject: [PATCH 6/6] chore(release): 1.13.2 --- CHANGELOG.md | 10 ++++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78fe94e..b6d9343 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/package-lock.json b/package-lock.json index 74fa285..fb8e9cc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cloudbase-agent-ui", - "version": "1.13.1", + "version": "1.13.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cloudbase-agent-ui", - "version": "1.13.1", + "version": "1.13.2", "license": "MIT", "dependencies": { "standard-version": "^9.5.0" diff --git a/package.json b/package.json index b20cf6b..cc4ca35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cloudbase-agent-ui", - "version": "1.13.1", + "version": "1.13.2", "description": "微信小程序 Agent UI组件", "main": "index.js", "directories": {