-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix: Application deleted, workflow page error reported #2743
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
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 |
---|---|---|
|
@@ -146,10 +146,9 @@ | |
<template #label> | ||
<div class="flex align-center"> | ||
<div class="mr-4"> | ||
<span | ||
>{{ $t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label') | ||
}}</span | ||
> | ||
<span>{{ | ||
$t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label') | ||
}}</span> | ||
</div> | ||
<el-tooltip effect="dark" placement="right" popper-class="max-w-200"> | ||
<template #content> | ||
|
@@ -288,7 +287,7 @@ const update_field = () => { | |
} | ||
}) | ||
.catch((err) => { | ||
// set(props.nodeModel.properties, 'status', 500) | ||
set(props.nodeModel.properties, 'status', 500) | ||
}) | ||
} | ||
|
||
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 provided code snippet seems to be JavaScript with React/Vue syntax (since it includes
const update_field = () => {
axios.post(`/api/nodes/${props.id}/update-field`, { ... }).then(
(res) => {}
).catch((err) => {
set(props.nodeModel.properties, 'status', 500);
});
}; This should cover most minor improvements and ensure readability. |
||
|
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.
There are a few issues and improvements that can be made to the code:
Use of
QuerySet.first()
: The use offilter().first()
is generally preferred overget()
because it won't raise an exception if no record is found; instead, it returnsNone
. This makes the function more robust.Explicitly Handle Not Found Case: Instead of catching exceptions, you should explicitly handle the case where
embed_application
isNone
, which could happen if no application exists with the given ID.Optimization on Server List: In the
get_mcp_tools
asynchronous generator function, there is unnecessary double iteration on the server dictionary when usingasyncio.wait()
. You might need to rethink how this part handles the server list.Here's the improved code:
For the
get_mcp_tools
function, consider refactoring to avoid double iteration:In the revised version, I've added a
try-except
block within each server loop, which helps in handling any errors gracefully without crashing the entire generator. Additionally, I usedcast()
to type-checkmcp_server_response
, although based on typical usage, it is already castable toMCPRunResponse
.