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
e02481b6
Commit
e02481b6
authored
Sep 14, 2024
by
nick zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: ai生成应用开场白和推荐问
parent
d2884c07
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
35 deletions
+52
-35
agent-application.ts
src/apis/agent-application.ts
+20
-0
app-setting.vue
...nal-space/personal-app-setting/components/app-setting.vue
+31
-29
preamble.vue
...rsonal-space/personal-app-setting/components/preamble.vue
+1
-6
No files found.
src/apis/agent-application.ts
View file @
e02481b6
...
...
@@ -68,3 +68,23 @@ export function fetchGetLargeModelList<T>() {
export
function
fetchCreateDialogues
<
T
>
(
agentId
:
string
)
{
return
request
.
post
<
T
>
(
`/agentApplicationRest/createDialogues.json?agentId=
${
agentId
}
`
)
}
/**
* * @param { agentTitle: 标题 agentDesc: 描述 }
* @returns AI生成开场白
*/
export
function
fetchCreatePreamble
<
T
>
(
payload
:
{
agentTitle
:
string
;
agentDesc
:
string
})
{
return
request
.
post
<
T
>
(
'/agentApplicationInfoRest/createPreamble.json'
,
payload
,
{
timeout
:
120000
,
})
}
/**
* * @param { agentTitle: 标题 agentDesc: 描述 }
* @returns AI生成推荐问
*/
export
function
fetchCreateFeaturedQuestions
<
T
>
(
payload
:
{
agentTitle
:
string
;
agentDesc
:
string
})
{
return
request
.
post
<
T
>
(
'/agentApplicationInfoRest/createFeaturedQuestions.json'
,
payload
,
{
timeout
:
120000
,
})
}
src/views/personal-space/personal-app-setting/components/app-setting.vue
View file @
e02481b6
...
...
@@ -9,6 +9,8 @@ import UploadPhoto from '@/components/upload-photo/upload-photo.vue'
import
{
usePersonalAppConfigStore
}
from
'@/store/modules/personal-app-config'
import
{
PersonalAppConfigState
}
from
'@/store/types/personal-app-config'
import
{
fetchCreateFeaturedQuestions
,
fetchCreatePreamble
,
fetchGetDebugApplicationInfo
,
fetchGetLargeModelList
,
fetchSaveAgentApplication
,
...
...
@@ -56,7 +58,6 @@ const showAdditionalPromptModal = ref(false)
const
isInitGetAgentAppDetail
=
ref
(
false
)
// const generateAgentAvatarLoading = ref(false) // 是否正在生成头像
const
generatePreambleLoading
=
ref
(
false
)
// 是否正在生成开场白
const
generateFeaturedQuestionsLoading
=
ref
(
false
)
// 是否正在生成推荐词
...
...
@@ -176,35 +177,36 @@ function handleUpdateCommConfigExpandedNames(expandedNames: any) {
commConfigExpandedNames
.
value
=
expandedNames
}
// function handleGenerateAgentAvatar() {
// personalAppConfig.value.baseInfo.agentDesc = '22'
// generateAgentAvatarLoading.value = true
async
function
handleAIGeneratePreamble
()
{
!
commConfigExpandedNames
.
value
.
includes
(
'preamble'
)
&&
commConfigExpandedNames
.
value
.
push
(
'preamble'
)
// setTimeout(() => {
// generateAgentAvatarLoading.value = false
// }, 2000)
// }
generatePreambleLoading
.
value
=
true
// function handleAIGeneratePreamble() {
// !commConfigExpandedNames.value.includes('preamble') && commConfigExpandedNames.value.push('preamble')
const
res
=
await
fetchCreatePreamble
({
agentTitle
:
personalAppConfig
.
value
.
baseInfo
.
agentTitle
,
agentDesc
:
personalAppConfig
.
value
.
baseInfo
.
agentDesc
,
}).
finally
(()
=>
(
generatePreambleLoading
.
value
=
false
))
// generatePreambleLoading.value = true
if
(
res
.
code
===
0
)
{
personalAppConfig
.
value
.
commConfig
.
preamble
=
res
.
data
as
string
}
}
// setTimeout(() => {
// generatePreambleLoading.value = false
// }, 2000)
// }
async
function
handleAIGenerateFeaturedQuestions
()
{
!
commConfigExpandedNames
.
value
.
includes
(
'featuredQuestions'
)
&&
commConfigExpandedNames
.
value
.
push
(
'featuredQuestions'
)
// function handleAIGenerateFeaturedQuestions() {
// !commConfigExpandedNames.value.includes('featuredQuestions') &&
// commConfigExpandedNames.value.push('featuredQuestions')
generateFeaturedQuestionsLoading
.
value
=
true
// generateFeaturedQuestionsLoading.value = true
const
res
=
await
fetchCreateFeaturedQuestions
<
string
[]
>
({
agentTitle
:
personalAppConfig
.
value
.
baseInfo
.
agentTitle
,
agentDesc
:
personalAppConfig
.
value
.
baseInfo
.
agentDesc
,
}).
finally
(()
=>
(
generateFeaturedQuestionsLoading
.
value
=
false
))
// setTimeout(() =>
{
// generateFeaturedQuestionsLoading.value = false
// }, 2000)
//
}
if
(
res
.
code
===
0
)
{
personalAppConfig
.
value
.
commConfig
.
featuredQuestions
=
res
.
data
}
}
</
script
>
<
template
>
...
...
@@ -457,7 +459,7 @@ function handleUpdateCommConfigExpandedNames(expandedNames: any) {
<CustomIcon
icon=
"gravity-ui:caret-right"
/>
</
template
>
<NCollapseItem
title=
"开场白"
name=
"preamble"
class=
"my-[13px]!"
>
<
!-- <
template #header-extra>
<
template
#
header-extra
>
<NTooltip
trigger=
"hover"
>
<template
#
trigger
>
<div
...
...
@@ -472,7 +474,7 @@ function handleUpdateCommConfigExpandedNames(expandedNames: any) {
</
template
>
AI生成
</NTooltip>
</template>
-->
</template>
<NInput
v-model:value=
"personalAppConfig.commConfig.preamble"
type=
"textarea"
...
...
@@ -483,8 +485,8 @@ function handleUpdateCommConfigExpandedNames(expandedNames: any) {
/>
</NCollapseItem>
<NCollapseItem
title=
"推荐
词
"
name=
"featuredQuestions"
class=
"my-[13px]!"
>
<
!-- <
template #header-extra>
<NCollapseItem
title=
"推荐
问
"
name=
"featuredQuestions"
class=
"my-[13px]!"
>
<
template
#
header-extra
>
<NTooltip
trigger=
"hover"
>
<template
#
trigger
>
<div
...
...
@@ -499,10 +501,10 @@ function handleUpdateCommConfigExpandedNames(expandedNames: any) {
</
template
>
AI生成
</NTooltip>
</template>
-->
</template>
<NDynamicInput
v-model:value=
"personalAppConfig.commConfig.featuredQuestions"
placeholder=
"请输入推荐
词
"
placeholder=
"请输入推荐
问
"
class=
"rounded-md"
:min=
"1"
:max=
"3"
...
...
src/views/personal-space/personal-app-setting/components/preamble.vue
View file @
e02481b6
...
...
@@ -44,12 +44,7 @@ function handleSelectFeaturedQuestion(featuredQuestion: string) {
class=
"w-full cursor-pointer rounded-xl border border-[#d4d6d9] bg-[#ffffff80] px-[14px] py-[11px] hover:opacity-80"
@
click=
"handleSelectFeaturedQuestion(featuredQuestionItem)"
>
<NPopover
trigger=
"hover"
>
<template
#
trigger
>
<span
class=
"break-all"
>
{{
featuredQuestionItem
}}
</span>
</
template
>
<span>
{{ featuredQuestionItem }}
</span>
</NPopover>
<span
class=
"break-all"
>
{{
featuredQuestionItem
}}
</span>
</div>
</li>
</ul>
...
...
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