Skip to content

Commit c1870b4

Browse files
authored
Merge pull request #20 from TencentCloudBase/feat--support-db-query
feat: 支持数据模型检索
2 parents d1c424f + be5ed84 commit c1870b4

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,7 @@ Component({
762762
knowledge_meta,
763763
knowledge_base,
764764
finish_reason,
765+
search_results
765766
} = dataJson;
766767
const newValue = [...this.data.chatRecords];
767768
// 取最后一条消息更新
@@ -831,6 +832,14 @@ Component({
831832
chatStatus: 2,
832833
});
833834
}
835+
// 数据库,只更新一次
836+
if(type === "db" && !lastValue.db_len) {
837+
lastValue.db_len = search_results.relateTables || 0
838+
this.setData({
839+
[`chatRecords[${lastValueIndex}].db_len`]: lastValue.db_len,
840+
chatStatus: 2,
841+
})
842+
}
834843
} catch (e) {
835844
// console.log('err', event, e)
836845
break;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
</view>
3131
</block>
3232
<block wx:else>
33+
<!-- 数据库检索 -->
34+
<view wx:if="{{item.db_len}}" style="border-radius: 8px;margin-bottom: 12px;background-color: #f5f5f5;padding: 18rpx 26rpx;display: inline-block;opacity: 0.7;font-size: 14px;">
35+
已匹配 {{item.db_len}} 张数据表
36+
</view>
3337
<!-- 联网搜索 -->
3438
<FoldedCard wx:if="{{item.search_info}}" initStatus="{{false}}" showBgColor="{{true}}">
3539
<view slot="title" style="opacity: 0.7;font-size: 14px;display: flex; align-items: center; gap: 8px;">

0 commit comments

Comments
 (0)