mirror of
https://github.com/langgenius/dify.git
synced 2026-09-08 11:04:27 +08:00
feat: add version parsing function to extract version from DSL content
This commit is contained in:
parent
2dba133d4d
commit
39f4e205a8
@ -9,6 +9,7 @@ type GraphPayload = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DslPayload = {
|
type DslPayload = {
|
||||||
|
version?: string | number
|
||||||
workflow?: {
|
workflow?: {
|
||||||
graph?: GraphPayload
|
graph?: GraphPayload
|
||||||
}
|
}
|
||||||
@ -42,6 +43,21 @@ export const parseGraphFromDsl = (dslContent: string): ParsedGraph => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const parseDslVersionFromDsl = (dslContent: string): string | null => {
|
||||||
|
if (!dslContent)
|
||||||
|
return null
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = yamlLoad(dslContent) as DslPayload
|
||||||
|
if (data?.version === undefined || data?.version === null)
|
||||||
|
return null
|
||||||
|
return String(data.version)
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type UsedCountFormatOptions = {
|
type UsedCountFormatOptions = {
|
||||||
precision?: number
|
precision?: number
|
||||||
rounding?: 'round' | 'floor'
|
rounding?: 'round' | 'floor'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user