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
908b3c21
authored
Jul 10, 2024
by
YunaiV
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
ec61670b
21ade9b9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
9 deletions
+3
-9
src/views/ai/model/chatRole/ChatRoleForm.vue
+3
-9
No files found.
src/views/ai/model/chatRole/ChatRoleForm.vue
View file @
908b3c21
...
...
@@ -69,6 +69,7 @@ import { getIntDictOptions, getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
import
{
ChatRoleApi
,
ChatRoleVO
}
from
'@/api/ai/model/chatRole'
import
{
CommonStatusEnum
}
from
'@/utils/constants'
import
{
ChatModelApi
,
ChatModelVO
}
from
'@/api/ai/model/chatModel'
import
{
FormRules
}
from
"element-plus"
;
/** AI 聊天角色 表单 */
defineOptions
({
name
:
'ChatRoleForm'
})
...
...
@@ -92,7 +93,6 @@ const formData = ref({
publicStatus
:
true
,
status
:
CommonStatusEnum
.
ENABLE
})
const
formRules
=
ref
()
// reactive(formRulesObj)
const
formRef
=
ref
()
// 表单 Ref
const
chatModelList
=
ref
([]
as
ChatModelVO
[])
// 聊天模型列表
...
...
@@ -101,9 +101,7 @@ const isUser = computed(() => {
return
formType
.
value
===
'my-create'
||
formType
.
value
===
'my-update'
})
// TODO @fan:直接使用 formRules;只要隐藏掉的字段,它是不会校验的哈;
const
getFormRules
=
async
(
type
:
string
)
=>
{
let
formRulesObj
=
{
const
formRules
=
reactive
<
FormRules
>
({
name
:
[{
required
:
true
,
message
:
'角色名称不能为空'
,
trigger
:
'blur'
}],
avatar
:
[{
required
:
true
,
message
:
'角色头像不能为空'
,
trigger
:
'blur'
}],
category
:
[{
required
:
true
,
message
:
'角色类别不能为空'
,
trigger
:
'blur'
}],
...
...
@@ -111,10 +109,7 @@ const getFormRules = async (type: string) => {
description
:
[{
required
:
true
,
message
:
'角色描述不能为空'
,
trigger
:
'blur'
}],
systemMessage
:
[{
required
:
true
,
message
:
'角色设定不能为空'
,
trigger
:
'blur'
}],
publicStatus
:
[{
required
:
true
,
message
:
'是否公开不能为空'
,
trigger
:
'blur'
}]
}
formRules
.
value
=
reactive
(
formRulesObj
)
}
})
/** 打开弹窗 */
// TODO @fan:title 是不是收敛到 type 判断生成 title,会更合理
...
...
@@ -122,7 +117,6 @@ const open = async (type: string, id?: number, title?: string) => {
dialogVisible
.
value
=
true
dialogTitle
.
value
=
title
||
t
(
'action.'
+
type
)
formType
.
value
=
type
getFormRules
(
type
)
resetForm
()
// 修改时,设置数据
if
(
id
)
{
...
...
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