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
9c370f72
authored
May 16, 2024
by
cherishsince
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【优化】增加对话,切换message
parent
36beffe1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
12 deletions
+29
-12
src/views/ai/chat/index.vue
+29
-12
No files found.
src/views/ai/chat/index.vue
View file @
9c370f72
...
@@ -261,8 +261,11 @@ const createConversation = async () => {
...
@@ -261,8 +261,11 @@ const createConversation = async () => {
}
}
const
changeConversation
=
(
id
:
number
)
=>
{
const
changeConversation
=
(
id
:
number
)
=>
{
// 切换对话
conversationId
.
value
=
id
conversationId
.
value
=
id
// TODO 芋艿:待实现
// TODO 芋艿:待实现
// 刷新 message 列表
messageList
()
}
}
/** 更新聊天会话的标题 */
/** 更新聊天会话的标题 */
...
@@ -535,10 +538,10 @@ const getChatConversationList = async () => {
...
@@ -535,10 +538,10 @@ const getChatConversationList = async () => {
conversationList
.
value
=
await
ChatConversationApi
.
getChatConversationMyList
()
conversationList
.
value
=
await
ChatConversationApi
.
getChatConversationMyList
()
// 默认选中第一条
// 默认选中第一条
if
(
conversationList
.
value
.
length
===
0
)
{
if
(
conversationList
.
value
.
length
===
0
)
{
conversationId
.
value
=
0
conversationId
.
value
=
null
// TODO 芋艿:清空对话
list
.
value
=
[]
}
else
{
}
else
{
if
(
conversationId
.
value
===
0
)
{
if
(
conversationId
.
value
===
null
)
{
conversationId
.
value
=
conversationList
.
value
[
0
].
id
conversationId
.
value
=
conversationList
.
value
[
0
].
id
changeConversation
(
conversationList
.
value
[
0
].
id
)
changeConversation
(
conversationList
.
value
[
0
].
id
)
}
}
...
@@ -607,16 +610,30 @@ const handleRoleRepository = async () => {
...
@@ -607,16 +610,30 @@ const handleRoleRepository = async () => {
// 清空对话
// 清空对话
const
handleClearConversation
=
async
()
=>
{
const
handleClearConversation
=
async
()
=>
{
await
ChatConversationApi
.
deleteMyAllExceptPinned
()
ElMessageBox
.
confirm
(
ElMessage
({
'确认后对话会全部清空,置顶的对话除外。'
,
message
:
'操作成功!'
,
'确认提示'
,
type
:
'success'
{
confirmButtonText
:
'确认'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
}
)
.
then
(
async
()
=>
{
await
ChatConversationApi
.
deleteMyAllExceptPinned
()
ElMessage
({
message
:
'操作成功!'
,
type
:
'success'
})
// 清空选中的对话
useConversation
.
value
=
null
conversationId
.
value
=
null
list
.
value
=
[]
// 获得聊天会话列表
await
getChatConversationList
()
})
.
catch
(()
=>
{
})
})
// 清空选中的对话
useConversation
.
value
=
null
conversationId
.
value
=
null
// 获得聊天会话列表
await
getChatConversationList
()
}
}
...
...
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