fix: 401问题
This commit is contained in:
parent
fac2065ec6
commit
8ede3e82a5
@ -14,7 +14,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
"element-plus": "^2.4.3",
|
"element-plus": "^2.5.3",
|
||||||
"install": "^0.13.0",
|
"install": "^0.13.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"markdown-it": "^13.0.2",
|
"markdown-it": "^13.0.2",
|
||||||
|
|||||||
@ -288,13 +288,12 @@ function getChartOpenId() {
|
|||||||
applicationApi
|
applicationApi
|
||||||
.getChatOpen(props.appId)
|
.getChatOpen(props.appId)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res)
|
|
||||||
chartOpenId.value = res.data
|
chartOpenId.value = res.data
|
||||||
chatMessage()
|
chatMessage()
|
||||||
})
|
})
|
||||||
.catch((res) => {
|
.catch((res) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if (res.code === 401 || res.response.status === 401) {
|
if (res.response.status === 403) {
|
||||||
application.asyncAppAuthentication(accessToken).then(() => {
|
application.asyncAppAuthentication(accessToken).then(() => {
|
||||||
getChartOpenId()
|
getChartOpenId()
|
||||||
})
|
})
|
||||||
@ -407,26 +406,33 @@ function chatMessage() {
|
|||||||
record_id: '',
|
record_id: '',
|
||||||
vote_status: '-1'
|
vote_status: '-1'
|
||||||
})
|
})
|
||||||
chatList.value.push(chat)
|
|
||||||
inputValue.value = ''
|
|
||||||
nextTick(() => {
|
|
||||||
// 将滚动条滚动到最下面
|
|
||||||
scrollDiv.value.setScrollTop(Number.MAX_SAFE_INTEGER)
|
|
||||||
})
|
|
||||||
// 对话
|
// 对话
|
||||||
applicationApi
|
applicationApi
|
||||||
.postChatMessage(chartOpenId.value, problem_text)
|
.postChatMessage(chartOpenId.value, problem_text)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
ChatManagement.addChatRecord(chat, 50, loading)
|
console.log(response.status)
|
||||||
ChatManagement.write(chat.id)
|
if (response.status === 401) {
|
||||||
const reader = response.body.getReader()
|
application.asyncAppAuthentication(accessToken).then(() => {
|
||||||
// 处理流数据
|
chatMessage()
|
||||||
const write = getWrite(
|
})
|
||||||
chat,
|
} else {
|
||||||
reader,
|
chatList.value.push(chat)
|
||||||
response.headers.get('Content-Type') !== 'application/json'
|
inputValue.value = ''
|
||||||
)
|
nextTick(() => {
|
||||||
return reader.read().then(write)
|
// 将滚动条滚动到最下面
|
||||||
|
scrollDiv.value.setScrollTop(Number.MAX_SAFE_INTEGER)
|
||||||
|
})
|
||||||
|
ChatManagement.addChatRecord(chat, 50, loading)
|
||||||
|
ChatManagement.write(chat.id)
|
||||||
|
const reader = response.body.getReader()
|
||||||
|
// 处理流数据
|
||||||
|
const write = getWrite(
|
||||||
|
chat,
|
||||||
|
reader,
|
||||||
|
response.headers.get('Content-Type') !== 'application/json'
|
||||||
|
)
|
||||||
|
return reader.read().then(write)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return !props.appId && getSourceDetail(chat)
|
return !props.appId && getSourceDetail(chat)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user