Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
03c6a6ce
authored
May 24, 2024
by
cherishsince
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【解决todo】Chat message 增加刷新和编辑
parent
f1beb488
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
3 deletions
+39
-3
src/views/ai/chat/Message.vue
+22
-2
src/views/ai/chat/index.vue
+17
-1
No files found.
src/views/ai/chat/Message.vue
View file @
03c6a6ce
...
@@ -43,6 +43,12 @@
...
@@ -43,6 +43,12 @@
<el-button
class=
"btn-cus"
link
@
click=
"onDelete(item.id)"
>
<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;"
/>
<img
class=
"btn-image"
src=
"@/assets/ai/delete.svg"
style=
"height: 17px;margin-right: 12px;"
/>
</el-button>
</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>
</div>
</div>
</div>
...
@@ -59,7 +65,7 @@ import MarkdownView from "@/components/MarkdownView/index.vue";
...
@@ -59,7 +65,7 @@ import MarkdownView from "@/components/MarkdownView/index.vue";
import
{
ChatMessageApi
,
ChatMessageVO
}
from
"@/api/ai/chat/message"
;
import
{
ChatMessageApi
,
ChatMessageVO
}
from
"@/api/ai/chat/message"
;
import
{
useClipboard
}
from
"@vueuse/core"
;
import
{
useClipboard
}
from
"@vueuse/core"
;
import
{
PropType
}
from
"vue"
;
import
{
PropType
}
from
"vue"
;
import
{
ArrowDownBold
}
from
"@element-plus/icons-vue"
;
import
{
ArrowDownBold
,
Edit
,
RefreshRight
}
from
"@element-plus/icons-vue"
;
const
{
copy
}
=
useClipboard
()
// 初始化 copy 到粘贴板
const
{
copy
}
=
useClipboard
()
// 初始化 copy 到粘贴板
// 判断 消息列表 滚动的位置(用于判断是否需要滚动到消息最下方)
// 判断 消息列表 滚动的位置(用于判断是否需要滚动到消息最下方)
...
@@ -126,6 +132,20 @@ const onDelete = async (id) => {
...
@@ -126,6 +132,20 @@ const onDelete = async (id) => {
}
}
/**
/**
* 刷新
*/
const
onRefresh
=
async
(
message
:
ChatMessageVO
)
=>
{
emits
(
'onRefresh'
,
message
)
}
/**
* 编辑
*/
const
onEdit
=
async
(
message
:
ChatMessageVO
)
=>
{
emits
(
'onEdit'
,
message
)
}
/**
* 回到底部
* 回到底部
*/
*/
const
handleGoBottom
=
async
()
=>
{
const
handleGoBottom
=
async
()
=>
{
...
@@ -151,7 +171,7 @@ watch(list, async (newValue, oldValue) => {
...
@@ -151,7 +171,7 @@ watch(list, async (newValue, oldValue) => {
defineExpose
({
scrollToBottom
,
handlerGoTop
})
defineExpose
({
scrollToBottom
,
handlerGoTop
})
// 定义 emits
// 定义 emits
const
emits
=
defineEmits
([
'onDeleteSuccess'
])
const
emits
=
defineEmits
([
'onDeleteSuccess'
,
'onRefresh'
,
'onEdit'
])
// onMounted
// onMounted
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
...
...
src/views/ai/chat/index.vue
View file @
03c6a6ce
...
@@ -39,7 +39,9 @@
...
@@ -39,7 +39,9 @@
<Message
v-if=
"!listLoading && list.length > 0"
<Message
v-if=
"!listLoading && list.length > 0"
ref=
"messageRef"
ref=
"messageRef"
:list=
"list"
:list=
"list"
@
on-delete-success=
"handlerMessageDelete"
/>
@
on-delete-success=
"handlerMessageDelete"
@
on-edit=
"handlerMessageEdit"
@
on-refresh=
"handlerMessageRefresh"
/>
</div>
</div>
</div>
</div>
</el-main>
</el-main>
...
@@ -514,6 +516,20 @@ const handlerMessageDelete = async () => {
...
@@ -514,6 +516,20 @@ const handlerMessageDelete = async () => {
}
}
/**
/**
* 编辑 message
*/
const
handlerMessageEdit
=
async
(
message
:
ChatMessageVO
)
=>
{
prompt
.
value
=
message
.
content
}
/**
* 编辑 message
*/
const
handlerMessageRefresh
=
async
(
message
:
ChatMessageVO
)
=>
{
await
doSend
(
message
.
content
)
}
/**
* 回到顶部
* 回到顶部
*/
*/
const
handlerGoTop
=
async
()
=>
{
const
handlerGoTop
=
async
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment