|
@@ -1,7 +1,7 @@
|
|
<template>
|
|
<template>
|
|
<div class="home_box">
|
|
<div class="home_box">
|
|
<div class="left_box">
|
|
<div class="left_box">
|
|
- <button>
|
|
|
|
|
|
+ <button @click="startNewSessionHandle">
|
|
<span class="icon"></span>
|
|
<span class="icon"></span>
|
|
<span>开启新对话</span>
|
|
<span>开启新对话</span>
|
|
</button>
|
|
</button>
|
|
@@ -68,7 +68,10 @@
|
|
</div>
|
|
</div>
|
|
<div class="right_box">
|
|
<div class="right_box">
|
|
<div class="chat-container">
|
|
<div class="chat-container">
|
|
- <div class="messages-container" ref="msgContainer">
|
|
|
|
|
|
+ <div v-if="historys.length === 0" class="messages-container">
|
|
|
|
+ <p class="n_tips">Hi~,我是自然资源大模型,您身边的智能助手!</p>
|
|
|
|
+ </div>
|
|
|
|
+ <div v-else class="messages-container" ref="msgContainer">
|
|
<template v-for="(history,index) in historys" :key="index">
|
|
<template v-for="(history,index) in historys" :key="index">
|
|
<div class="message user">
|
|
<div class="message user">
|
|
{{ history.question }}
|
|
{{ history.question }}
|
|
@@ -469,6 +472,13 @@ function scrollToBottom() {
|
|
const historys = ref([])
|
|
const historys = ref([])
|
|
let historyIndex = -1;
|
|
let historyIndex = -1;
|
|
const cQuestion = ref('')
|
|
const cQuestion = ref('')
|
|
|
|
+
|
|
|
|
+const startNewSessionHandle = () => {
|
|
|
|
+ cQuestion.value = ''
|
|
|
|
+ historys.value = []
|
|
|
|
+ historyIndex = -1
|
|
|
|
+}
|
|
|
|
+
|
|
const onKeydownHandle = (e) => {
|
|
const onKeydownHandle = (e) => {
|
|
if (e.key === 'Enter' && !e.shiftKey) {
|
|
if (e.key === 'Enter' && !e.shiftKey) {
|
|
e.preventDefault();
|
|
e.preventDefault();
|
|
@@ -534,7 +544,7 @@ watch(props.searchType, (val) => {
|
|
const question = ref('国有土地的使用方式有哪些?');
|
|
const question = ref('国有土地的使用方式有哪些?');
|
|
const statusText = ref('检索中');
|
|
const statusText = ref('检索中');
|
|
const activeIndex = ref(0);
|
|
const activeIndex = ref(0);
|
|
-const activeTab = ref(props.searchType);
|
|
|
|
|
|
+const activeTab = ref('knowledge');
|
|
let ctr = null;
|
|
let ctr = null;
|
|
|
|
|
|
const evaluate = ref(null);
|
|
const evaluate = ref(null);
|
|
@@ -797,7 +807,8 @@ const quest = async (isFllow) => {
|
|
activeIndex.value = 5;
|
|
activeIndex.value = 5;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- onerror(err) {
|
|
|
|
|
|
+ onerror (err) {
|
|
|
|
+ historys.value[historyIndex].currentResponse.loading = false
|
|
throw err;
|
|
throw err;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -1314,6 +1325,12 @@ defineExpose({ changeActiveTab, stopAI });
|
|
.home_box {
|
|
.home_box {
|
|
height: 100%;
|
|
height: 100%;
|
|
display: flex;
|
|
display: flex;
|
|
|
|
+ .n_tips {
|
|
|
|
+ font-size: 20px;
|
|
|
|
+ text-align: center;
|
|
|
|
+ padding-top: 50px;
|
|
|
|
+ color: rgba(0,0,0,0.8);
|
|
|
|
+ }
|
|
>div {
|
|
>div {
|
|
height: 100%;
|
|
height: 100%;
|
|
&.left_box {
|
|
&.left_box {
|
|
@@ -1329,6 +1346,7 @@ defineExpose({ changeActiveTab, stopAI });
|
|
color: #3A81EF;
|
|
color: #3A81EF;
|
|
padding: 10px;
|
|
padding: 10px;
|
|
margin-bottom: 10px;
|
|
margin-bottom: 10px;
|
|
|
|
+ cursor: pointer;
|
|
}
|
|
}
|
|
>div {
|
|
>div {
|
|
>.menu_down {
|
|
>.menu_down {
|
|
@@ -1423,7 +1441,7 @@ defineExpose({ changeActiveTab, stopAI });
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
gap: 12px;
|
|
gap: 12px;
|
|
flex: 1;
|
|
flex: 1;
|
|
- padding: 15px 0px;
|
|
|
|
|
|
+ padding: 30px 0px;
|
|
}
|
|
}
|
|
|
|
|
|
.message {
|
|
.message {
|