-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
Fixed Several Exceptions in Workflow Usage #12075
base: main
Are you sure you want to change the base?
Conversation
very clean Pull Request message learned that, thank you for the content |
This reverts commit 2f0823d.
I have standardized my code format and look forward to review |
I apologize for missing some file format changes. I have revised my code format again and successfully ran the 'ruff format --check' command. I look forward to another review. @yihong0618 @laipz8200 |
hello @laipz8200 🌚 |
@@ -1045,7 +1045,7 @@ def message_files(self): | |||
files.append(file) | |||
|
|||
result = [ | |||
{"belongs_to": message_file.belongs_to, **file.to_dict()} | |||
{"belongs_to": message_file.belongs_to, "upload_file_id": file.related_id, **file.to_dict()} |
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.
Please don't include this field in the returned result, to fix the 'more like this' function, you can query MessageFile manually and build the File object by using file_factory.build_from_message_files
in
def generate_more_like_this( |
@@ -71,7 +71,10 @@ def get(self, file_id): | |||
if upload_file.size > 0: | |||
response.headers["Content-Length"] = str(upload_file.size) | |||
if args["as_attachment"]: | |||
response.headers["Content-Disposition"] = f"attachment; filename={upload_file.name}" | |||
from urllib.parse import quote |
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.
A lazy load for this module is not necessary, put it on the top of the file is better.
@@ -46,6 +47,13 @@ def _run(self): | |||
# extract variables | |||
variable = variable_pool.get(node_data.query_variable_selector) if node_data.query_variable_selector else None | |||
query = variable.value if variable else None | |||
if query: |
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.
We've no plan to support files in the Question Classifier node. If you just want to convert the input to string, you can use variable.text
directly.
This pull request includes several changes across multiple files to improve functionality, fix bugs, and enhance code readability. The most important changes include the addition of a new package in the Dockerfile, a fix for file name encoding in HTTP headers, and various bug fixes and improvements in the workflow nodes.
Resolves #12074
Improvements and Bug Fixes:
Dockerfile Update:
libreoffice
to the list of packages installed in the Dockerfile to support additional functionalities.File Name Encoding:
Content-Disposition
header to handle special characters properly by usingurllib.parse.quote
.Tool Parameter Type Fix:
ToolParameterType
class by changingsystme-files
tosystem-files
.Encoding Detection:
chardet
to detect file encoding dynamically when extracting text from CSV files, improving robustness against various encodings. [1] [2]Equality Check Fix:
_is
function to use==
instead ofis
for string comparison.This pull request includes several changes across multiple files to improve functionality and fix bugs. The most important changes include adding a new package to the Dockerfile, fixing a typo in an enum, enhancing file handling in the image preview controller, improving text extraction from CSV files, and updating the question classifier node to handle different query types.Improvements to Dockerfile:
libreoffice
installation to theDockerfile
to support additional functionalities.Bug Fixes:
ToolParameterType
enum from "systme-files" to "system-files"._is
function to use==
instead ofis
for string comparison inlist_operator/node.py
.Enhancements:
image_preview.py
controller by safely encoding filenames for theContent-Disposition
header.chardet
library. [1] [2]Updates to Question Classifier Node:
question_classifier_node.py
to handle different query types, including converting non-string types to JSON strings. [1] [2]This pull request includes several changes to theapi
module, focusing on enhancements, bug fixes, and improvements to the codebase. The most important changes include adding a new package to the Dockerfile, fixing a typo in an enumeration value, improving file handling in theimage_preview
controller, and updating text extraction and comparison logic.Enhancements:
api/Dockerfile
: Addedlibreoffice
to the list of packages installed during the Docker image build process.Bug fixes:
api/core/tools/entities/tool_entities.py
: Corrected a typo in theToolParameterType
enumeration value from "systme-files" to "system-files".api/controllers/files/image_preview.py
: Improved the handling of file names in theContent-Disposition
header by encoding the filename to ensure it is safely transmitted.Codebase improvements:
api/core/workflow/nodes/document_extractor/node.py
: Addedchardet
for detecting file encoding when extracting text from CSV files, enhancing the robustness of text extraction. [1] [2]api/core/workflow/nodes/list_operator/node.py
: Fixed the comparison logic in the_is
function to use==
instead ofis
, ensuring correct functionality.# SummaryPlease include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Tip
Close issue syntax:
Fixes #<issue number>
orResolves #<issue number>
, see documentation for more details.Screenshots
Checklist
Important
Please review the checklist below before submitting your pull request.
dev/reformat
(backend) andcd web && npx lint-staged
(frontend) to appease the lint gods