-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix: Workflow The condition setting 'any' did not take effect when the discriminator was executed #1979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Workflow The condition setting 'any' did not take effect when the discriminator was executed #1979
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,12 +122,11 @@ export class ChatRecordManage { | |
|
||
this.chat.answer_text = this.chat.answer_text + chunk_answer | ||
} | ||
get_current_up_node() { | ||
for (let i = this.node_list.length - 2; i >= 0; i--) { | ||
const n = this.node_list[i] | ||
if (n.content.length > 0) { | ||
return n | ||
} | ||
get_current_up_node(run_node: any) { | ||
const index = this.node_list.findIndex((item) => item == run_node) | ||
if (index > 0) { | ||
const n = this.node_list[index - 1] | ||
return n | ||
} | ||
return undefined | ||
} | ||
|
@@ -145,14 +144,13 @@ export class ChatRecordManage { | |
const index = this.node_list.indexOf(run_node) | ||
let current_up_node = undefined | ||
if (index > 0) { | ||
current_up_node = this.get_current_up_node() | ||
current_up_node = this.get_current_up_node(run_node) | ||
} | ||
let answer_text_list_index = 0 | ||
|
||
if ( | ||
current_up_node == undefined || | ||
run_node.view_type == 'single_view' || | ||
(run_node.view_type == 'many_view' && current_up_node.view_type == 'single_view') | ||
current_up_node.view_type == 'single_view' | ||
) { | ||
const none_index = this.findIndex( | ||
this.chat.answer_text_list, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code has a few issues that need attention:
Here's a cleaned-up version of the code with these issues addressed: export class ChatRecordManage {
chat.answer_text = this.chat.answer_text + chunk_answer
}
get_current_up_node(run_node) {
const index = this.node_list.findIndex(item => item === run_node);
if (index > 0) {
const n = this.node_list[index - 1];
return n;
}
return undefined;
}
processNextNode(run_node) {
const currentIndex = this.node_list.indexOf(run_node);
if (currentIndex < this.node_list.length - 1) { // Check for boundary condition
const nextNode = this.node_list[currentIndex + 1];
if (
current_node == undefined ||
run_node.view_type === 'single_view' ||
(run_node.view_type === 'many_view' && current_node.view_type === "signle_view")
) {
const non_index = this.findIndex(this.chat.answer_text_list , ...); // Complete logic here based on context
}
}
} Suggestions:
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And also consider adding proper exception handling around
dependent_node_been_executed
function calls.Remember it's important to thoroughly test after making such refactorings to catch bugs introduced during restructure.