improve: chat list order during chat

This commit is contained in:
ulleo
2026-08-24 14:53:56 +08:00
committed by ulleo
parent ed19e8997e
commit 8a1845aaf4
3 changed files with 23 additions and 2 deletions
@@ -1,6 +1,6 @@
<script setup lang="ts">
import BaseAnswer from './BaseAnswer.vue'
import { chatApi, ChatInfo, type ChatMessage, ChatRecord } from '@/api/chat.ts'
import { Chat, chatApi, ChatInfo, type ChatMessage, ChatRecord } from '@/api/chat.ts'
import { computed, nextTick, onBeforeUnmount, ref } from 'vue'
import MdComponent from '@/views/chat/component/MdComponent.vue'
const props = withDefaults(
@@ -95,6 +95,13 @@ const sendMessage = async () => {
if (error) return
try {
_currentChat.value.latest_record_time = new Date()
_chatList.value.forEach((c: Chat) => {
if (c.id === _currentChat.value.id) {
c.latest_record_time = _currentChat.value.latest_record_time
}
})
const controller: AbortController = new AbortController()
const response = await chatApi.analysis(currentRecord.analysis_record_id, controller)
const reader = response.body.getReader()
@@ -102,6 +102,13 @@ const sendMessage = async () => {
if (error) return
try {
_currentChat.value.latest_record_time = new Date()
_chatList.value.forEach((c: Chat) => {
if (c.id === _currentChat.value.id) {
c.latest_record_time = _currentChat.value.latest_record_time
}
})
const controller: AbortController = new AbortController()
const param = {
question: currentRecord.question,
@@ -1,6 +1,6 @@
<script setup lang="ts">
import BaseAnswer from './BaseAnswer.vue'
import { chatApi, ChatInfo, type ChatMessage, ChatRecord } from '@/api/chat.ts'
import { Chat, chatApi, ChatInfo, type ChatMessage, ChatRecord } from '@/api/chat.ts'
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
import MdComponent from '@/views/chat/component/MdComponent.vue'
import ChartBlock from '@/views/chat/chat-block/ChartBlock.vue'
@@ -100,6 +100,13 @@ const sendMessage = async () => {
if (error) return
try {
_currentChat.value.latest_record_time = new Date()
_chatList.value.forEach((c: Chat) => {
if (c.id === _currentChat.value.id) {
c.latest_record_time = _currentChat.value.latest_record_time
}
})
const controller: AbortController = new AbortController()
const response = await chatApi.predict(currentRecord.predict_record_id, controller)
const reader = response.body.getReader()