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
f36f9815
Commit
f36f9815
authored
May 10, 2025
by
nick zheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://gitlab.gsstcloud.com/poc/poc-fe
into beta
parents
3618fd7f
b423f4db
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
115 additions
and
69 deletions
+115
-69
en.yaml
src/locales/langs/en.yaml
+2
-0
zh-cn.yaml
src/locales/langs/zh-cn.yaml
+2
-0
zh-hk.yaml
src/locales/langs/zh-hk.yaml
+2
-0
business-trip-form.vue
.../components/smart-forms/components/business-trip-form.vue
+20
-17
business-trip-reimbursement-form.vue
...art-forms/components/business-trip-reimbursement-form.vue
+2
-2
index.vue
src/views/home/components/smart-forms/index.vue
+1
-1
business-trip-form.d.ts
...home/components/smart-forms/types/business-trip-form.d.ts
+26
-0
business-trip-form.ts
...s/home/components/smart-forms/utils/business-trip-form.ts
+43
-0
home.vue
src/views/home/home.vue
+15
-49
locales.d.ts
types/locales.d.ts
+2
-0
No files found.
src/locales/langs/en.yaml
View file @
f36f9815
...
@@ -163,6 +163,8 @@ common_module:
...
@@ -163,6 +163,8 @@ common_module:
database_QA_executed_successfully
:
'
Database
Q&A
executed
successfully'
database_QA_executed_successfully
:
'
Database
Q&A
executed
successfully'
input_parameter
:
'
Input
parameter'
input_parameter
:
'
Input
parameter'
output_parameter
:
'
Output
parameter'
output_parameter
:
'
Output
parameter'
submit_successfully
:
'
Submit
successfully'
submit_failure
:
'
Submit
failure'
dialogue_module
:
dialogue_module
:
continue_question_message
:
'
You
can
keep
asking
questions'
continue_question_message
:
'
You
can
keep
asking
questions'
...
...
src/locales/langs/zh-cn.yaml
View file @
f36f9815
...
@@ -162,6 +162,8 @@ common_module:
...
@@ -162,6 +162,8 @@ common_module:
database_QA_executed_successfully
:
'
数据库问答执行成功'
database_QA_executed_successfully
:
'
数据库问答执行成功'
input_parameter
:
'
输入参数'
input_parameter
:
'
输入参数'
output_parameter
:
'
输出参数'
output_parameter
:
'
输出参数'
submit_successfully
:
'
提交成功'
submit_failure
:
'
提交失败'
dialogue_module
:
dialogue_module
:
continue_question_message
:
'
你可以继续提问'
continue_question_message
:
'
你可以继续提问'
...
...
src/locales/langs/zh-hk.yaml
View file @
f36f9815
...
@@ -162,6 +162,8 @@ common_module:
...
@@ -162,6 +162,8 @@ common_module:
database_QA_executed_successfully
:
'
數據庫問答執行成功'
database_QA_executed_successfully
:
'
數據庫問答執行成功'
input_parameter
:
'
輸入參數'
input_parameter
:
'
輸入參數'
output_parameter
:
'
輸出參數'
output_parameter
:
'
輸出參數'
submit_successfully
:
'
提交成功'
submit_failure
:
'
提交失敗'
dialogue_module
:
dialogue_module
:
continue_question_message
:
'
你可以繼續提問'
continue_question_message
:
'
你可以繼續提問'
...
...
src/views/home/components/smart-forms/business-trip-form.vue
→
src/views/home/components/smart-forms/
components/
business-trip-form.vue
View file @
f36f9815
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
computed
,
inject
,
readonly
,
ref
,
toRaw
,
useTemplateRef
,
watch
,
watchEffect
}
from
'vue'
import
{
computed
,
inject
,
readonly
,
ref
,
toRaw
,
useTemplateRef
,
watch
,
watchEffect
}
from
'vue'
import
type
{
MessageItemInterface
}
from
'../../types'
import
type
{
MessageItemInterface
}
from
'../../
../
types'
import
MarkdownRender
from
'@/components/markdown-render/markdown-render.vue'
import
MarkdownRender
from
'@/components/markdown-render/markdown-render.vue'
import
type
{
FormInst
,
FormRules
,
FormItemRule
}
from
'naive-ui'
import
type
{
FormInst
,
FormRules
,
FormItemRule
}
from
'naive-ui'
import
{
useI18n
}
from
'vue-i18n'
import
{
useI18n
}
from
'vue-i18n'
import
{
useSystemLanguageStore
}
from
'@/store/modules/system-language'
import
{
useSystemLanguageStore
}
from
'@/store/modules/system-language'
import
MessageBubbleLoading
from
'
..
/message-bubble-loading.vue'
import
MessageBubbleLoading
from
'
@/views/home/components
/message-bubble-loading.vue'
import
isEmail
from
'validator/es/lib/isEmail'
import
isEmail
from
'validator/es/lib/isEmail'
import
type
{
BusinessTripForm
,
ResponseBusinessTripForm
}
from
'./types'
import
type
{
BusinessTripFormInterface
,
ResponseBusinessTripFormInterface
}
from
'../types/business-trip-form'
import
{
businessTripFormParser
,
businessTripFormReturner
}
from
'../../utils/smart-forms'
import
{
businessTripFormParser
,
businessTripFormReturner
,
}
from
'@/views/home/components/smart-forms/utils/business-trip-form'
import
{
fetchBusinessTripFormSubmit
}
from
'@/apis/smart-forms'
import
{
fetchBusinessTripFormSubmit
}
from
'@/apis/smart-forms'
interface
Props
{
interface
Props
{
...
@@ -70,7 +73,7 @@ const formRules = readonly<FormRules>({
...
@@ -70,7 +73,7 @@ const formRules = readonly<FormRules>({
},
},
})
})
const
formModel
=
ref
<
BusinessTripForm
>
({
const
formModel
=
ref
<
BusinessTripForm
Interface
>
({
objective
:
'CustomerVisits'
,
objective
:
'CustomerVisits'
,
travelLocation
:
''
,
travelLocation
:
''
,
departureTime
:
null
,
departureTime
:
null
,
...
@@ -108,7 +111,7 @@ watch(
...
@@ -108,7 +111,7 @@ watch(
()
=>
props
.
messageItem
.
smartFormInfo
,
()
=>
props
.
messageItem
.
smartFormInfo
,
(
smartFormInfo
)
=>
{
(
smartFormInfo
)
=>
{
if
(
smartFormInfo
&&
smartFormInfo
.
params
)
{
if
(
smartFormInfo
&&
smartFormInfo
.
params
)
{
let
config
:
Partial
<
ResponseBusinessTripForm
>
=
{}
let
config
:
Partial
<
ResponseBusinessTripForm
Interface
>
=
{}
try
{
try
{
config
=
JSON
.
parse
(
smartFormInfo
.
params
)
config
=
JSON
.
parse
(
smartFormInfo
.
params
)
...
@@ -151,7 +154,10 @@ function handleSubmitForm() {
...
@@ -151,7 +154,10 @@ function handleSubmitForm() {
fetchBusinessTripFormSubmit
(
businessTripFormReturner
(
toRaw
(
formModel
.
value
)))
fetchBusinessTripFormSubmit
(
businessTripFormReturner
(
toRaw
(
formModel
.
value
)))
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
res
.
code
!==
0
)
return
''
if
(
res
.
code
!==
0
)
{
window
.
$message
.
error
(
t
(
'common_module.submit_failure'
))
return
}
updateSpecifyMessageItem
(
messageItemId
,
{
updateSpecifyMessageItem
(
messageItemId
,
{
smartFormInfo
:
{
smartFormInfo
:
{
...
@@ -159,6 +165,8 @@ function handleSubmitForm() {
...
@@ -159,6 +165,8 @@ function handleSubmitForm() {
isDisabled
:
true
,
isDisabled
:
true
,
},
},
})
})
window
.
$message
.
success
(
t
(
'common_module.submit_successfully'
))
})
})
.
finally
(()
=>
{
.
finally
(()
=>
{
submitFormBtnLoading
.
value
=
false
submitFormBtnLoading
.
value
=
false
...
@@ -172,12 +180,7 @@ function handleSubmitForm() {
...
@@ -172,12 +180,7 @@ function handleSubmitForm() {
<div
class=
"ml-[11px] overflow-hidden"
>
<div
class=
"ml-[11px] overflow-hidden"
>
<div
class=
"mb-[7px] text-[12px] text-[#999]"
>
{{
messageAuthor
}}
</div>
<div
class=
"mb-[7px] text-[12px] text-[#999]"
>
{{
messageAuthor
}}
</div>
<div
<div>
:class=
"
{
'min-w-[420px]': !systemLanguageStore.isEnglishLanguage,
'min-w-[500px]': systemLanguageStore.isEnglishLanguage,
}"
>
<div
<div
class=
"box-content min-h-[21px] min-w-[10px] max-w-full rounded-[10px] border border-[#9EA3FF] bg-[#777EF9] px-[15px] py-[14px] text-justify"
class=
"box-content min-h-[21px] min-w-[10px] max-w-full rounded-[10px] border border-[#9EA3FF] bg-[#777EF9] px-[15px] py-[14px] text-justify"
:class=
"
{
:class=
"
{
...
@@ -185,10 +188,7 @@ function handleSubmitForm() {
...
@@ -185,10 +188,7 @@ function handleSubmitForm() {
'!min-w-[80px]': messageItem.isAnswerLoading,
'!min-w-[80px]': messageItem.isAnswerLoading,
}"
}"
>
>
<div
<div
v-if=
"messageItem.isAnswerLoading"
class=
"flex h-[21px] items-center justify-center"
>
v-if=
"messageItem.isAnswerLoading && !messageItem.content"
class=
"flex h-[21px] items-center justify-center"
>
<MessageBubbleLoading
:active-color=
"currentBubbleTextColor"
/>
<MessageBubbleLoading
:active-color=
"currentBubbleTextColor"
/>
</div>
</div>
<template
v-else
>
<template
v-else
>
...
@@ -212,9 +212,12 @@ function handleSubmitForm() {
...
@@ -212,9 +212,12 @@ function handleSubmitForm() {
</div>
</div>
<div
<div
v-if=
"!messageItem.isAnswerLoading"
class=
"mt-[10px] box-content min-h-[21px] min-w-[10px] max-w-full rounded-[10px] border border-[#9EA3FF] bg-[#777EF9] px-[15px] py-[14px] text-justify"
class=
"mt-[10px] box-content min-h-[21px] min-w-[10px] max-w-full rounded-[10px] border border-[#9EA3FF] bg-[#777EF9] px-[15px] py-[14px] text-justify"
:class=
"{
:class=
"{
'!bg-[#fff]': isAgentMessage,
'!bg-[#fff]': isAgentMessage,
'min-w-[420px]': !systemLanguageStore.isEnglishLanguage,
'min-w-[500px]': systemLanguageStore.isEnglishLanguage,
}"
}"
>
>
<h2
class=
"font-600 text-[15px] text-[#0B7DFF]"
>
{{ t('smart_forms_module.business_trip_form.title') }}
</h2>
<h2
class=
"font-600 text-[15px] text-[#0B7DFF]"
>
{{ t('smart_forms_module.business_trip_form.title') }}
</h2>
...
...
src/views/home/components/smart-forms/business-trip-reimbursement-form.vue
→
src/views/home/components/smart-forms/
components/
business-trip-reimbursement-form.vue
View file @
f36f9815
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
readonly
,
ref
}
from
'vue'
import
{
readonly
,
ref
}
from
'vue'
import
type
{
MessageItemInterface
}
from
'
../..
/types'
import
type
{
MessageItemInterface
}
from
'
@/views/home
/types'
import
MarkdownRender
from
'@/components/markdown-render/markdown-render.vue'
import
MarkdownRender
from
'@/components/markdown-render/markdown-render.vue'
import
type
{
FormRules
}
from
'naive-ui'
import
type
{
FormRules
}
from
'naive-ui'
import
MessageBubbleLoading
from
'
..
/message-bubble-loading.vue'
import
MessageBubbleLoading
from
'
@/views/home/components
/message-bubble-loading.vue'
interface
Props
{
interface
Props
{
isAgentMessage
:
boolean
isAgentMessage
:
boolean
...
...
src/views/home/components/smart-forms/index.vue
View file @
f36f9815
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
type
{
MessageItemInterface
}
from
'../../types'
import
type
{
MessageItemInterface
}
from
'../../types'
import
BusinessTripForm
from
'./business-trip-form.vue'
import
BusinessTripForm
from
'./
components/
business-trip-form.vue'
// import BusinessTripReimbursementForm from './business-trip-reimbursement-form.vue'
// import BusinessTripReimbursementForm from './business-trip-reimbursement-form.vue'
interface
Props
{
interface
Props
{
...
...
src/views/home/components/smart-forms/types/business-trip-form.d.ts
0 → 100644
View file @
f36f9815
export
interface
ResponseBusinessTripFormInterface
{
purpose
:
string
place
:
string
departureDate
:
string
returnDate
:
string
vehicle
:
string
transportationFee
:
string
accommodation
:
string
accommodationCost
:
string
advancePaymentAmount
:
string
totalBudget
:
string
}
export
interface
BusinessTripFormInterface
{
objective
:
string
travelLocation
:
string
departureTime
:
number
|
null
returnTime
:
number
|
null
vehicle
:
string
vehicleEstimatedCost
:
number
|
null
residence
:
string
residenceEstimatedCost
:
number
|
null
advancePaymentAmount
:
number
|
null
generalBudget
:
string
email
:
string
}
src/views/home/components/smart-forms/utils/business-trip-form.ts
0 → 100644
View file @
f36f9815
import
type
{
SmartFormTypes
}
from
'@/views/home/types'
import
type
{
ResponseBusinessTripFormInterface
,
BusinessTripFormInterface
,
}
from
'@/views/home/components/smart-forms/types/business-trip-form'
export
function
smartFormTypeConverter
(
type
:
'travelForm'
):
SmartFormTypes
{
switch
(
type
)
{
case
'travelForm'
:
return
'BusinessTripForm'
}
}
export
function
businessTripFormParser
(
resForm
:
Partial
<
ResponseBusinessTripFormInterface
>
)
{
return
{
objective
:
resForm
.
purpose
||
'CustomerVisits'
,
travelLocation
:
resForm
.
place
||
''
,
departureTime
:
resForm
.
departureDate
?
Date
.
parse
(
resForm
.
departureDate
)
:
null
,
returnTime
:
resForm
.
returnDate
?
Date
.
parse
(
resForm
.
returnDate
)
:
null
,
vehicle
:
resForm
.
vehicle
||
''
,
vehicleEstimatedCost
:
resForm
.
transportationFee
?
Number
.
parseInt
(
resForm
.
transportationFee
)
:
null
,
residence
:
resForm
.
accommodation
||
''
,
residenceEstimatedCost
:
resForm
.
accommodationCost
?
Number
.
parseInt
(
resForm
.
accommodationCost
)
:
null
,
advancePaymentAmount
:
resForm
.
advancePaymentAmount
?
Number
.
parseInt
(
resForm
.
advancePaymentAmount
)
:
null
,
generalBudget
:
resForm
.
totalBudget
||
''
,
email
:
''
,
}
}
export
function
businessTripFormReturner
(
form
:
BusinessTripFormInterface
)
{
return
{
purpose
:
form
.
objective
,
place
:
form
.
travelLocation
,
departureDate
:
form
.
departureTime
?
new
Date
(
form
.
departureTime
).
toISOString
()
:
''
,
returnDate
:
form
.
returnTime
?
new
Date
(
form
.
returnTime
).
toISOString
()
:
''
,
vehicle
:
form
.
vehicle
,
transportationFee
:
form
.
vehicleEstimatedCost
,
accommodation
:
form
.
residence
,
accommodationCost
:
form
.
residenceEstimatedCost
,
advancePaymentAmount
:
form
.
advancePaymentAmount
,
totalBudget
:
form
.
generalBudget
,
}
}
src/views/home/home.vue
View file @
f36f9815
...
@@ -44,22 +44,9 @@ const isShowMessageList = ref(false)
...
@@ -44,22 +44,9 @@ const isShowMessageList = ref(false)
const
isAgentInitLoading
=
ref
(
true
)
const
isAgentInitLoading
=
ref
(
true
)
const
currentFetchEventSourceController
=
ref
<
AbortController
|
null
>
(
null
)
const
currentFetchEventSourceController
=
ref
<
AbortController
|
null
>
(
null
)
setTimeout
(()
=>
{
/* 测试数据 */
// messageList.value.set('1', {
/* setTimeout(() => {
// role: 'assistant',
messageList.value.set('1', {
// agentId: 'b058f1baedd04af983ca00775368bb8c',
// content: '请推荐一些适合初学者的编程学习资源。',
// timestamp: 1726654820427,
// isAnswerLoading: false,
// avatar: 'http://localhost:8848/fe/src/assets/images/home/agent-avatar.png',
// name: '我是作者',
// reasoningContent: '1324',
// imageUrl: '',
// pluginName: '',
// smartFormInfo: { type: 'BusinessTripForm', isDisabled: true, params: '' },
// })
messageList
.
value
.
set
(
'2'
,
{
role: 'assistant',
role: 'assistant',
agentId: 'b058f1baedd04af983ca00775368bb8c',
agentId: 'b058f1baedd04af983ca00775368bb8c',
content: '请推荐一些适合初学者的编程学习资源。',
content: '请推荐一些适合初学者的编程学习资源。',
...
@@ -77,28 +64,7 @@ setTimeout(() => {
...
@@ -77,28 +64,7 @@ setTimeout(() => {
'{"purpose":"Training","place":"香港","departureDate":"returnDate","accommodationCost":"11","departureDate":"2025-05-10 15:00:00","advancePaymentAmount":"11","totalBudget":"11"}',
'{"purpose":"Training","place":"香港","departureDate":"returnDate","accommodationCost":"11","departureDate":"2025-05-10 15:00:00","advancePaymentAmount":"11","totalBudget":"11"}',
},
},
})
})
},
60
)
}, 60) */
// setTimeout(() => {
// onAddMessageItem('3', {
// role: 'assistant',
// agentId: 'b058f1baedd04af983ca00775368bb8c',
// content: '请推荐一些适合初学者的编程学习资源。',
// timestamp: 1726654820427,
// isAnswerLoading: false,
// avatar: 'http://localhost:8848/fe/src/assets/images/home/agent-avatar.png',
// name: '我是作者',
// reasoningContent: '1324',
// imageUrl: '',
// pluginName: '',
// smartFormInfo: {
// type: 'BusinessTripForm',
// isDisabled: false,
// params:
// '{"purpose":"Training","place":"香港","departureDate":"returnDate","accommodationCost":"11","departureDate":"2025-05-10 15:00:00","advancePaymentAmount":"11","totalBudget":"11"}',
// },
// })
// }, 2000)
const
homeContainerWidthWatchDebounce
=
debounce
((
newWidth
)
=>
{
const
homeContainerWidthWatchDebounce
=
debounce
((
newWidth
)
=>
{
if
(
newWidth
<=
1120
)
{
if
(
newWidth
<=
1120
)
{
...
@@ -153,15 +119,6 @@ function messageListScrollToBottom() {
...
@@ -153,15 +119,6 @@ function messageListScrollToBottom() {
}
}
function
onAddMessageItem
(
messageId
:
string
,
messageItem
:
MessageItemInterface
)
{
function
onAddMessageItem
(
messageId
:
string
,
messageItem
:
MessageItemInterface
)
{
/* 重置智能表单项目 */
if
(
messageItem
.
smartFormInfo
&&
messageItem
.
smartFormInfo
.
type
)
{
messageList
.
value
.
forEach
((
messageInfo
)
=>
{
if
(
messageInfo
.
smartFormInfo
&&
messageInfo
.
smartFormInfo
.
type
===
messageItem
.
smartFormInfo
?.
type
)
{
messageInfo
.
smartFormInfo
.
isDisabled
=
true
}
})
}
messageList
.
value
.
set
(
messageId
,
messageItem
)
messageList
.
value
.
set
(
messageId
,
messageItem
)
}
}
...
@@ -245,7 +202,16 @@ function onClearSessionReferenceFile() {
...
@@ -245,7 +202,16 @@ function onClearSessionReferenceFile() {
footerOperationRef
.
value
&&
footerOperationRef
.
value
.
clearSessionReferenceFile
()
footerOperationRef
.
value
&&
footerOperationRef
.
value
.
clearSessionReferenceFile
()
}
}
function
onSmartFormsStatusFreeze
()
{}
function
onSmartFormsStatusFreezeCheck
(
messageItem
:
MessageItemInterface
)
{
/* 重置智能表单项目 */
if
(
messageItem
.
smartFormInfo
&&
messageItem
.
smartFormInfo
.
type
)
{
messageList
.
value
.
forEach
((
item
)
=>
{
if
(
item
.
smartFormInfo
&&
item
.
smartFormInfo
.
type
===
messageItem
.
smartFormInfo
?.
type
)
{
item
.
smartFormInfo
.
isDisabled
=
true
}
})
}
}
</
script
>
</
script
>
<
template
>
<
template
>
...
@@ -283,7 +249,7 @@ function onSmartFormsStatusFreeze() {}
...
@@ -283,7 +249,7 @@ function onSmartFormsStatusFreeze() {}
@
delete-message-item=
"onDeleteMessageItem"
@
delete-message-item=
"onDeleteMessageItem"
@
create-new-session=
"onCreateNewSession"
@
create-new-session=
"onCreateNewSession"
@
history-record-list-update=
"onHistoryRecordListUpdate"
@
history-record-list-update=
"onHistoryRecordListUpdate"
@
smart-forms-status-freeze
=
"onSmartFormsStatusFreeze
"
@
smart-forms-status-freeze
-check=
"onSmartFormsStatusFreezeCheck
"
/>
/>
</div>
</div>
...
...
types/locales.d.ts
View file @
f36f9815
...
@@ -162,6 +162,8 @@ declare namespace I18n {
...
@@ -162,6 +162,8 @@ declare namespace I18n {
database_QA_executed_successfully
:
string
database_QA_executed_successfully
:
string
input_parameter
:
string
input_parameter
:
string
output_parameter
:
string
output_parameter
:
string
submit_successfully
:
string
submit_failure
:
string
dialogue_module
:
{
dialogue_module
:
{
continue_question_message
:
string
continue_question_message
:
string
...
...
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