Feat(云灵AI):对话接口对接完成

This commit is contained in:
lifizer
2025-04-06 00:05:03 +08:00
parent 30f550ca92
commit 50ff88e7df
9 changed files with 505 additions and 55 deletions
+41 -20
View File
@@ -5,15 +5,6 @@
}"
class="fix-page-bottom"
>
<view v-if="startTaskFlag" class="music-wrap">
<view class="item one" />
<view class="item two" />
<view class="item three" />
<view class="item four" />
<view class="item five" />
<view class="item six" />
<view class="item seven" />
</view>
<view v-if="inputModel === 'input'" class="bottom-body flex-center-between">
<view class="history-wrap" @click="historyViewHandle">
历史
@@ -60,15 +51,44 @@
<view
v-if="inputModel === 'sound'"
class="sound-input-wrap"
@touchstart="startRecord"
@touchend="stopRecord"
>
<image
:src="webUrl + '/icon-20.png'"
class="icon"
mode="widthFix"
/>
按住说话
<view class="toggle-btn">
<image
:src="webUrl + '/aiChat/icon-06.png'"
class="input-icon"
mode="widthFix"
@click="toggleInputModel"
/>
</view>
<view
class="sound-wrap"
@touchstart="startRecord"
@touchend="stopRecord"
>
<view v-if="startTaskFlag" class="music-wrap">
<view class="item one" />
<view class="item two" />
<view class="item three" />
<view class="item four" />
<view class="item five" />
<view class="item six" />
<view class="item seven" />
</view>
<image
:src="webUrl + '/aiChat/microphone-big.png'"
class="icon"
mode="widthFix"
/>
<view v-if="startTaskFlag" class="music-wrap music-wrap2">
<view class="item one" />
<view class="item two" />
<view class="item three" />
<view class="item four" />
<view class="item five" />
<view class="item six" />
<view class="item seven" />
</view>
</view>
</view>
</view>
</template>
@@ -199,10 +219,9 @@ export default {
_this.taskId = ''
_this.clearIntervalFn()
uni.uploadFile({
url: `${VUE_APP_API_URL + settings.sysPrefix}/common/file/local/upload`,
url: `${VUE_APP_API_URL}/api/upload`,
filePath: tempFilePath,
header: {
'client-id': 'app',
Authorization: 'Bearer ' + (_this.token || '')
},
name: 'file',
@@ -220,8 +239,10 @@ export default {
},
renderTransTask(uploadRes) {
const _this = this
const file = JSON.parse(uploadRes.data).link || ''
if (!file) return
makeFileTransTask({
file: `${VUE_APP_API_URL + settings.sysPrefix}` + JSON.parse(uploadRes.data).data.fileUrl
file
}).then(taskRes => {
_this.taskId = taskRes.data
_this.getTransResultReq()
+59 -2
View File
@@ -16,9 +16,11 @@
<view class="title">
<view class="txt">30天内</view>
<image
v-if="list.length > 0"
:src="webUrl + '/aiChat/delete.png'"
class="icon"
mode="widthFix"
@click="deleteRecords(2)"
/>
</view>
<view class="list-cont">
@@ -26,6 +28,31 @@
v-for="(item, index) in list"
:key="index"
class="item"
@click="historyItemClick(item)"
>
<view class="item-txt one-t">
{{ item.title }}
</view>
</view>
</view>
</view>
<view class="history-type">
<view class="title">
<view class="txt">超过30天</view>
<image
v-if="moreList.length > 0"
:src="webUrl + '/aiChat/delete.png'"
class="icon"
mode="widthFix"
@click="deleteRecords(3)"
/>
</view>
<view class="list-cont">
<view
v-for="(item, index) in moreList"
:key="index"
class="item"
@click="historyItemClick(item)"
>
<view class="item-txt one-t">
{{ item.title }}
@@ -39,7 +66,8 @@
<script>
import {
getChatList
getChatList,
deleteChatListByType
} from '@/api/chat/index'
export default {
name: 'AiHistoryList',
@@ -47,6 +75,11 @@ export default {
statusBarHeight: {
type: Number,
default: 0
},
// 来源模块:''-首页,'history'-历史记录
formModule: {
type: String,
default: ''
}
},
data() {
@@ -60,14 +93,38 @@ export default {
methods: {
showView() {
this.showLayer = true
this.getChatListReq()
},
getChatListReq() {
getChatList().then(res => {
const { success, data } = res
if (success) {
this.list = data['今天']
this.list = data['30天内']
this.moreList = data['超过30天']
}
})
},
deleteRecords(type) {
deleteChatListByType(type).then(res => {
const { success } = res
if (success) {
this.getChatListReq()
}
})
},
historyItemClick(item) {
const paramsStr = `?chatNumber=${item.chatNumber}&title=${item.title}`
if (!this.formModule) {
uni.navigateTo({
url: '/aiChat/views/history' + paramsStr
})
} else {
uni.redirectTo({
url: '/aiChat/views/history' + paramsStr
})
}
this.closeLayer()
},
closeLayer() {
this.showLayer = false
}