提交 e8967b9b 编写于 作者: View Design's avatar View Design

Merge branch 'main' of gitcode.com:git_bot/ai-fe

......@@ -22,11 +22,10 @@
/>
<UDivider class="pt-3 pb-2" />
</template>
<div class="grid" v-if="data.length > 0">
<div class="grid" v-if="data.length > 0 && askingData.question">
<h2 class="text-3xl" :id="data.length + 1">{{ askingData.question }}</h2>
</div>
<ISearchContent
v-show="askingData.question"
:item="askingData"
:asking="asking"
ref="askingRef"
......@@ -71,9 +70,8 @@ function initSearchItemInfo (info) {
}
function initSearchRecords (records) {
data.value = records.map(item => {
let { answer, actions } = item
const historyItem = { article: answer, desLoading: false, searchLoading: false, ansLoading: false }
// console.log(`actions:`, typeof actions)
let { answer, actions, question } = item
const historyItem = { article: answer, question, desLoading: false, searchLoading: false, ansLoading: false}
// todo ?action为啥成了string?
actions = typeof actions === 'string' ? JSON.parse(actions) : actions
// console.log(actions)
......@@ -142,7 +140,9 @@ const handleCloseHistoryAsk = () => {
})
}
const createGenerateInitItem = (question) => {
data.value.push(askingData.value)
if (askingData.value.question) {
data.value.push(askingData.value)
}
nextTick(() => {
handleCloseHistoryAsk()
askingData.value = { question, desLoading: true }
......@@ -151,8 +151,10 @@ const createGenerateInitItem = (question) => {
const handleContinueAsk = (question) => {
if (asking.value) return
asking.value = true
askingRef.value.handleCollapse(true)
createGenerateInitItem(question)
nextTick(() => {
askingRef.value && askingRef.value.handleCollapse(true)
})
generateFetchData(question)
setTimeout(() => {
scrollToView()
......@@ -281,8 +283,6 @@ useHead({
onMounted( () => {
if (data.value.length === 0 && state.query) {
generateFetchData(state.query)
} else {
}
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册