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

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

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