From 5716ca21dc3357a7326c7a2c07323f9913f42692 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 27 Oct 2023 11:37:54 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix(store.py):=20import=20missin?= =?UTF-8?q?g=20module=20'langflow.api'=20to=20resolve=20NameError=20?= =?UTF-8?q?=F0=9F=94=A7=20fix(store.py):=20add=20missing=20metadata=20comm?= =?UTF-8?q?ent=20to=20clarify=20the=20purpose=20of=20the=20code=20block=20?= =?UTF-8?q?=E2=9C=A8=20feat(store.py):=20add=20'has=5Fapi=5Fkey'=20field?= =?UTF-8?q?=20to=20the=20response=20of=20'check=5Fif=5Fstore=5Fis=5Fenable?= =?UTF-8?q?d'=20endpoint=20to=20indicate=20if=20the=20user=20has=20an=20AP?= =?UTF-8?q?I=20key=20=F0=9F=94=A7=20fix(store.py):=20add=20missing=20metad?= =?UTF-8?q?ata=20using=20the=20Component.data=20in=20the=20'create=5Fcompo?= =?UTF-8?q?nent'=20endpoint=20to=20properly=20handle=20component=20metadat?= =?UTF-8?q?a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/store.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/api/v1/store.py b/src/backend/langflow/api/v1/store.py index a0701eea7..16fceb6bc 100644 --- a/src/backend/langflow/api/v1/store.py +++ b/src/backend/langflow/api/v1/store.py @@ -1,5 +1,6 @@ from typing import List, Optional from uuid import UUID +from langflow import api from langflow.services.auth import utils as auth_utils from langflow.services.database.models.user.user import User from langflow.services.deps import ( @@ -49,8 +50,12 @@ def get_optional_user_store_api_key( @router.get("/") def check_if_store_is_enabled( settings_service=Depends(get_settings_service), + api_key=Depends(get_optional_user_store_api_key), ): - return {"enabled": settings_service.settings.STORE} + return { + "enabled": settings_service.settings.STORE, + "has_api_key": api_key is not None, + } @router.post("/components/", response_model=ComponentResponse, status_code=201) @@ -60,6 +65,9 @@ def create_component( store_api_Key: str = Depends(get_user_store_api_key), ): try: + # We need to add the metadata using the Component.data + # + return store_service.upload(store_api_Key, component) except Exception as exc: raise HTTPException(status_code=400, detail=str(exc))