Skip to content
Merged

Dev #71

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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

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.14.0](https://github.com/TencentCloudBase/cloudbase-agent-ui/compare/v1.13.2...v1.14.0) (2025-06-11)


### Features

* 增加 react 组件 artifact 示例 ([a78c8d9](https://github.com/TencentCloudBase/cloudbase-agent-ui/commit/a78c8d93997a94371b837b4f5b5dd60de0ebf183))


### Bug Fixes

* 修复图片上传配置问题&函数型agent 语音播放按钮状态问题 ([74a584f](https://github.com/TencentCloudBase/cloudbase-agent-ui/commit/74a584f53ececefbfb4aadd420a3d372d26e4332))

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


Expand Down
17 changes: 14 additions & 3 deletions apps/miniprogram-agent-ui/miniprogram/components/agent-ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ Component({
data: {
botId: bot.botId,
msg: inputValue,
files: this.data.showUploadFile ? userRecord.fileList.map((item) => item.fileId) : undefined,
files: userRecord.fileList.length ? userRecord.fileList.map((item) => item.fileId) : undefined,
searchEnable: this.data.useWebSearch,
},
});
Expand All @@ -1359,7 +1359,7 @@ Component({
const sendReq = {
botId: bot.botId,
msg: inputValue,
files: this.data.showUploadFile ? userRecord.fileList.map((item) => item.fileId) : undefined,
files: userRecord.fileList.length ? userRecord.fileList.map((item) => item.fileId) : undefined,
searchEnable: this.data.useWebSearch,
};

Expand Down Expand Up @@ -1415,7 +1415,9 @@ Component({
const lastValueIndex = newValue.length - 1;
const lastValue = newValue[lastValueIndex];
lastValue.role = role || "assistant";
lastValue.record_id = record_id;
if (record_id) {
lastValue.record_id = record_id;
}
// 优先处理错误,直接中断
if (finish_reason === "error" || finish_reason === "content_filter" || error) {
lastValue.search_info = null;
Expand Down Expand Up @@ -1907,6 +1909,15 @@ Component({
},
handlePlayAudio: async function (e) {
console.log("handlePlayAudio e", e);
// 判断是否打开语音能力
if (!this.data.bot.voiceSettings?.enable) {
wx.showModal({
title: "提示",
content: "请前往腾讯云开发平台启用语音输入输出能力",
});
return;
}

const { recordid: botRecordId, content } = e.target.dataset;
const audioContext = this.data.audioContext;
if (audioContext.context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,24 +157,26 @@
<block wx:if="{{chatMode=== 'bot'}}">
<image mode="widthFix" bind:tap="openFeedback" data-feedbackType="upvote" data-feedbackRecordId="{{item.record_id}}" src='./imgs/thumb-up.svg' class="tool_btn" />
<image mode="widthFix" bind:tap="openFeedback" data-feedbackType="downvote" data-feedbackRecordId="{{item.record_id}}" src='./imgs/thumb-down.svg' class="tool_btn" />
<image wx:if="{{audioContext.recordId !== item.record_id || audioContext.playStatus === 0}}" mode="widthFix" bind:tap="handlePlayAudio" data-content="{{item.content}}" data-recordId="{{item.record_id}}" src='./imgs/sound.svg' class="tool_btn" />
<image wx:elif="{{audioContext.playStatus === 1}}" mode="widthFix" src='./imgs/loading.svg' class="tool_btn" />
<view wx:else class="playing_btn">
<image style="width: 36rpx;height: 36rpx;" mode="widthFix" bind:tap="handlePauseAudio" data-recordId="{{item.record_id}}" src='./imgs/pause.svg' />
<image style="width: 30rpx;height: 30rpx" src="./imgs/playing.svg" mode="widthFix"/>
<!-- 倍速切换按钮 -->
<view class="speed-switch" bindtap="toggleSpeedList" data-recordId="{{item.record_id}}">

<text class="speed-label">{{audioContext.currentSpeed || '1'}}</text>X
</view>
<!-- 倍速弹窗 -->
<view wx:if="{{audioContext.showSpeedList && audioContext.recordId === item.record_id}}" class="speed-popup">
<view wx:for="{{speedList}}" wx:key="item" class="speed-option" bindtap="chooseSpeed" data-speed="{{item}}" data-recordId="{{item.record_id}}">
<text>{{item}}X</text>
<image wx:if="{{audioContext.currentSpeed === item}}" src="./imgs/check.svg" style="width: 24rpx;height: 24rpx;margin-left:8rpx;" />
<block wx:if="{{item.record_id}}">
<image wx:if="{{audioContext.recordId !== item.record_id || audioContext.playStatus === 0}}" mode="widthFix" bind:tap="handlePlayAudio" data-content="{{item.content}}" data-recordId="{{item.record_id}}" src='./imgs/sound.svg' class="tool_btn" />
<image wx:elif="{{audioContext.playStatus === 1}}" mode="widthFix" src='./imgs/loading.svg' class="tool_btn" />
<view wx:else class="playing_btn">
<image style="width: 36rpx;height: 36rpx;" mode="widthFix" bind:tap="handlePauseAudio" data-recordId="{{item.record_id}}" src='./imgs/pause.svg' />
<image style="width: 30rpx;height: 30rpx" src="./imgs/playing.svg" mode="widthFix"/>
<!-- 倍速切换按钮 -->
<view class="speed-switch" bindtap="toggleSpeedList" data-recordId="{{item.record_id}}">

<text class="speed-label">{{audioContext.currentSpeed || '1'}}</text>X
</view>
</view>
</view>
<!-- 倍速弹窗 -->
<view wx:if="{{audioContext.showSpeedList && audioContext.recordId === item.record_id}}" class="speed-popup">
<view wx:for="{{speedList}}" wx:key="item" class="speed-option" bindtap="chooseSpeed" data-speed="{{item}}" data-recordId="{{item.record_id}}">
<text>{{item}}X</text>
<image wx:if="{{audioContext.currentSpeed === item}}" src="./imgs/check.svg" style="width: 24rpx;height: 24rpx;margin-left:8rpx;" />
</view>
</view>
</view>
</block>
</block>
</block>
</view>
Expand Down
3 changes: 2 additions & 1 deletion apps/react-agent-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
"preview": "vite preview"
},
"dependencies": {
"@cloudbase/agent-ui-react": "1.0.0-beta.4",
"@cloudbase/agent-ui-react": "1.0.0-beta.5",
"@cloudbase/js-sdk": "^2.13.0",
"@react-three/drei": "^9.88.6",
"@react-three/fiber": "^8.13.7",
"jszip": "^3.10.1",
"mermaid": "^11.6.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.152.2",
Expand Down
Loading
Loading