Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
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
Unverified
Commit
f3404e6a
authored
Jun 22, 2026
by
Archer
Committed by
GitHub
Jun 22, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adapt old version config (#7158)
parent
32701aa3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
20 deletions
+57
-20
packages/global/core/workflow/type/io.ts
+30
-20
packages/global/test/core/app/type.test.ts
+27
-0
No files found.
packages/global/core/workflow/type/io.ts
View file @
f3404e6a
...
...
@@ -79,20 +79,25 @@ export const InputComponentPropsTypeSchema = z.object({
}),
// password
list
:
z
.
array
(
z
.
object
({
label
:
z
.
string
().
meta
({
description
:
'变量选项展示名称'
}),
value
:
z
.
string
().
meta
({
description
:
'变量选项实际值'
}),
icon
:
z
.
string
().
optional
().
meta
({
description
:
'变量选项图标'
}),
description
:
z
.
string
().
optional
().
meta
({
description
:
'变量选项说明'
z
.
object
({
label
:
z
.
string
().
optional
().
meta
({
description
:
'变量选项展示名称'
}),
value
:
z
.
string
().
meta
({
description
:
'变量选项实际值'
}),
icon
:
z
.
string
().
optional
().
meta
({
description
:
'变量选项图标'
}),
description
:
z
.
string
().
optional
().
meta
({
description
:
'变量选项说明'
})
})
})
.
transform
((
item
)
=>
({
...
item
,
label
:
item
.
label
??
item
.
value
}))
)
.
optional
()
.
meta
({
...
...
@@ -177,14 +182,19 @@ export const InputComponentPropsTypeSchema = z.object({
enums
:
z
.
array
(
z
.
object
({
value
:
z
.
string
().
meta
({
description
:
'枚举项实际值'
}),
label
:
z
.
string
().
meta
({
description
:
'枚举项展示名称'
z
.
object
({
value
:
z
.
string
().
meta
({
description
:
'枚举项实际值'
}),
label
:
z
.
string
().
optional
().
meta
({
description
:
'枚举项展示名称'
})
})
})
.
transform
((
item
)
=>
({
...
item
,
label
:
item
.
label
??
item
.
value
}))
)
.
optional
()
.
meta
({
...
...
packages/global/test/core/app/type.test.ts
View file @
f3404e6a
import
{
describe
,
expect
,
it
}
from
'vitest'
;
import
{
AppChatConfigTypeSchema
}
from
'@fastgpt/global/core/app/type'
;
import
{
VariableInputEnum
}
from
'@fastgpt/global/core/workflow/constants'
;
describe
(
'AppChatConfigTypeSchema'
,
()
=>
{
it
(
'should adapt old boolean questionGuide format'
,
()
=>
{
...
...
@@ -20,4 +21,30 @@ describe('AppChatConfigTypeSchema', () => {
expect
(
AppChatConfigTypeSchema
.
parse
({
questionGuide
}).
questionGuide
).
toEqual
(
questionGuide
);
});
it
(
'should fill option label with value when variable option label is missing'
,
()
=>
{
const
result
=
AppChatConfigTypeSchema
.
parse
({
variables
:
[
{
key
:
'newSelect'
,
label
:
'New Select'
,
type
:
VariableInputEnum
.
select
,
description
:
''
,
list
:
[{
value
:
'option-a'
}]
},
{
key
:
'legacySelect'
,
label
:
'Legacy Select'
,
type
:
VariableInputEnum
.
select
,
description
:
''
,
enums
:
[{
value
:
'legacy-option'
}]
}
]
});
expect
(
result
.
variables
?.[
0
].
list
).
toEqual
([{
label
:
'option-a'
,
value
:
'option-a'
}]);
expect
(
result
.
variables
?.[
1
].
enums
).
toEqual
([
{
label
:
'legacy-option'
,
value
:
'legacy-option'
}
]);
});
});
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