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
6a03b763
authored
May 21, 2024
by
cherishsince
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【解决todo】AI 对话增加加载中。
parent
8b0d598d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletions
+19
-1
src/views/ai/chat/Conversation.vue
+19
-1
No files found.
src/views/ai/chat/Conversation.vue
View file @
6a03b763
...
...
@@ -24,7 +24,10 @@
<!-- 左中间:对话列表 -->
<div
class=
"conversation-list"
>
<!-- TODO @fain:置顶、聊天记录、一星期钱、30天前,前端对数据重新做一下分组,或者后端接口改一下 -->
<el-empty
v-if=
"loading"
description=
"."
:v-loading=
"loading"
/>
<!-- TODO done @fain:置顶、聊天记录、一星期钱、30天前,前端对数据重新做一下分组,或者后端接口改一下 -->
<div
v-for=
"conversationKey in Object.keys(conversationMap)"
:key=
"conversationKey"
>
<div
class=
"conversation-item classify-title"
v-if=
"conversationMap[conversationKey].length"
>
<el-text
class=
"mx-1"
size=
"small"
tag=
"b"
>
{{ conversationKey }}
</el-text>
...
...
@@ -102,6 +105,8 @@ const activeConversationId = ref<string | null>(null) // 选中的对话,默
const
conversationList
=
ref
([]
as
ChatConversationVO
[])
// 对话列表
const
conversationMap
=
ref
<
any
>
({})
// 对话分组 (置顶、今天、三天前、一星期前、一个月前)
const
drawer
=
ref
<
boolean
>
(
false
)
// 角色仓库抽屉
const
loading
=
ref
<
boolean
>
(
false
)
// 加载中
const
loadingTime
=
ref
<
any
>
()
// 加载中定时器
// 定义组件 props
const
props
=
defineProps
({
...
...
@@ -147,6 +152,11 @@ const handleConversationClick = async (id: string) => {
* 对话 - 获取列表
*/
const
getChatConversationList
=
async
()
=>
{
try
{
// 0、加载中
loadingTime
.
value
=
setTimeout
(()
=>
{
loading
.
value
=
true
},
50
)
// 1、获取 对话数据
const
res
=
await
ChatConversationApi
.
getChatConversationMyList
()
// 2、排序
...
...
@@ -166,6 +176,14 @@ const getChatConversationList = async () => {
}
// 5、对话根据时间分组(置顶、今天、一天前、三天前、七天前、30天前)
conversationMap
.
value
=
await
conversationTimeGroup
(
conversationList
.
value
)
}
finally
{
// 清理定时器
if
(
loadingTime
.
value
)
{
clearTimeout
(
loadingTime
.
value
)
}
// 加载完成
loading
.
value
=
false
}
}
const
conversationTimeGroup
=
async
(
list
:
ChatConversationVO
[])
=>
{
...
...
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