Merge remote-tracking branch 'origin/main'

This commit is contained in:
liqiang-fit2cloud 2024-01-31 16:58:14 +08:00
commit f8d5fd6e49
3 changed files with 40 additions and 39 deletions

View File

@ -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",

View File

@ -211,7 +211,7 @@ const prologueList = computed(() => {
const temp = props.data?.prologue const temp = props.data?.prologue
let arr: any = [] let arr: any = []
const lines = temp?.split('\n') const lines = temp?.split('\n')
lines.forEach((str: string, index: number) => { lines?.forEach((str: string, index: number) => {
if (isMdArray(str)) { if (isMdArray(str)) {
arr[index] = { arr[index] = {
type: 'question', type: 'question',
@ -292,7 +292,8 @@ function getChartOpenId() {
chatMessage() chatMessage()
}) })
.catch((res) => { .catch((res) => {
if (res.response.status === 401) { console.log(res)
if (res.response.status === 403) {
application.asyncAppAuthentication(accessToken).then(() => { application.asyncAppAuthentication(accessToken).then(() => {
getChartOpenId() getChartOpenId()
}) })
@ -405,16 +406,22 @@ function chatMessage() {
record_id: '', record_id: '',
vote_status: '-1' vote_status: '-1'
}) })
//
applicationApi
.postChatMessage(chartOpenId.value, problem_text)
.then((response) => {
console.log(response.status)
if (response.status === 401) {
application.asyncAppAuthentication(accessToken).then(() => {
chatMessage()
})
} else {
chatList.value.push(chat) chatList.value.push(chat)
inputValue.value = '' inputValue.value = ''
nextTick(() => { nextTick(() => {
// //
scrollDiv.value.setScrollTop(Number.MAX_SAFE_INTEGER) scrollDiv.value.setScrollTop(Number.MAX_SAFE_INTEGER)
}) })
//
applicationApi
.postChatMessage(chartOpenId.value, problem_text)
.then((response) => {
ChatManagement.addChatRecord(chat, 50, loading) ChatManagement.addChatRecord(chat, 50, loading)
ChatManagement.write(chat.id) ChatManagement.write(chat.id)
const reader = response.body.getReader() const reader = response.body.getReader()
@ -425,6 +432,7 @@ function chatMessage() {
response.headers.get('Content-Type') !== 'application/json' response.headers.get('Content-Type') !== 'application/json'
) )
return reader.read().then(write) return reader.read().then(write)
}
}) })
.then(() => { .then(() => {
return !props.appId && getSourceDetail(chat) return !props.appId && getSourceDetail(chat)

View File

@ -2,15 +2,8 @@
<div class="login-warp flex-center"> <div class="login-warp flex-center">
<div class="login-container w-full h-full"> <div class="login-container w-full h-full">
<el-row class="container w-full h-full"> <el-row class="container w-full h-full">
<el-col <!-- v-if="screenWidth && screenWidth >= 990" -->
:xs="0" <el-col :xs="0" :sm="0" :md="10" :lg="10" :xl="10" class="left-container">
:sm="0"
:md="10"
:lg="10"
:xl="10"
class="left-container"
v-if="screenWidth && screenWidth >= 990"
>
<div class="login-image"></div> <div class="login-image"></div>
</el-col> </el-col>
<el-col :xs="24" :sm="24" :md="14" :lg="14" :xl="14" class="right-container flex-center"> <el-col :xs="24" :sm="24" :md="14" :lg="14" :xl="14" class="right-container flex-center">
@ -21,18 +14,18 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue' // import { ref, onMounted } from 'vue'
import type { Ref } from 'vue' // import type { Ref } from 'vue'
defineOptions({ name: 'LoginLayout' }) defineOptions({ name: 'LoginLayout' })
const screenWidth: Ref<number | null> = ref(null) // const screenWidth: Ref<number | null> = ref(null)
onMounted(() => { // onMounted(() => {
screenWidth.value = document.body.clientWidth // screenWidth.value = document.body.clientWidth
window.onresize = () => { // window.onresize = () => {
return (() => { // return (() => {
screenWidth.value = document.body.clientWidth // screenWidth.value = document.body.clientWidth
})() // })()
} // }
}) // })
</script> </script>
<style lang="scss" scope> <style lang="scss" scope>
.login-warp { .login-warp {