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
141244e9
You need to sign in or sign up before continuing.
Commit
141244e9
authored
Oct 09, 2024
by
nick zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 应用创建大模型增加icon
parent
d0896c02
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
4 deletions
+57
-4
agent-application.ts
src/apis/agent-application.ts
+8
-0
personal-app-config.ts
src/store/modules/personal-app-config.ts
+1
-1
app-setting.vue
...nal-space/personal-app-setting/components/app-setting.vue
+48
-3
No files found.
src/apis/agent-application.ts
View file @
141244e9
...
@@ -129,3 +129,11 @@ export function fetchCreateAgentTitleAndDesc<T>(payload: { input: string }, cont
...
@@ -129,3 +129,11 @@ export function fetchCreateAgentTitleAndDesc<T>(payload: { input: string }, cont
signal
:
controller
.
signal
,
signal
:
controller
.
signal
,
})
})
}
}
/**
* * @param { modelName: 模型名称 }
* @returns 搜索模型信息
*/
export
function
fetchGetLargeModelInfo
<
T
>
(
modelName
:
string
)
{
return
request
.
post
<
T
>
(
`/agentApplicationInfoRest/getLargeModelInfo.json?query=
${
modelName
}
`
)
}
src/store/modules/personal-app-config.ts
View file @
141244e9
...
@@ -22,7 +22,7 @@ export function defaultPersonalAppConfigState(): PersonalAppConfigState {
...
@@ -22,7 +22,7 @@ export function defaultPersonalAppConfigState(): PersonalAppConfigState {
knowledgeIds
:
[],
knowledgeIds
:
[],
},
},
commModelConfig
:
{
commModelConfig
:
{
largeModel
:
'
ERNIE-4.0-8K
'
,
largeModel
:
'
文心4.0 (8K)
'
,
topP
:
0.0
,
topP
:
0.0
,
communicationTurn
:
0
,
communicationTurn
:
0
,
},
},
...
...
src/views/personal-space/personal-app-setting/components/app-setting.vue
View file @
141244e9
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
computed
,
nextTick
,
onMounted
,
onUnmounted
,
reactive
,
ref
,
watch
}
from
'vue'
import
{
computed
,
h
,
nextTick
,
onMounted
,
onUnmounted
,
reactive
,
ref
,
VNodeChild
,
watch
}
from
'vue'
import
{
useRouter
}
from
'vue-router'
import
{
useRouter
}
from
'vue-router'
import
{
FormInst
,
InputInst
,
SelectOption
,
UploadFileInfo
}
from
'naive-ui'
import
{
FormInst
,
InputInst
,
SelectOption
,
UploadFileInfo
}
from
'naive-ui'
import
{
useThrottleFn
}
from
'@vueuse/core'
import
{
useThrottleFn
}
from
'@vueuse/core'
...
@@ -15,6 +15,7 @@ import {
...
@@ -15,6 +15,7 @@ import {
fetchCreateFeaturedQuestions
,
fetchCreateFeaturedQuestions
,
fetchCreatePreamble
,
fetchCreatePreamble
,
fetchGetDebugApplicationInfo
,
fetchGetDebugApplicationInfo
,
fetchGetLargeModelInfo
,
fetchGetLargeModelList
,
fetchGetLargeModelList
,
fetchSaveAgentApplication
,
fetchSaveAgentApplication
,
}
from
'@/apis/agent-application'
}
from
'@/apis/agent-application'
...
@@ -51,6 +52,10 @@ const questionSettingOptions = [
...
@@ -51,6 +52,10 @@ const questionSettingOptions = [
let
modalListOptions
=
reactive
<
SelectOption
[]
>
([])
let
modalListOptions
=
reactive
<
SelectOption
[]
>
([])
let
modalListRenderLabel
:
(
option
:
SelectOption
)
=>
VNodeChild
const
currentLargeModelIcon
=
ref
(
''
)
// 当前大模型icon
const
commConfigExpandedNames
=
ref
<
string
[]
>
([
'continuousQuestion'
])
const
commConfigExpandedNames
=
ref
<
string
[]
>
([
'continuousQuestion'
])
const
isInitGetAgentAppDetail
=
ref
(
false
)
const
isInitGetAgentAppDetail
=
ref
(
false
)
...
@@ -115,6 +120,8 @@ onMounted(async () => {
...
@@ -115,6 +120,8 @@ onMounted(async () => {
isInitGetAgentAppDetail
.
value
=
false
isInitGetAgentAppDetail
.
value
=
false
}
}
await
handleGetLargeModelList
()
await
handleGetLargeModelList
()
await
handleGetLargeModelInfo
()
})
})
onUnmounted
(()
=>
{
onUnmounted
(()
=>
{
...
@@ -149,9 +156,10 @@ async function handleGetAgentApplicationDetail(agentId: string) {
...
@@ -149,9 +156,10 @@ async function handleGetAgentApplicationDetail(agentId: string) {
}
}
}
}
// 获取大模型列表
async
function
handleGetLargeModelList
()
{
async
function
handleGetLargeModelList
()
{
modalListOptions
=
[]
modalListOptions
=
[]
const
res
=
await
fetchGetLargeModelList
<
{
owner
:
string
;
models
:
string
[]
}[]
>
()
const
res
=
await
fetchGetLargeModelList
<
{
owner
:
string
;
models
:
string
[]
;
icon
:
string
}[]
>
()
res
.
data
.
forEach
((
item
)
=>
{
res
.
data
.
forEach
((
item
)
=>
{
modalListOptions
.
push
({
modalListOptions
.
push
({
...
@@ -162,9 +170,44 @@ async function handleGetLargeModelList() {
...
@@ -162,9 +170,44 @@ async function handleGetLargeModelList() {
label
:
model
,
label
:
model
,
value
:
model
,
value
:
model
,
style
:
{
fontSize
:
'12px'
},
style
:
{
fontSize
:
'12px'
},
icon
:
item
.
icon
,
})),
})),
})
})
})
})
modalListRenderLabel
=
(
option
:
SelectOption
):
VNodeChild
=>
{
if
(
option
.
type
===
'group'
)
return
`
${
option
.
label
}
`
return
[
h
(
'div'
,
{
class
:
'flex items-center'
},
[
h
(
'div'
,
{
style
:
{
width
:
'16px'
,
height
:
'16px'
,
marginRight
:
'6px'
,
flexShrink
:
0
,
background
:
`url(
${
option
.
icon
}
)`
,
backgroundSize
:
'100% 100%'
,
},
}),
h
(
'span'
,
{},
{
default
:
()
=>
option
.
label
as
string
}),
]),
]
}
}
// 获取大模型信息
async
function
handleGetLargeModelInfo
()
{
const
res
=
await
fetchGetLargeModelInfo
<
{
icon
:
string
}
>
(
personalAppConfig
.
value
.
commModelConfig
.
largeModel
)
if
(
res
.
code
===
0
)
{
currentLargeModelIcon
.
value
=
res
.
data
.
icon
}
}
// 更换大模型
function
handleUpdateLargeModel
(
_value
:
string
,
option
:
SelectOption
)
{
currentLargeModelIcon
.
value
=
option
.
icon
as
string
}
}
// 保存应用配置
// 保存应用配置
...
@@ -397,7 +440,7 @@ function handleStopGenerate() {
...
@@ -397,7 +440,7 @@ function handleStopGenerate() {
<div
<div
class=
"hover:border-theme-color flex cursor-pointer items-center justify-between rounded-md border border-[#d4d6d9] px-3 py-[7px]"
class=
"hover:border-theme-color flex cursor-pointer items-center justify-between rounded-md border border-[#d4d6d9] px-3 py-[7px]"
>
>
<img
src=
"@/assets/images/lingjing-icon.png
"
class=
"mr-1 h-4 w-4"
/>
<img
:src=
"currentLargeModelIcon || '@/assets/images/lingjing-icon.png'
"
class=
"mr-1 h-4 w-4"
/>
<span
class=
"line-clamp-1 max-w-[100px] text-xs text-[#5c5f66]"
>
<span
class=
"line-clamp-1 max-w-[100px] text-xs text-[#5c5f66]"
>
{{
personalAppConfig
.
commModelConfig
.
largeModel
}}
{{
personalAppConfig
.
commModelConfig
.
largeModel
}}
</span>
</span>
...
@@ -412,6 +455,8 @@ function handleStopGenerate() {
...
@@ -412,6 +455,8 @@ function handleStopGenerate() {
v-model:value=
"personalAppConfig.commModelConfig.largeModel"
v-model:value=
"personalAppConfig.commModelConfig.largeModel"
class=
"model-select"
class=
"model-select"
:options=
"modalListOptions"
:options=
"modalListOptions"
:render-label=
"modalListRenderLabel"
@
update:value=
"handleUpdateLargeModel"
/>
/>
<div
class=
"mt-4 text-xs"
>
<div
class=
"mt-4 text-xs"
>
...
...
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