-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: Workflow debugging for authorized applications will result in an error message indicating unauthorized access to the model #2819
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 |
---|---|---|
|
@@ -268,8 +268,10 @@ const openChatId: () => Promise<string> = () => { | |
}) | ||
} else { | ||
if (isWorkFlow(obj.type)) { | ||
console.log(obj) | ||
const submitObj = { | ||
work_flow: obj.work_flow | ||
work_flow: obj.work_flow, | ||
user_id: obj.user | ||
} | ||
return applicationApi.postWorkflowChatOpen(submitObj).then((res) => { | ||
chartOpenId.value = res.data | ||
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. There is one issue in the given code that could cause problems if To prevent this from causing errors, you should add conditions to ensure both properties ( Here’s an optimized version with these changes: const openChatId: () => Promise<string> = () => {
if (isWorkFlow(obj.type)) {
// Check if work_flow and user exist
if (typeof obj.work_flow === 'string' && typeof obj.user !== 'undefined') {
const submitObj = {
work_flow: obj.work_flow,
user_id: obj.user
};
return applicationApi.postWorkflowChatOpen(submitObj).then((res) => {
chartOpenId.value = res.data;
});
} else {
throw new Error('Missing required fields: work_flow or user');
}
} else {
// ...
}
} With this modification, we first check if |
||
|
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.
The provided code has a few issues:
In
OpenWorkFlowTemp.post()
, the serializer is instantiated with extra arguments (data
), which might be unnecessary if they are not used in the serialization process.The method is using
kwargs
, but there's no use of unpacking them into the serializer. This can be simplified without affecting the functionality.Here’s an updated version that addresses these points:
Changes made:
'user_id'
.request.data
.These changes should resolve the potential issue and make the code cleaner. If you have additional requirements or need further modifications, let me know!