Commit 48611576 authored by tyyin lan's avatar tyyin lan

chore(首页): 历史记录应用优化

parent ded9373a
......@@ -5,6 +5,7 @@ import { useI18n } from 'vue-i18n'
interface Props {
currentFetchEventSourceController: AbortController | null
currentSessionId: string
}
interface SessionHistoryRecordItem {
......@@ -125,6 +126,8 @@ function onHistoryRecordListUpdate() {
}
function handleRecordItemApply(dialogsId: string) {
if (props.currentSessionId === dialogsId) return ''
if (isAgentResponding.value) {
window.$message.ctWarning(t('home_module.interrupt_the_conversation_and_apply_the_history_prompt')).then(() => {
props.currentFetchEventSourceController && props.currentFetchEventSourceController.abort()
......@@ -139,9 +142,11 @@ function handleRecordItemApply(dialogsId: string) {
}, 300)
})
} else {
window.$message.ctWarning(t('home_module.history_record_item_apply_tip'), t('common_module.tip')).then(() => {
// window.$message.ctWarning(t('home_module.history_record_item_apply_tip'), t('common_module.tip')).then(() => {
// emit('getMessageRecordList', dialogsId)
// })
emit('getMessageRecordList', dialogsId)
})
}
}
......@@ -169,7 +174,7 @@ defineExpose({
</h2>
</div> -->
<div class="px-[10px]">
<div class="px-[4px]">
<div class="h-[40px]">
<Transition name="history-record-edit" mode="out-in">
<h2 v-if="!isHistoryListEdit" class="flex items-center justify-between">
......@@ -215,11 +220,16 @@ defineExpose({
<Transition name="history-record-edit" mode="out-in">
<li
v-if="!isHistoryListEdit"
class="group mb-[20px] flex cursor-pointer items-center transition last:mb-0 hover:text-[#5D5D5D]"
class="group mb-[10px] flex cursor-pointer items-center rounded-[4px] px-[6px] py-[5px] transition last:mb-0"
:class="{
'hover:text-[#5D5D5D]': currentSessionId !== recordItem.dialogsId,
'bg-[#D7D9F8]': currentSessionId === recordItem.dialogsId,
}"
@click="handleRecordItemApply(recordItem.dialogsId)"
>
<i
class="iconfont icon-bubble mr-[5px] !text-[14px] text-[#010eff] transition group-hover:text-[#000BDE]"
class="iconfont icon-bubble mr-[5px] !text-[14px] text-[#010eff] transition"
:class="{ 'group-hover:text-[#000BDE]': currentSessionId !== recordItem.dialogsId }"
></i>
<span class="flex-1 truncate text-[14px]">{{ recordItem.content }}</span>
</li>
......
......@@ -233,6 +233,7 @@ function onGetMessageRecordList(recordId: string) {
v-model="isShowHistoryMenu"
v-model:is-agent-responding="isAgentResponding"
:current-fetch-event-source-controller="currentFetchEventSourceController"
:current-session-id="currentSessionId"
@get-message-record-list="onGetMessageRecordList"
@create-new-session="onCreateNewSession"
@history-record-list-update="onHistoryRecordListUpdate"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment