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
059c089f
Unverified
Commit
059c089f
authored
Nov 07, 2023
by
takatost
Committed by
GitHub
Nov 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: external data tool batch retrieve bug (#1472)
parent
c1e7193c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
completion.py
api/core/completion.py
+10
-13
No files found.
api/core/completion.py
View file @
059c089f
...
@@ -205,21 +205,20 @@ class Completion:
...
@@ -205,21 +205,20 @@ class Completion:
results
=
{}
results
=
{}
with
ThreadPoolExecutor
()
as
executor
:
with
ThreadPoolExecutor
()
as
executor
:
futures
=
{}
futures
=
{}
for
tools
in
grouped_tools
.
values
():
for
tool
in
external_data_tools
:
# Only query the first tool in each group
if
not
tool
.
get
(
"enabled"
):
first_tool
=
tools
[
0
]
continue
future
=
executor
.
submit
(
future
=
executor
.
submit
(
cls
.
query_external_data_tool
,
current_app
.
_get_current_object
(),
tenant_id
,
app_id
,
first_
tool
,
cls
.
query_external_data_tool
,
current_app
.
_get_current_object
(),
tenant_id
,
app_id
,
tool
,
inputs
,
query
inputs
,
query
)
)
for
tool
in
tools
:
futures
[
future
]
=
tool
futures
[
future
]
=
tool
for
future
in
concurrent
.
futures
.
as_completed
(
futures
):
for
future
in
concurrent
.
futures
.
as_completed
(
futures
):
tool_key
,
result
=
future
.
result
()
tool_variable
,
result
=
future
.
result
()
if
tool_key
in
grouped_tools
:
results
[
tool_variable
]
=
result
for
tool
in
grouped_tools
[
tool_key
]:
results
[
tool
[
'variable'
]]
=
result
inputs
.
update
(
results
)
inputs
.
update
(
results
)
return
inputs
return
inputs
...
@@ -246,9 +245,7 @@ class Completion:
...
@@ -246,9 +245,7 @@ class Completion:
query
=
query
query
=
query
)
)
tool_key
=
(
external_data_tool
.
get
(
"type"
),
json
.
dumps
(
external_data_tool
.
get
(
"config"
),
sort_keys
=
True
))
return
tool_variable
,
result
return
tool_key
,
result
@
classmethod
@
classmethod
def
get_query_for_agent
(
cls
,
app
:
App
,
app_model_config
:
AppModelConfig
,
query
:
str
,
inputs
:
dict
)
->
str
:
def
get_query_for_agent
(
cls
,
app
:
App
,
app_model_config
:
AppModelConfig
,
query
:
str
,
inputs
:
dict
)
->
str
:
...
...
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