feat: 对接了会话的接口与会话交互

This commit is contained in:
2025-07-22 00:08:36 +08:00
parent c75448e558
commit e6b9407e69
6 changed files with 219 additions and 29 deletions

View File

@@ -6,6 +6,8 @@
<button @click="closeDrawer" type="default">关闭</button>
<button @click="login" type="default">登录</button>
<button @click="sendChat" type="default">会话测试</button>
<view class="drawer-list">
<view v-for="(item,index) in 100" :key="index">
<text class="message-item">{{item}}</text>
@@ -20,6 +22,9 @@
const emits = defineEmits(['closeDrawer'])
import * as loginMnager from '@/manager/LoginManager'
import { getAgentChatMessage } from '@/request/api/AgentChatApi.js'
import request from '../../request/base/request'
const closeDrawer = () => {
emits('closeDrawer')
console.log('=============关闭抽屉')
@@ -37,7 +42,26 @@
})
console.log('=============登录')
// 这里可以处理登录逻辑,比如调用登录接口等
}
}
const sendChat = () => {
console.log('=============会话测试')
const args = {
"conversationId":"1931957498711957505",
"agentId":"1",
"messageType": 0,
"messageContent":"酒店一共有哪些温泉?"
}
request.getAIChatStream(args, (chunk) => {
// 每收到一段数据都会回调
console.log('分段内容:', chunk)
// 你可以在这里追加到消息列表
})
}
</script>