Commit 48611576 authored by tyyin lan's avatar tyyin lan

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

parent ded9373a
...@@ -5,6 +5,7 @@ import { useI18n } from 'vue-i18n' ...@@ -5,6 +5,7 @@ import { useI18n } from 'vue-i18n'
interface Props { interface Props {
currentFetchEventSourceController: AbortController | null currentFetchEventSourceController: AbortController | null
currentSessionId: string
} }
interface SessionHistoryRecordItem { interface SessionHistoryRecordItem {
...@@ -125,6 +126,8 @@ function onHistoryRecordListUpdate() { ...@@ -125,6 +126,8 @@ function onHistoryRecordListUpdate() {
} }
function handleRecordItemApply(dialogsId: string) { function handleRecordItemApply(dialogsId: string) {
if (props.currentSessionId === dialogsId) return ''
if (isAgentResponding.value) { if (isAgentResponding.value) {
window.$message.ctWarning(t('home_module.interrupt_the_conversation_and_apply_the_history_prompt')).then(() => { window.$message.ctWarning(t('home_module.interrupt_the_conversation_and_apply_the_history_prompt')).then(() => {
props.currentFetchEventSourceController && props.currentFetchEventSourceController.abort() props.currentFetchEventSourceController && props.currentFetchEventSourceController.abort()
...@@ -139,9 +142,11 @@ function handleRecordItemApply(dialogsId: string) { ...@@ -139,9 +142,11 @@ function handleRecordItemApply(dialogsId: string) {
}, 300) }, 300)
}) })
} else { } 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) emit('getMessageRecordList', dialogsId)
})
} }
} }
...@@ -169,7 +174,7 @@ defineExpose({ ...@@ -169,7 +174,7 @@ defineExpose({
</h2> </h2>
</div> --> </div> -->
<div class="px-[10px]"> <div class="px-[4px]">
<div class="h-[40px]"> <div class="h-[40px]">
<Transition name="history-record-edit" mode="out-in"> <Transition name="history-record-edit" mode="out-in">
<h2 v-if="!isHistoryListEdit" class="flex items-center justify-between"> <h2 v-if="!isHistoryListEdit" class="flex items-center justify-between">
...@@ -215,11 +220,16 @@ defineExpose({ ...@@ -215,11 +220,16 @@ defineExpose({
<Transition name="history-record-edit" mode="out-in"> <Transition name="history-record-edit" mode="out-in">
<li <li
v-if="!isHistoryListEdit" 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)" @click="handleRecordItemApply(recordItem.dialogsId)"
> >
<i <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> ></i>
<span class="flex-1 truncate text-[14px]">{{ recordItem.content }}</span> <span class="flex-1 truncate text-[14px]">{{ recordItem.content }}</span>
</li> </li>
......
...@@ -233,6 +233,7 @@ function onGetMessageRecordList(recordId: string) { ...@@ -233,6 +233,7 @@ function onGetMessageRecordList(recordId: string) {
v-model="isShowHistoryMenu" v-model="isShowHistoryMenu"
v-model:is-agent-responding="isAgentResponding" v-model:is-agent-responding="isAgentResponding"
:current-fetch-event-source-controller="currentFetchEventSourceController" :current-fetch-event-source-controller="currentFetchEventSourceController"
:current-session-id="currentSessionId"
@get-message-record-list="onGetMessageRecordList" @get-message-record-list="onGetMessageRecordList"
@create-new-session="onCreateNewSession" @create-new-session="onCreateNewSession"
@history-record-list-update="onHistoryRecordListUpdate" @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