【解决todo】Chat message 增加刷新和编辑
This commit is contained in:
parent
f1beb488ce
commit
03c6a6ce59
@ -43,6 +43,12 @@
|
||||
<el-button class="btn-cus" link @click="onDelete(item.id)">
|
||||
<img class="btn-image" src="@/assets/ai/delete.svg" style="height: 17px;margin-right: 12px;"/>
|
||||
</el-button>
|
||||
<el-button class="btn-cus" link @click="onRefresh(item)">
|
||||
<el-icon size="17"><RefreshRight /></el-icon>
|
||||
</el-button>
|
||||
<el-button class="btn-cus" link @click="onEdit(item)">
|
||||
<el-icon size="17"><Edit /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -59,7 +65,7 @@ import MarkdownView from "@/components/MarkdownView/index.vue";
|
||||
import {ChatMessageApi, ChatMessageVO} from "@/api/ai/chat/message";
|
||||
import {useClipboard} from "@vueuse/core";
|
||||
import {PropType} from "vue";
|
||||
import {ArrowDownBold} from "@element-plus/icons-vue";
|
||||
import {ArrowDownBold, Edit, RefreshRight} from "@element-plus/icons-vue";
|
||||
|
||||
const {copy} = useClipboard() // 初始化 copy 到粘贴板
|
||||
// 判断 消息列表 滚动的位置(用于判断是否需要滚动到消息最下方)
|
||||
@ -125,6 +131,20 @@ const onDelete = async (id) => {
|
||||
emits('onDeleteSuccess')
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新
|
||||
*/
|
||||
const onRefresh = async (message: ChatMessageVO) => {
|
||||
emits('onRefresh', message)
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
const onEdit = async (message: ChatMessageVO) => {
|
||||
emits('onEdit', message)
|
||||
}
|
||||
|
||||
/**
|
||||
* 回到底部
|
||||
*/
|
||||
@ -151,7 +171,7 @@ watch(list, async (newValue, oldValue) => {
|
||||
defineExpose({scrollToBottom, handlerGoTop})
|
||||
|
||||
// 定义 emits
|
||||
const emits = defineEmits(['onDeleteSuccess'])
|
||||
const emits = defineEmits(['onDeleteSuccess', 'onRefresh', 'onEdit'])
|
||||
|
||||
// onMounted
|
||||
onMounted(async () => {
|
||||
|
@ -39,7 +39,9 @@
|
||||
<Message v-if="!listLoading && list.length > 0"
|
||||
ref="messageRef"
|
||||
:list="list"
|
||||
@on-delete-success="handlerMessageDelete" />
|
||||
@on-delete-success="handlerMessageDelete"
|
||||
@on-edit="handlerMessageEdit"
|
||||
@on-refresh="handlerMessageRefresh"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-main>
|
||||
@ -513,6 +515,20 @@ const handlerMessageDelete = async () => {
|
||||
await getMessageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑 message
|
||||
*/
|
||||
const handlerMessageEdit = async (message: ChatMessageVO) => {
|
||||
prompt.value = message.content
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑 message
|
||||
*/
|
||||
const handlerMessageRefresh = async (message: ChatMessageVO) => {
|
||||
await doSend(message.content)
|
||||
}
|
||||
|
||||
/**
|
||||
* 回到顶部
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user