mirror of https://github.com/langgenius/dify.git
Merge branch 'feat/rag-pipeline' into deploy/rag-dev
This commit is contained in:
commit
1d106c3660
|
|
@ -0,0 +1,26 @@
|
|||
// 写测试用例, VAR_REGEX 能匹配的情况和不能匹配的情况
|
||||
import { VAR_REGEX, resetReg } from './index'
|
||||
describe('VAR_REGEX', () => {
|
||||
it('matched variable names', () => {
|
||||
const vars = [
|
||||
// node output variables
|
||||
'{{#1749783300519.text#}}',
|
||||
'{{#1749783300519.llm.a#}}',
|
||||
'{{#1749783300519.llm.a.b.c#}}',
|
||||
'{{#1749783300519.llm.a#}}',
|
||||
// system variables
|
||||
'{{#sys.query#}}',
|
||||
// conversation variables
|
||||
'{{#conversation.aaa#}}',
|
||||
// env variables
|
||||
'{{#env.a#}}',
|
||||
// rag variables
|
||||
'{{#rag.1748945155129.a#}}',
|
||||
'{{#rag.shared.bbb#}}',
|
||||
]
|
||||
vars.forEach((variable) => {
|
||||
expect(VAR_REGEX.test(variable)).toBe(true)
|
||||
resetReg()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
@ -275,7 +275,7 @@ Thought: {{agent_scratchpad}}
|
|||
`,
|
||||
}
|
||||
|
||||
export const VAR_REGEX = /\{\{(#[a-zA-Z0-9_-]{1,50}(\.[a-zA-Z_]?\w{0,29}){1,10}(\.[a-zA-Z0-9_-]{1,50})?#)\}\}/gi
|
||||
export const VAR_REGEX = /\{\{(#[a-zA-Z0-9_-]{1,50}(\.\d+)?(\.[a-zA-Z_]\w{0,29}){1,10}#)\}\}/gi
|
||||
|
||||
export const resetReg = () => VAR_REGEX.lastIndex = 0
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue