Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-fe
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poc
poc-fe
Commits
65f36f06
Commit
65f36f06
authored
Oct 25, 2024
by
tyyin lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore(首页): 打断回答应用历史记录项更新历史列表
parent
024ccbb0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
9 deletions
+47
-9
zh-cn.yaml
src/locales/langs/zh-cn.yaml
+1
-0
zh-hk.yaml
src/locales/langs/zh-hk.yaml
+1
-0
footer-operation.vue
src/views/home/components/footer-operation.vue
+12
-4
history-menu-sidebar.vue
src/views/home/components/history-menu-sidebar.vue
+26
-3
home.vue
src/views/home/home.vue
+6
-2
locales.d.ts
types/locales.d.ts
+1
-0
No files found.
src/locales/langs/zh-cn.yaml
View file @
65f36f06
...
@@ -108,6 +108,7 @@ home_module:
...
@@ -108,6 +108,7 @@ home_module:
history_record_item_apply_tip
:
'
是否确定应用此会话记录?'
history_record_item_apply_tip
:
'
是否确定应用此会话记录?'
historical_record
:
'
历史记录'
historical_record
:
'
历史记录'
interrupt_dialogue_prompt
:
'
当前回复尚未完成,是否确定打断发起新会话?'
interrupt_dialogue_prompt
:
'
当前回复尚未完成,是否确定打断发起新会话?'
interrupt_the_conversation_and_apply_the_history_prompt
:
'
当前回复尚未完成,是否确定打断对话应用其它记录?'
router_title_module
:
router_title_module
:
login
:
'
登录'
login
:
'
登录'
...
...
src/locales/langs/zh-hk.yaml
View file @
65f36f06
...
@@ -92,6 +92,7 @@ login_module:
...
@@ -92,6 +92,7 @@ login_module:
get_verification_code
:
'
獲取驗証碼'
get_verification_code
:
'
獲取驗証碼'
other_login_methods
:
'
其他登錄方式'
other_login_methods
:
'
其他登錄方式'
interrupt_dialogue_prompt
:
'
當前回復尚未完成,是否確定打斷發起新會話?'
interrupt_dialogue_prompt
:
'
當前回復尚未完成,是否確定打斷發起新會話?'
interrupt_the_conversation_and_apply_the_history_prompt
:
'
當前回復尚未完成,是否確定打斷對話應用其它記錄?'
home_module
:
home_module
:
agent_welcome_message
:
'
Hi,
歡迎使用SuperLink'
agent_welcome_message
:
'
Hi,
歡迎使用SuperLink'
...
...
src/views/home/components/footer-operation.vue
View file @
65f36f06
...
@@ -9,6 +9,7 @@ import { useI18n } from 'vue-i18n'
...
@@ -9,6 +9,7 @@ import { useI18n } from 'vue-i18n'
interface
Props
{
interface
Props
{
currentSessionId
:
string
currentSessionId
:
string
messageListLength
:
number
}
}
const
props
=
defineProps
<
Props
>
()
const
props
=
defineProps
<
Props
>
()
...
@@ -24,11 +25,12 @@ const emit = defineEmits<{
...
@@ -24,11 +25,12 @@ const emit = defineEmits<{
const
questionContent
=
defineModel
<
string
>
(
'questionContent'
,
{
required
:
true
})
const
questionContent
=
defineModel
<
string
>
(
'questionContent'
,
{
required
:
true
})
const
currentAgentApplication
=
defineModel
<
AgentApplicationRecordItem
>
(
'currentAgentApplication'
,
{
required
:
true
})
const
currentAgentApplication
=
defineModel
<
AgentApplicationRecordItem
>
(
'currentAgentApplication'
,
{
required
:
true
})
const
isAgentResponding
=
defineModel
<
boolean
>
(
'isAgentResponding'
,
{
required
:
true
})
const
isAgentResponding
=
defineModel
<
boolean
>
(
'isAgentResponding'
,
{
required
:
true
})
const
currentFetchEventSourceController
=
defineModel
<
AbortController
|
null
>
(
'currentFetchEventSourceController'
,
{
required
:
true
,
})
const
{
t
}
=
useI18n
()
const
{
t
}
=
useI18n
()
let
currentFetchEventSourceController
:
AbortController
|
null
=
null
const
isShowApplicationSelectMenu
=
ref
(
false
)
const
isShowApplicationSelectMenu
=
ref
(
false
)
const
agentApplicationSelectList
=
ref
<
AgentApplicationRecordItem
[]
>
([])
const
agentApplicationSelectList
=
ref
<
AgentApplicationRecordItem
[]
>
([])
...
@@ -75,7 +77,7 @@ function handleApplicationChange(agentApplicationItem: AgentApplicationRecordIte
...
@@ -75,7 +77,7 @@ function handleApplicationChange(agentApplicationItem: AgentApplicationRecordIte
function
handleCreateNewSession
()
{
function
handleCreateNewSession
()
{
if
(
isAgentResponding
.
value
)
{
if
(
isAgentResponding
.
value
)
{
window
.
$message
.
ctWarning
(
t
(
'home_module.interrupt_dialogue_prompt'
)).
then
(()
=>
{
window
.
$message
.
ctWarning
(
t
(
'home_module.interrupt_dialogue_prompt'
)).
then
(()
=>
{
currentFetchEventSourceController
&&
currentFetchEventSourceController
.
abort
()
currentFetchEventSourceController
.
value
&&
currentFetchEventSourceController
.
value
.
abort
()
isAgentResponding
.
value
=
false
isAgentResponding
.
value
=
false
...
@@ -87,6 +89,12 @@ function handleCreateNewSession() {
...
@@ -87,6 +89,12 @@ function handleCreateNewSession() {
},
300
)
},
300
)
})
})
}
else
{
}
else
{
if
(
props
.
messageListLength
===
0
)
{
window
.
$message
.
warning
(
t
(
'home_module.currently_in_the_latest_session'
))
return
}
emit
(
'createNewSession'
)
emit
(
'createNewSession'
)
}
}
}
}
...
@@ -123,7 +131,7 @@ function questionSubmit() {
...
@@ -123,7 +131,7 @@ function questionSubmit() {
let
isFirstClip
=
true
let
isFirstClip
=
true
let
messageContent
=
''
let
messageContent
=
''
currentFetchEventSourceController
=
fetchEventStreamSource
(
currentFetchEventSourceController
.
value
=
fetchEventStreamSource
(
'/agentApplicationRest/callAgentApplication.json'
,
'/agentApplicationRest/callAgentApplication.json'
,
{
{
dialogsId
:
props
.
currentSessionId
,
//会话ID
dialogsId
:
props
.
currentSessionId
,
//会话ID
...
...
src/views/home/components/history-menu-sidebar.vue
View file @
65f36f06
...
@@ -3,17 +3,25 @@ import { fetchHistoryRecordDelete, fetchSessionHistoryRecordList } from '@/apis/
...
@@ -3,17 +3,25 @@ import { fetchHistoryRecordDelete, fetchSessionHistoryRecordList } from '@/apis/
import
{
computed
,
ref
,
nextTick
,
toValue
}
from
'vue'
import
{
computed
,
ref
,
nextTick
,
toValue
}
from
'vue'
import
{
useI18n
}
from
'vue-i18n'
import
{
useI18n
}
from
'vue-i18n'
interface
Props
{
currentFetchEventSourceController
:
AbortController
|
null
}
interface
SessionHistoryRecordItem
{
interface
SessionHistoryRecordItem
{
content
:
string
content
:
string
dialogsId
:
string
dialogsId
:
string
}
}
const
props
=
defineProps
<
Props
>
()
const
emit
=
defineEmits
<
{
const
emit
=
defineEmits
<
{
getMessageRecordList
:
[
recordId
:
string
]
getMessageRecordList
:
[
recordId
:
string
]
createNewSession
:
[]
createNewSession
:
[]
historyRecordListUpdate
:
[]
}
>
()
}
>
()
const
isShowHistoryMenu
=
defineModel
<
boolean
>
({
default
:
true
})
const
isShowHistoryMenu
=
defineModel
<
boolean
>
({
default
:
true
})
const
isAgentResponding
=
defineModel
<
boolean
>
(
'isAgentResponding'
,
{
required
:
true
})
const
{
t
}
=
useI18n
()
const
{
t
}
=
useI18n
()
...
@@ -117,9 +125,24 @@ function onHistoryRecordListUpdate() {
...
@@ -117,9 +125,24 @@ function onHistoryRecordListUpdate() {
}
}
function
handleRecordItemApply
(
dialogsId
:
string
)
{
function
handleRecordItemApply
(
dialogsId
:
string
)
{
window
.
$message
.
ctWarning
(
t
(
'home_module.history_record_item_apply_tip'
),
t
(
'common_module.tip'
)).
then
(()
=>
{
if
(
isAgentResponding
.
value
)
{
emit
(
'getMessageRecordList'
,
dialogsId
)
window
.
$message
.
ctWarning
(
t
(
'home_module.interrupt_the_conversation_and_apply_the_history_prompt'
)).
then
(()
=>
{
})
props
.
currentFetchEventSourceController
&&
props
.
currentFetchEventSourceController
.
abort
()
isAgentResponding
.
value
=
false
emit
(
'getMessageRecordList'
,
dialogsId
)
/* 延时,避免页面刷新后,历史记录列表未刷新 */
setTimeout
(()
=>
{
emit
(
'historyRecordListUpdate'
)
},
300
)
})
}
else
{
window
.
$message
.
ctWarning
(
t
(
'home_module.history_record_item_apply_tip'
),
t
(
'common_module.tip'
)).
then
(()
=>
{
emit
(
'getMessageRecordList'
,
dialogsId
)
})
}
}
}
defineExpose
({
defineExpose
({
...
...
src/views/home/home.vue
View file @
65f36f06
...
@@ -38,6 +38,7 @@ const messageList = ref(new Map<string, MessageItemInterface>())
...
@@ -38,6 +38,7 @@ const messageList = ref(new Map<string, MessageItemInterface>())
const
isAgentResponding
=
ref
(
false
)
const
isAgentResponding
=
ref
(
false
)
const
isShowMessageList
=
ref
(
false
)
const
isShowMessageList
=
ref
(
false
)
const
isAgentInitLoading
=
ref
(
true
)
const
isAgentInitLoading
=
ref
(
true
)
const
currentFetchEventSourceController
=
ref
<
AbortController
|
null
>
(
null
)
// messageList.value.set('1', {
// messageList.value.set('1', {
// role: 'user',
// role: 'user',
...
@@ -99,8 +100,6 @@ function createSessionId() {
...
@@ -99,8 +100,6 @@ function createSessionId() {
function
onCreateNewSession
()
{
function
onCreateNewSession
()
{
if
(
messageList
.
value
.
size
===
0
)
{
if
(
messageList
.
value
.
size
===
0
)
{
window
.
$message
.
warning
(
t
(
'home_module.currently_in_the_latest_session'
))
return
return
}
}
...
@@ -197,7 +196,9 @@ function onGetMessageRecordList(recordId: string) {
...
@@ -197,7 +196,9 @@ function onGetMessageRecordList(recordId: string) {
v-model:current-agent-application=
"currentAgentApplication"
v-model:current-agent-application=
"currentAgentApplication"
v-model:is-agent-responding=
"isAgentResponding"
v-model:is-agent-responding=
"isAgentResponding"
v-model:question-content=
"questionContent"
v-model:question-content=
"questionContent"
v-model:current-fetch-event-source-controller=
"currentFetchEventSourceController"
:current-session-id=
"currentSessionId"
:current-session-id=
"currentSessionId"
:message-list-length=
"messageList.size"
@
message-list-scroll-to-bottom=
"messageListScrollToBottom"
@
message-list-scroll-to-bottom=
"messageListScrollToBottom"
@
add-message-item=
"onAddMessageItem"
@
add-message-item=
"onAddMessageItem"
@
update-specify-message-item=
"onUpdateSpecifyMessageItem"
@
update-specify-message-item=
"onUpdateSpecifyMessageItem"
...
@@ -210,8 +211,11 @@ function onGetMessageRecordList(recordId: string) {
...
@@ -210,8 +211,11 @@ function onGetMessageRecordList(recordId: string) {
<HistoryMenuSidebar
<HistoryMenuSidebar
ref=
"historyMenuSidebarRef"
ref=
"historyMenuSidebarRef"
v-model=
"isShowHistoryMenu"
v-model=
"isShowHistoryMenu"
v-model:is-agent-responding=
"isAgentResponding"
:current-fetch-event-source-controller=
"currentFetchEventSourceController"
@
get-message-record-list=
"onGetMessageRecordList"
@
get-message-record-list=
"onGetMessageRecordList"
@
create-new-session=
"onCreateNewSession"
@
create-new-session=
"onCreateNewSession"
@
history-record-list-update=
"onHistoryRecordListUpdate"
/>
/>
</div>
</div>
...
...
types/locales.d.ts
View file @
65f36f06
...
@@ -113,6 +113,7 @@ declare namespace I18n {
...
@@ -113,6 +113,7 @@ declare namespace I18n {
history_record_item_apply_tip
:
string
history_record_item_apply_tip
:
string
historical_record
:
string
historical_record
:
string
interrupt_dialogue_prompt
:
string
interrupt_dialogue_prompt
:
string
interrupt_the_conversation_and_apply_the_history_prompt
:
string
}
}
router_title_module
:
{
router_title_module
:
{
...
...
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