Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
9d98669e
Unverified
Commit
9d98669e
authored
Jun 28, 2023
by
John Wang
Committed by
GitHub
Jun 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: dataset destination error (#477)
parent
408fbb0c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
multi_dataset_router_chain.py
api/core/chain/multi_dataset_router_chain.py
+12
-4
No files found.
api/core/chain/multi_dataset_router_chain.py
View file @
9d98669e
import
math
import
math
import
re
from
typing
import
Mapping
,
List
,
Dict
,
Any
,
Optional
from
typing
import
Mapping
,
List
,
Dict
,
Any
,
Optional
from
langchain
import
PromptTemplate
from
langchain
import
PromptTemplate
...
@@ -178,13 +179,20 @@ class MultiDatasetRouterChain(Chain):
...
@@ -178,13 +179,20 @@ class MultiDatasetRouterChain(Chain):
route
=
self
.
router_chain
.
route
(
inputs
)
route
=
self
.
router_chain
.
route
(
inputs
)
if
not
route
.
destination
:
destination
=
''
if
route
.
destination
:
pattern
=
r'\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b'
match
=
re
.
search
(
pattern
,
route
.
destination
,
re
.
IGNORECASE
)
if
match
:
destination
=
match
.
group
()
if
not
destination
:
return
{
"text"
:
''
}
return
{
"text"
:
''
}
elif
route
.
destination
in
self
.
dataset_tools
:
elif
destination
in
self
.
dataset_tools
:
return
{
"text"
:
self
.
dataset_tools
[
route
.
destination
]
.
run
(
return
{
"text"
:
self
.
dataset_tools
[
destination
]
.
run
(
route
.
next_inputs
[
'input'
]
route
.
next_inputs
[
'input'
]
)}
)}
else
:
else
:
raise
ValueError
(
raise
ValueError
(
f
"Received invalid destination chain name '{
route.
destination}'"
f
"Received invalid destination chain name '{destination}'"
)
)
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