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
501caf0a
Unverified
Commit
501caf0a
authored
Jan 23, 2024
by
Yeuoly
Committed by
GitHub
Jan 23, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: None type in cot assistant app (#2142)
parent
c17baef1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
4 deletions
+2
-4
assistant_cot_runner.py
api/core/features/assistant_cot_runner.py
+2
-2
assistant_fc_runner.py
api/core/features/assistant_fc_runner.py
+0
-2
No files found.
api/core/features/assistant_cot_runner.py
View file @
501caf0a
...
...
@@ -473,7 +473,7 @@ class AssistantCotApplicationRunner(BaseAssistantApplicationRunner):
result
=
''
for
scratchpad
in
agent_scratchpad
:
result
+=
scratchpad
.
thought
+
next_iteration
.
replace
(
"{{observation}}"
,
scratchpad
.
observation
)
+
"
\n
"
result
+=
scratchpad
.
thought
+
next_iteration
.
replace
(
"{{observation}}"
,
scratchpad
.
observation
or
''
)
+
"
\n
"
return
result
...
...
@@ -543,7 +543,7 @@ class AssistantCotApplicationRunner(BaseAssistantApplicationRunner):
# add assistant message
if
len
(
agent_scratchpad
)
>
0
:
prompt_messages
.
append
(
AssistantPromptMessage
(
content
=
agent_scratchpad
[
-
1
]
.
thought
+
"
\n
"
+
agent_scratchpad
[
-
1
]
.
observation
content
=
(
agent_scratchpad
[
-
1
]
.
thought
or
''
)
+
"
\n
"
+
(
agent_scratchpad
[
-
1
]
.
observation
or
''
)
))
# add user message
...
...
api/core/features/assistant_fc_runner.py
View file @
501caf0a
...
...
@@ -172,7 +172,6 @@ class AssistantFunctionCallApplicationRunner(BaseAssistantApplicationRunner):
for
tool_call_id
,
tool_call_name
,
tool_call_args
in
tool_calls
:
tool_instance
=
tool_instances
.
get
(
tool_call_name
)
if
not
tool_instance
:
logger
.
error
(
f
"failed to find tool instance: {tool_call_name}"
)
tool_response
=
{
"tool_call_id"
:
tool_call_id
,
"tool_call_name"
:
tool_call_name
,
...
...
@@ -220,7 +219,6 @@ class AssistantFunctionCallApplicationRunner(BaseAssistantApplicationRunner):
if
error_response
:
observation
=
error_response
logger
.
error
(
error_response
)
tool_response
=
{
"tool_call_id"
:
tool_call_id
,
"tool_call_name"
:
tool_call_name
,
...
...
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