🔧 fix(store.py): remove unnecessary comment in download_component function
🔧 fix(utils.py): replace requests library with httpx library for getting latest released version of langflow from PyPI to improve performance and reliability
This commit is contained in:
parent
5c65e18289
commit
9dbb8d3578
2 changed files with 8 additions and 8 deletions
|
|
@ -3,7 +3,6 @@ from typing import Annotated, List, Optional, Union
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Query
|
from fastapi import APIRouter, Depends, HTTPException, Query
|
||||||
|
|
||||||
from langflow.services.auth import utils as auth_utils
|
from langflow.services.auth import utils as auth_utils
|
||||||
from langflow.services.database.models.user.user import User
|
from langflow.services.database.models.user.user import User
|
||||||
from langflow.services.deps import get_settings_service, get_store_service
|
from langflow.services.deps import get_settings_service, get_store_service
|
||||||
|
|
@ -140,8 +139,6 @@ async def download_component(
|
||||||
store_service: StoreService = Depends(get_store_service),
|
store_service: StoreService = Depends(get_store_service),
|
||||||
store_api_Key: str = Depends(get_user_store_api_key),
|
store_api_Key: str = Depends(get_user_store_api_key),
|
||||||
):
|
):
|
||||||
# If the component is from the store, we need to get it from the store
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
component = await store_service.download(store_api_Key, component_id)
|
component = await store_service.download(store_api_Key, component_id)
|
||||||
except CustomException as exc:
|
except CustomException as exc:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
from typing import TYPE_CHECKING, List
|
from typing import TYPE_CHECKING, List
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from langflow.services.store.schema import ListComponentResponse
|
from langflow.services.store.schema import ListComponentResponse
|
||||||
from langflow.services.store.service import StoreService
|
from langflow.services.store.service import StoreService
|
||||||
|
|
@ -40,12 +42,13 @@ async def update_components_with_user_data(
|
||||||
|
|
||||||
# Get the latest released version of langflow (https://pypi.org/project/langflow/)
|
# Get the latest released version of langflow (https://pypi.org/project/langflow/)
|
||||||
def get_lf_version_from_pypi():
|
def get_lf_version_from_pypi():
|
||||||
import requests
|
try:
|
||||||
|
response = httpx.get("https://pypi.org/pypi/langflow/json")
|
||||||
response = requests.get("https://pypi.org/pypi/langflow/json")
|
if response.status_code != 200:
|
||||||
if response.status_code != 200:
|
return None
|
||||||
|
return response.json()["info"]["version"]
|
||||||
|
except Exception:
|
||||||
return None
|
return None
|
||||||
return response.json()["info"]["version"]
|
|
||||||
|
|
||||||
|
|
||||||
def process_component_data(nodes_list):
|
def process_component_data(nodes_list):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue