fix(get-python-api-code): set the endpoint in the correct variable (#2800)

* feat: refactor upload_file function to handle optional tweaks parameter

Refactor the upload_file function in utils.py to handle the optional tweaks parameter. If the tweaks parameter is not provided, it is set to an empty dictionary. This change improves the flexibility and usability of the function.

* fix(get-python-api-code): set the endpoint in the correct variable
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-07-18 14:22:45 -03:00 • committed by GitHub
commit f504bcc8c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -35,7 +35,7 @@ except ImportError:
warnings.warn("Langflow provides a function to help you upload files to the flow. Please install langflow to use it.")
upload_file = None
BASE_API_URL = "${window.location.protocol}//${window.location.host}/api/v1/run"
BASE_API_URL = "${window.location.protocol}//${window.location.host}"
FLOW_ID = "${flowId}"
ENDPOINT = "${endpointName || ""}" ${
endpointName
@ -61,7 +61,7 @@ def run_flow(message: str,
:param tweaks: Optional tweaks to customize the flow
:return: The JSON response from the flow
"""
api_url = f"{BASE_API_URL}/{endpoint}"
api_url = f"{BASE_API_URL}/api/v1/run/{endpoint}"
payload = {
"input_value": message,