refactor: change login/auto_login to use UseQuery (#3033)

* ✨ (App.tsx): Introduce framer-motion library for animations in the frontend
🔧 (App.tsx): Update import path for useAutoLogin function in controllers/API/queries/auth
🔧 (index.ts): Remove autoLogin function from API controllers as it is now handled by useAutoLogin hook
🔧 (use-get-autologin.ts): Update function name to useAutoLogin and adjust return type
🔧 (use-post-login-user.ts): Update function name to loginUserFn for clarity
🔧 (LoginPage/index.tsx): Update import path for useLoginUser function in controllers/API/queries/auth
🔧 (LoginPage/index.tsx): Update function name to loginUserFn for clarity
🔧 (authStore.ts): Remove unused imports and functions related to autoLogin and login operations

* 📝 (LoginPage/index.tsx): remove unnecessary console.log statement from onSuccess callback in mutate function

* ♻️ (App.tsx): remove unused import statement for 'm' from 'framer-motion' to clean up code and improve readability

* removing abort from request

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
This commit is contained in:
Cristhian Zanforlin Lousa 2024-07-31 17:23:51 -03:00 • committed by GitHub
commit 3835f8d8b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 151 additions and 162 deletions

View file

@ -678,7 +678,9 @@
"display_name": "OpenAI API Key",
"dynamic": false,
"info": "The OpenAI API Key to use for the OpenAI model.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_key",
"password": true,

View file

@ -189,13 +189,13 @@
"show": true,
"title_case": false,
"type": "code",
"value": "import re\n\nfrom langchain_community.document_loaders.web_base import WebBaseLoader\n\nfrom langflow.custom import Component\nfrom langflow.io import MessageTextInput, Output\nfrom langflow.schema import Data\n\n\nclass URLComponent(Component):\n display_name = \"URL\"\n description = \"Fetch content from one or more URLs.\"\n icon = \"layout-template\"\n name = \"URL\"\n\n inputs = [\n MessageTextInput(\n name=\"urls\",\n display_name=\"URLs\",\n info=\"Enter one or more URLs, separated by commas.\",\n is_list=True,\n ),\n ]\n\n outputs = [\n Output(display_name=\"Data\", name=\"data\", method=\"fetch_content\"),\n ]\n\n def ensure_url(self, string: str) -> str:\n \"\"\"\n Ensures the given string is a URL by adding 'http://' if it doesn't start with 'http://' or 'https://'.\n Raises an error if the string is not a valid URL.\n\n Parameters:\n string (str): The string to be checked and possibly modified.\n\n Returns:\n str: The modified string that is ensured to be a URL.\n\n Raises:\n ValueError: If the string is not a valid URL.\n \"\"\"\n if not string.startswith((\"http://\", \"https://\")):\n string = \"http://\" + string\n\n # Basic URL validation regex\n url_regex = re.compile(\n r\"^(https?:\\/\\/)?\" # optional protocol\n r\"(www\\.)?\" # optional www\n r\"([a-zA-Z0-9.-]+)\" # domain\n r\"(\\.[a-zA-Z]{2,})?\" # top-level domain\n r\"(:\\d+)?\" # optional port\n r\"(\\/[^\\s]*)?$\", # optional path\n re.IGNORECASE,\n )\n\n if not url_regex.match(string):\n raise ValueError(f\"Invalid URL: {string}\")\n\n return string\n\n def fetch_content(self) -> list[Data]:\n urls = [self.ensure_url(url.strip()) for url in self.urls if url.strip()]\n loader = WebBaseLoader(web_paths=urls, encoding=\"utf-8\")\n docs = loader.load()\n data = [Data(text=doc.page_content, **doc.metadata) for doc in docs]\n self.status = data\n return data\n"
"value": "import re\n\nfrom langchain_community.document_loaders.web_base import WebBaseLoader\n\nfrom langflow.custom import Component\nfrom langflow.io import MessageTextInput, Output\nfrom langflow.schema import Data\n\n\nclass URLComponent(Component):\n display_name = \"URL\"\n description = \"Fetch content from one or more URLs.\"\n icon = \"layout-template\"\n name = \"URL\"\n\n inputs = [\n MessageTextInput(\n name=\"urls\",\n display_name=\"URLs\",\n info=\"Enter one or more URLs, by clicking the '+' button.\",\n is_list=True,\n ),\n ]\n\n outputs = [\n Output(display_name=\"Data\", name=\"data\", method=\"fetch_content\"),\n ]\n\n def ensure_url(self, string: str) -> str:\n \"\"\"\n Ensures the given string is a URL by adding 'http://' if it doesn't start with 'http://' or 'https://'.\n Raises an error if the string is not a valid URL.\n\n Parameters:\n string (str): The string to be checked and possibly modified.\n\n Returns:\n str: The modified string that is ensured to be a URL.\n\n Raises:\n ValueError: If the string is not a valid URL.\n \"\"\"\n if not string.startswith((\"http://\", \"https://\")):\n string = \"http://\" + string\n\n # Basic URL validation regex\n url_regex = re.compile(\n r\"^(https?:\\/\\/)?\" # optional protocol\n r\"(www\\.)?\" # optional www\n r\"([a-zA-Z0-9.-]+)\" # domain\n r\"(\\.[a-zA-Z]{2,})?\" # top-level domain\n r\"(:\\d+)?\" # optional port\n r\"(\\/[^\\s]*)?$\", # optional path\n re.IGNORECASE,\n )\n\n if not url_regex.match(string):\n raise ValueError(f\"Invalid URL: {string}\")\n\n return string\n\n def fetch_content(self) -> list[Data]:\n urls = [self.ensure_url(url.strip()) for url in self.urls if url.strip()]\n loader = WebBaseLoader(web_paths=urls, encoding=\"utf-8\")\n docs = loader.load()\n data = [Data(text=doc.page_content, **doc.metadata) for doc in docs]\n self.status = data\n return data\n"
},
"urls": {
"advanced": false,
"display_name": "URLs",
"dynamic": false,
"info": "Enter one or more URLs, separated by commas.",
"info": "Enter one or more URLs, by clicking the '+' button.",
"input_types": [
"Message"
],
@ -866,7 +866,9 @@
"display_name": "OpenAI API Key",
"dynamic": false,
"info": "The OpenAI API Key to use for the OpenAI model.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_key",
"password": true,

View file

@ -908,7 +908,9 @@
"display_name": "OpenAI API Key",
"dynamic": false,
"info": "The OpenAI API Key to use for the OpenAI model.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_key",
"password": true,
@ -2033,7 +2035,9 @@
"display_name": "OpenAI API Key",
"dynamic": false,
"info": "The OpenAI API Key to use for the OpenAI model.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_key",
"password": true,
@ -2731,7 +2735,9 @@
"display_name": "OpenAI API Key",
"dynamic": false,
"info": "The OpenAI API Key to use for the OpenAI model.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_key",
"password": true,
@ -3149,7 +3155,9 @@
"display_name": "OpenAI API Key",
"dynamic": false,
"info": "The OpenAI API Key to use for the OpenAI model.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_key",
"password": true,
@ -3592,7 +3600,9 @@
"display_name": "OpenAI API Key",
"dynamic": false,
"info": "The OpenAI API Key to use for the OpenAI model.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_key",
"password": true,
@ -4051,7 +4061,9 @@
"display_name": "SearchAPI API Key",
"dynamic": false,
"info": "",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_key",
"password": true,

View file

@ -756,7 +756,9 @@
"display_name": "OpenAI API Key",
"dynamic": false,
"info": "The OpenAI API Key to use for the OpenAI model.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_key",
"password": true,

View file

@ -607,7 +607,9 @@
"display_name": "OpenAI API Key",
"dynamic": false,
"info": "The OpenAI API Key to use for the OpenAI model.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_key",
"password": true,
@ -1752,7 +1754,9 @@
"display_name": "OpenAI API Key",
"dynamic": false,
"info": "The OpenAI API Key to use for the OpenAI model.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_key",
"password": true,
@ -2635,7 +2639,9 @@
"display_name": "SearchAPI API Key",
"dynamic": false,
"info": "",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_key",
"password": true,

View file

@ -536,7 +536,9 @@
"display_name": "OpenAI API Key",
"dynamic": false,
"info": "The OpenAI API Key to use for the OpenAI model.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_key",
"password": true,

View file

@ -2054,7 +2054,9 @@
"display_name": "OpenAI API Key",
"dynamic": false,
"info": "The OpenAI API Key to use for the OpenAI model.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_key",
"password": true,
@ -2975,7 +2977,9 @@
"display_name": "SearchAPI API Key",
"dynamic": false,
"info": "",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_key",
"password": true,

View file

@ -569,7 +569,9 @@
"display_name": "API Endpoint",
"dynamic": false,
"info": "API endpoint URL for the Astra DB service.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_endpoint",
"password": true,
@ -919,7 +921,9 @@
"display_name": "Astra DB Application Token",
"dynamic": false,
"info": "Authentication token for accessing Astra DB.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "token",
"password": true,
@ -1779,7 +1783,9 @@
"display_name": "API Endpoint",
"dynamic": false,
"info": "API endpoint URL for the Astra DB service.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_endpoint",
"password": true,
@ -2129,7 +2135,9 @@
"display_name": "Astra DB Application Token",
"dynamic": false,
"info": "Authentication token for accessing Astra DB.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "token",
"password": true,
@ -2404,7 +2412,9 @@
"display_name": "OpenAI API Base",
"dynamic": false,
"info": "",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "openai_api_base",
"password": true,
@ -2420,7 +2430,9 @@
"display_name": "OpenAI API Key",
"dynamic": false,
"info": "",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "openai_api_key",
"password": true,
@ -2436,7 +2448,9 @@
"display_name": "OpenAI API Type",
"dynamic": false,
"info": "",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "openai_api_type",
"password": true,
@ -2851,7 +2865,9 @@
"display_name": "OpenAI API Base",
"dynamic": false,
"info": "",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "openai_api_base",
"password": true,
@ -2867,7 +2883,9 @@
"display_name": "OpenAI API Key",
"dynamic": false,
"info": "",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "openai_api_key",
"password": true,
@ -2883,7 +2901,9 @@
"display_name": "OpenAI API Type",
"dynamic": false,
"info": "",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "openai_api_type",
"password": true,
@ -3119,7 +3139,9 @@
"display_name": "OpenAI API Key",
"dynamic": false,
"info": "The OpenAI API Key to use for the OpenAI model.",
"input_types": [],
"input_types": [
"Message"
],
"load_from_db": true,
"name": "api_key",
"password": true,