Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: prompt null parse var error (#1731)

Joel3675d2eae87f
diff --git a/web/utils/var.ts b/web/utils/var.ts
index 2f566a4754c..08855323c33 100644
--- a/web/utils/var.ts
+++ b/web/utils/var.ts
@@ -48,6 +48,9 @@ export const checkKeys = (keys: string[], canBeEmpty?: boolean) => {
const varRegex = /\{\{([a-zA-Z_][a-zA-Z0-9_]*)\}\}/g
export const getVars = (value: string) => {
+ if (!value)
+ return []
+
const keys = value.match(varRegex)?.filter((item) => {
return ![CONTEXT_PLACEHOLDER_TEXT, HISTORY_PLACEHOLDER_TEXT, QUERY_PLACEHOLDER_TEXT, PRE_PROMPT_PLACEHOLDER_TEXT].includes(item)
}).map((item) => {