小助理

This commit is contained in:
liuye
2024-07-12 17:59:43 +08:00
parent 41b36c7784
commit fc8720fc40
2 changed files with 50 additions and 20 deletions

View File

@@ -2,9 +2,9 @@
<div class="AppDialogue">
<u-navbar title="Copilot小助理" title-color="#000" title-width="300" title-size="32" :title-bold="true" :background="backgroundNavbar" :is-back="false" height="88"></u-navbar>
<!-- <scroll-view scroll-y="true" class="scroll-Y" @scroll="scroll"> -->
<!-- <div class="top-select" @click="showType=true">
{{typeList[type].dictName || '选择应用'}} <u-icon name="arrow-down" color="#fff" size="28"></u-icon>
</div> -->
<div class="top-select" @click="showType=true">
{{aiConfigName || '选择应用'}} <u-icon name="arrow-down" color="#fff" size="28"></u-icon>
</div>
<div class="service-content" v-if="!messageList.length">
<div class="text-content">
<div class="text-left">
@@ -118,13 +118,11 @@ export default {
pages: 2,
areaId: '',
statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
typeList: [
{dictValue: '1', dictName: '文本助理'},
{dictValue: '2', dictName: '日常助理'}
],
type: '',
typeList: [],
aiConfigId: '',
aiConfigName: '',
showType: false,
showPopup: true
showPopup: true,
}
},
computed: {
@@ -136,6 +134,7 @@ export default {
});
},
onShow() {
this.getAiTypeList()
this.getHistoryList()
},
onPullDownRefresh() {
@@ -218,7 +217,7 @@ export default {
return this.$u.toast("请先进行登录")
}
this.$loading()
this.$instance.post("/app/appaicopilotinfo/add", {content: this.content, appType: 0, areaId: this.areaId}).then(res => {
this.$instance.post("/app/appaicopilotinfo/add", {content: this.content, appType: 0, areaId: this.areaId, aiConfigId: this.aiConfigId}).then(res => {
if(res.code == 0) {
this.content = ''
this.messageList.push(res.data[0])
@@ -238,7 +237,7 @@ export default {
return this.$u.toast("请先进行登录")
}
this.$loading()
this.$instance.post("/app/appaicopilotinfo/add", {sdkFileUrl: this.voiceUrl, fileId: this.voiceId, appType: 0}).then(res => {
this.$instance.post("/app/appaicopilotinfo/add", {sdkFileUrl: this.voiceUrl, fileId: this.voiceId, appType: 0, aiConfigId: this.aiConfigId}).then(res => {
if(res.code == 0) {
this.voiceUrl = ''
this.voiceId = ''
@@ -262,7 +261,7 @@ export default {
return this.$u.toast("请先进行登录")
}
this.$loading()
this.$instance.post(`/app/appaicopilotinfo/list?current=${this.current}&size=10`).then(res => {
this.$instance.post(`/app/appaicopilotinfo/list?current=${this.current}&size=10&aiConfigId=${this.aiConfigId}`).then(res => {
if(res.code == 0 && res.data.records.length) {
res.data.records.map((item) => {
if(item.sdkFileUrl) {
@@ -322,8 +321,23 @@ export default {
}
},
confirmType(val) {
this.type = val[0].value;
this.aiConfigId = val[0].value
this.aiConfigName = val[0].label
},
getAiTypeList() {
this.$instance.post(`/app/appaiconfiginfo/list?status=1`).then(res => {
if(res.code == 0) {
res.data.records.map((item) => {
item.dictName = item.appName
item.dictValue = item.id
})
this.typeList = res.data.records
this.aiConfigId = this.typeList[0].dictValue
this.aiConfigName = this.typeList[0].dictName
this.getHistoryList()
}
})
}
},
}
</script>

View File

@@ -9,13 +9,13 @@
</div>
</div>
<div class="list-content">
<div class="item">
<p class="item-text">111111111111</p>
<div class="item" v-for="(item, index) in messageList" :key="index">
<p class="item-text">{{item.content}}</p>
<div class="time-flex">
<p class="time-text">2024-06-02 10:21:23</p>
<p class="time-text">{{item.createTime}}</p>
<div class="item-view">
<p>查看对话</p>
<div class="del-btn">
<p @click="toDetail(item)">查看对话</p>
<div class="del-btn" @click="del(item)">
<img src="./img/del-img.png" alt="">
</div>
</div>
@@ -56,7 +56,7 @@ export default {
...mapState(['user', 'token']),
},
onShow() {
//this.getHistoryList()
this.getHistoryList()
},
onPullDownRefresh() {
if(this.current > this.pages) {
@@ -72,7 +72,7 @@ export default {
return this.$u.toast("请先进行登录")
}
this.$loading()
this.$instance.post(`/app/appaicopilotinfo/list?current=${this.current}&size=10&content=${this.searchVal}`).then(res => {
this.$instance.post(`/app/appaicopilotinfo/listHistory?current=${this.current}&size=10&content=${this.searchVal}`).then(res => {
if(res.code == 0 && res.data.records.length) {
res.data.records.map((item) => {
if(item.sdkFileUrl) {
@@ -105,6 +105,22 @@ export default {
this.searchVal = ''
this.getSearchList()
},
toDetail(e) {
uni.navigateTo({url: `./Detail`})
},
del(e) {
this.$confirm('确定删除该数据?').then(() => {
uni.showLoading()
this.$instance.post(`/app/appresident/delete?ids=${e.id}`).then((res) => {
if (res.code == 0) {
this.$u.toast('删除成功!')
this.getSearchList()
}
uni.hideLoading()
})
}).catch(() => {
})
}
},
}
</script>