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
175f9d58
authored
May 14, 2024
by
cherishsince
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【增加】拉去对话信息,选中切换的模型
parent
8d907a76
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
18 deletions
+22
-18
src/api/ai/chat/conversation/index.ts
+1
-1
src/views/ai/chat/index.vue
+21
-17
No files found.
src/api/ai/chat/conversation/index.ts
View file @
175f9d58
...
@@ -27,7 +27,7 @@ export interface ChatConversationUpdateVO {
...
@@ -27,7 +27,7 @@ export interface ChatConversationUpdateVO {
// AI chat 聊天
// AI chat 聊天
export
const
ChatConversationApi
=
{
export
const
ChatConversationApi
=
{
// 获取 Conversation
// 获取 Conversation
get
:
async
(
id
:
number
)
=>
{
get
:
async
(
id
:
string
)
=>
{
return
await
request
.
get
({
url
:
`/ai/chat/conversation/get?id=
${
id
}
`
})
return
await
request
.
get
({
url
:
`/ai/chat/conversation/get?id=
${
id
}
`
})
},
},
// 更新 Conversation
// 更新 Conversation
...
...
src/views/ai/chat/index.vue
View file @
175f9d58
...
@@ -179,7 +179,11 @@
...
@@ -179,7 +179,11 @@
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ChatMessageApi
,
ChatMessageSendVO
,
ChatMessageVO
}
from
"@/api/ai/chat/message"
import
{
ChatMessageApi
,
ChatMessageSendVO
,
ChatMessageVO
}
from
"@/api/ai/chat/message"
import
{
ChatConversationApi
,
ChatConversationUpdateVO
}
from
"@/api/ai/chat/conversation"
import
{
ChatConversationApi
,
ChatConversationUpdateVO
,
ChatConversationVO
}
from
"@/api/ai/chat/conversation"
import
{
ChatModelApi
,
ChatModelVO
}
from
"@/api/ai/model/chatModel"
import
{
ChatModelApi
,
ChatModelVO
}
from
"@/api/ai/model/chatModel"
import
{
formatDate
}
from
"@/utils/formatTime"
import
{
formatDate
}
from
"@/utils/formatTime"
import
{
useClipboard
}
from
"@vueuse/core"
;
import
{
useClipboard
}
from
"@vueuse/core"
;
...
@@ -237,6 +241,7 @@ const isComposing = ref(false) // 判断用户是否在输入
...
@@ -237,6 +241,7 @@ const isComposing = ref(false) // 判断用户是否在输入
// defineOptions({ name: 'chatMessageList' })
// defineOptions({ name: 'chatMessageList' })
const
list
=
ref
<
ChatMessageVO
[]
>
([])
// 列表的数据
const
list
=
ref
<
ChatMessageVO
[]
>
([])
// 列表的数据
const
useModal
=
ref
<
ChatModelVO
>
()
// 使用的modal
const
useModal
=
ref
<
ChatModelVO
>
()
// 使用的modal
const
useConversation
=
ref
<
ChatConversationVO
>
()
// 使用的 Conversation
const
modalList
=
ref
<
ChatModelVO
[]
>
([])
// 列表的数据
const
modalList
=
ref
<
ChatModelVO
[]
>
([])
// 列表的数据
...
@@ -437,10 +442,6 @@ const modalClick = async (command) => {
...
@@ -437,10 +442,6 @@ const modalClick = async (command) => {
const
getModalList
=
async
()
=>
{
const
getModalList
=
async
()
=>
{
// 获取模型 as unknown as ChatModelVO
// 获取模型 as unknown as ChatModelVO
modalList
.
value
=
await
ChatModelApi
.
getChatModelSimpleList
(
0
)
as
unknown
as
ChatModelVO
[]
modalList
.
value
=
await
ChatModelApi
.
getChatModelSimpleList
(
0
)
as
unknown
as
ChatModelVO
[]
// 默认选中第一个模型
if
(
modalList
.
value
.
length
)
{
useModal
.
value
=
modalList
.
value
[
0
]
}
}
}
// 输入
// 输入
...
@@ -477,25 +478,28 @@ const onPromptInput = (event) => {
...
@@ -477,25 +478,28 @@ const onPromptInput = (event) => {
console
.
log
(
'setTimeout 输入结束...'
)
console
.
log
(
'setTimeout 输入结束...'
)
isComposing
.
value
=
false
isComposing
.
value
=
false
},
400
)
},
400
)
// isComposing.value= false
// setTimeout(() => {
// console.log('输入结束...')
// isComposing.value = false
// }, 200)
// isComposing.value = event.data && event.data === event.target.value.slice(-1);
//
// if (isComposing.value) {
// console.log('用户正在使用输入法输入');
// } else {
// console.log('用户正在直接输入');
// }
}
}
const
getConversation
=
async
(
conversationId
:
string
)
=>
{
// 获取对话信息
useConversation
.
value
=
await
ChatConversationApi
.
get
(
conversationId
)
console
.
log
(
'useConversation.value'
,
useConversation
.
value
)
// 选中 modal
if
(
useConversation
.
value
)
{
modalList
.
value
.
forEach
(
item
=>
{
if
(
useConversation
.
value
?.
modelId
===
item
.
id
)
{
useModal
.
value
=
item
}
})
}
}
/** 初始化 **/
/** 初始化 **/
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
// 获取模型
// 获取模型
getModalList
();
getModalList
();
// 获取对话信息
getConversation
(
conversationId
.
value
);
// 获取列表数据
// 获取列表数据
messageList
();
messageList
();
// scrollToBottom();
// scrollToBottom();
...
...
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