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
561d60bc
authored
May 22, 2024
by
cherishsince
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【解决todo】AI Chat 增加清理 message
parent
d603f1ed
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
3 deletions
+29
-3
src/api/ai/chat/message/index.ts
+7
-1
src/assets/ai/clear.svg
+2
-0
src/views/ai/chat/index.vue
+20
-2
No files found.
src/api/ai/chat/message/index.ts
View file @
561d60bc
...
...
@@ -60,8 +60,14 @@ export const ChatMessageApi = {
})
},
//
发送 send
消息
//
删除
消息
delete
:
async
(
id
:
string
)
=>
{
return
await
request
.
delete
({
url
:
`/ai/chat/message/delete?id=
${
id
}
`
})
},
// 删除消息 - 对话所有消息
deleteByConversationId
:
async
(
conversationId
:
string
)
=>
{
return
await
request
.
delete
({
url
:
`/ai/chat/message/delete-by-conversation-id?conversationId=
${
conversationId
}
`
})
}
}
src/assets/ai/clear.svg
0 → 100644
View file @
561d60bc
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
t=
"1716342375293"
class=
"icon"
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
p-id=
"2604"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
width=
"200"
height=
"200"
><path
d=
"M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6c-0.3 1.5-0.4 3-0.4 4.4 0 14.4 11.6 26 26 26h723c1.5 0 3-0.1 4.4-0.4 14.2-2.4 23.7-15.9 21.2-30zM204 390h272V182h72v208h272v104H204V390z m468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z"
p-id=
"2605"
fill=
"#8a8a8a"
></path></svg>
\ No newline at end of file
src/views/ai/chat/index.vue
View file @
561d60bc
...
...
@@ -19,7 +19,9 @@
<span
v-html=
"activeConversation?.modelName"
></span>
<Icon
icon=
"ep:setting"
style=
"margin-left: 10px"
/>
</el-button>
<el-button
size=
"small"
:icon=
"User"
class=
"btn"
/>
<el-button
size=
"small"
class=
"btn"
@
click=
"handlerMessageClear"
>
<img
src=
"@/assets/ai/clear.svg"
style=
"height: 14px;"
/>
</el-button>
<el-button
size=
"small"
:icon=
"Download"
class=
"btn"
/>
<el-button
size=
"small"
:icon=
"Top"
class=
"btn"
@
click=
"handlerGoTop"
/>
</div>
...
...
@@ -93,7 +95,7 @@ import {ChatMessageApi, ChatMessageVO} from '@/api/ai/chat/message'
import
{
ChatConversationApi
,
ChatConversationVO
}
from
'@/api/ai/chat/conversation'
import
{
useClipboard
}
from
'@vueuse/core'
import
ChatConversationUpdateForm
from
"@/views/ai/chat/components/ChatConversationUpdateForm.vue"
;
import
{
Download
,
Top
,
User
}
from
"@element-plus/icons-vue"
;
import
{
Download
,
Top
}
from
"@element-plus/icons-vue"
;
const
route
=
useRoute
()
// 路由
const
message
=
useMessage
()
// 消息弹窗
...
...
@@ -488,6 +490,22 @@ const handlerGoTop = async () => {
await
messageRef
.
value
.
handlerGoTop
()
}
/**
* message 清除
*/
const
handlerMessageClear
=
async
()
=>
{
if
(
!
activeConversationId
.
value
)
{
return
}
// 确认提示
await
message
.
delConfirm
(
"确认清空对话消息?"
)
// 清空对话
await
ChatMessageApi
.
deleteByConversationId
(
activeConversationId
.
value
as
string
)
// 刷新 message 列表
await
getMessageList
()
}
/** 初始化 **/
onMounted
(
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