mirror of
https://github.com/langgenius/dify.git
synced 2026-05-10 05:56:31 +08:00
feat: add optional version field to Template type and remove unused version parsing function
This commit is contained in:
parent
39f4e205a8
commit
7934b0222d
@ -74,6 +74,7 @@ export type TemplateCollection = {
|
||||
export type Template = {
|
||||
id: string
|
||||
index_id: string
|
||||
version?: string
|
||||
template_name: string
|
||||
icon: string
|
||||
icon_background?: string
|
||||
|
||||
@ -9,7 +9,6 @@ type GraphPayload = {
|
||||
}
|
||||
|
||||
type DslPayload = {
|
||||
version?: string | number
|
||||
workflow?: {
|
||||
graph?: GraphPayload
|
||||
}
|
||||
@ -43,21 +42,6 @@ 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 = {
|
||||
precision?: number
|
||||
rounding?: 'round' | 'floor'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user