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
7ab9aa77
authored
May 16, 2024
by
cherishsince
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【增加】Chat 对话增加更新选中
parent
6fc5f8c6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
src/views/ai/chat/Conversation.vue
+14
-6
No files found.
src/views/ai/chat/Conversation.vue
View file @
7ab9aa77
...
@@ -87,7 +87,7 @@ const message = useMessage() // 消息弹窗
...
@@ -87,7 +87,7 @@ const message = useMessage() // 消息弹窗
// 定义属性
// 定义属性
const
searchName
=
ref
<
string
>
(
''
)
// 对话搜索
const
searchName
=
ref
<
string
>
(
''
)
// 对话搜索
const
activeConversationId
=
ref
<
number
|
null
>
(
null
)
// 选中的对话,默认为 null
const
activeConversationId
=
ref
<
string
|
null
>
(
null
)
// 选中的对话,默认为 null
const
conversationList
=
ref
([]
as
ChatConversationVO
[])
// 对话列表
const
conversationList
=
ref
([]
as
ChatConversationVO
[])
// 对话列表
const
conversationMap
=
ref
<
any
>
({})
// 对话分组 (置顶、今天、三天前、一星期前、一个月前)
const
conversationMap
=
ref
<
any
>
({})
// 对话分组 (置顶、今天、三天前、一星期前、一个月前)
const
drawer
=
ref
<
boolean
>
(
false
)
// 角色仓库抽屉
const
drawer
=
ref
<
boolean
>
(
false
)
// 角色仓库抽屉
...
@@ -95,13 +95,13 @@ const drawer = ref<boolean>(false) // 角色仓库抽屉
...
@@ -95,13 +95,13 @@ const drawer = ref<boolean>(false) // 角色仓库抽屉
// 定义组件 props
// 定义组件 props
const
props
=
defineProps
({
const
props
=
defineProps
({
activeId
:
{
activeId
:
{
type
:
Number
||
null
,
type
:
String
||
null
,
required
:
true
required
:
true
}
}
})
})
// 定义钩子
// 定义钩子
const
emits
=
defineEmits
([
'onConversationClick'
,
'onConversationClear'
])
const
emits
=
defineEmits
([
'onConversationClick'
,
'onConversationClear'
,
'onConversationDelete'
])
/**
/**
* 对话 - 搜索
* 对话 - 搜索
...
@@ -113,7 +113,7 @@ const searchConversation = () => {
...
@@ -113,7 +113,7 @@ const searchConversation = () => {
/**
/**
* 对话 - 点击
* 对话 - 点击
*/
*/
const
handleConversationClick
=
async
(
id
:
number
)
=>
{
const
handleConversationClick
=
async
(
id
:
string
)
=>
{
// 切换对话
// 切换对话
activeConversationId
.
value
=
id
activeConversationId
.
value
=
id
const
filterConversation
=
conversationList
.
value
.
filter
(
item
=>
{
const
filterConversation
=
conversationList
.
value
.
filter
(
item
=>
{
...
@@ -227,6 +227,8 @@ const deleteChatConversation = async (conversation: ChatConversationVO) => {
...
@@ -227,6 +227,8 @@ const deleteChatConversation = async (conversation: ChatConversationVO) => {
message
.
success
(
'会话已删除'
)
message
.
success
(
'会话已删除'
)
// 刷新列表
// 刷新列表
await
getChatConversationList
()
await
getChatConversationList
()
// 回调
emits
(
'onConversationDelete'
,
conversation
)
}
catch
{
}
catch
{
}
}
}
}
...
@@ -276,10 +278,16 @@ const handleClearConversation = async () => {
...
@@ -276,10 +278,16 @@ const handleClearConversation = async () => {
// ============ 组件 onMounted
// ============ 组件 onMounted
const
{
activeId
}
=
toRefs
(
props
)
watch
(
activeId
,
async
(
newValue
,
oldValue
)
=>
{
// 更新选中
activeConversationId
.
value
=
newValue
as
string
})
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
//
//
默认选中
if
(
props
.
activeId
!=
null
)
{
if
(
props
.
activeId
!=
null
)
{
activeConversationId
.
value
=
props
.
activeId
}
}
// 获取 对话列表
// 获取 对话列表
await
getChatConversationList
()
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