Merge branch 'dev' into feature/profilePage

This commit is contained in:
Lucas Oliveira 2023-09-11 16:07:17 -03:00
commit f8ab2f12be
11 changed files with 580 additions and 452 deletions

View file

@ -38,6 +38,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
generateReleaseNotes: true
prerelease: true
tag: v${{ steps.check-version.outputs.version }}
commit: main
- name: Publish to PyPI

View file

@ -41,10 +41,10 @@ run_frontend:
cd src/frontend && npm start
run_cli:
poetry run langflow --path src/frontend/build
poetry run langflow run --path src/frontend/build
run_cli_debug:
poetry run langflow --path src/frontend/build --log-level debug
poetry run langflow run --path src/frontend/build --log-level debug
setup_devcontainer:
make init
@ -69,7 +69,7 @@ backend:
build_and_run:
echo 'Removing dist folder'
rm -rf dist
make build && poetry run pip install dist/*.tar.gz && poetry run langflow
make build && poetry run pip install dist/*.tar.gz && poetry run langflow run
build_and_install:
echo 'Removing dist folder'

990
poetry.lock generated

File diff suppressed because it is too large Load diff

View file

@ -13,7 +13,6 @@ from langflow.api.v1.schemas import BuildStatus, BuiltResponse, InitResponse, St
from langflow.graph.graph.base import Graph
from langflow.services.auth.utils import get_current_active_user, get_current_user
from langflow.services.utils import get_session
from loguru import logger
from langflow.services.utils import get_chat_manager, get_session
from cachetools import LRUCache

View file

@ -180,7 +180,7 @@ export default function CodeTabsComponent({
key={idx} // Remember to add a unique key prop
>
{idx < 4 ? (
<div className="w-full h-full flex flex-col">
<div className="flex h-full w-full flex-col">
{tab.description && (
<div
className="mb-2 w-full text-left text-sm"

View file

@ -27,7 +27,7 @@ export default function Header(): JSX.Element {
const { notificationCenter } = useContext(alertContext);
const location = useLocation();
const { logout, autoLogin, isAdmin, userData } = useContext(AuthContext);
const { stars } = useContext(darkContext);
const { stars, gradientIndex } = useContext(darkContext);
const navigate = useNavigate();
return (
@ -139,7 +139,7 @@ export default function Header(): JSX.Element {
<button
className={
"h-7 w-7 rounded-full focus-visible:outline-0 " +
(userData?.profile_image ?? gradients[parseInt(userData?.id ?? "", 30) % gradients.length])
(userData?.profile_image ?? gradients[gradientIndex])
}
/>
</DropdownMenuTrigger>

View file

@ -27,7 +27,7 @@ const DialogOverlay = React.forwardRef<
<DialogPrimitive.Overlay
ref={ref}
className={cn(
"fixed top-0 right-0 left-0 bottom-0 overflow-auto inset-0 z-50 bg-blur-shared backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
"fixed inset-0 bottom-0 left-0 right-0 top-0 z-50 overflow-auto bg-blur-shared backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className
)}
{...props}
@ -44,7 +44,7 @@ const DialogContent = React.forwardRef<
<DialogPrimitive.Content
ref={ref}
className={cn(
"noundo nocopy flex text-start overflow-auto z-50 justify-center items-left flex-col w-full max-w-lg gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-bottom-[48%] data-[state=open]:slide-in-from-bottom-[48%] sm:rounded-lg md:w-full",
"noundo nocopy items-left z-50 flex w-full max-w-lg flex-col justify-center gap-4 overflow-auto border bg-background p-6 text-start shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-bottom-[48%] data-[state=open]:slide-in-from-bottom-[48%] sm:rounded-lg md:w-full",
className
)}
{...props}

View file

@ -7,6 +7,8 @@ const initialValue = {
setDark: () => {},
stars: 0,
setStars: (stars) => 0,
gradientIndex: 0,
setGradientIndex: () => 0,
};
export const darkContext = createContext<darkContextType>(initialValue);
@ -16,6 +18,7 @@ export function DarkProvider({ children }) {
JSON.parse(window.localStorage.getItem("isDark")!) ?? false
);
const [stars, setStars] = useState<number>(0);
const [gradientIndex, setGradientIndex] = useState<number>(0);
useEffect(() => {
async function fetchStars() {
@ -23,6 +26,9 @@ export function DarkProvider({ children }) {
setStars(starsCount);
}
fetchStars();
const min = 0;
const max = 30;
setGradientIndex(Math.floor(Math.random() * (max - min + 1)) + min);
}, []);
useEffect(() => {
@ -41,6 +47,8 @@ export function DarkProvider({ children }) {
stars,
dark,
setDark,
setGradientIndex,
gradientIndex,
}}
>
{children}

View file

@ -33,7 +33,10 @@ function ApiInterceptor() {
}
const res = await renewAccessToken(refreshToken);
login(res?.data?.access_token, res?.data?.refresh_token);
if (res?.data?.access_token && res?.data?.refresh_token) {
login(res?.data?.access_token, res?.data?.refresh_token);
}
try {
if (error?.config?.headers) {
delete error.config.headers["Authorization"];

View file

@ -395,7 +395,9 @@ export async function autoLogin() {
export async function renewAccessToken(token: string) {
try {
return await api.post(`${BASE_URL_API}refresh?token=${token}`);
if (token) {
return await api.post(`${BASE_URL_API}refresh?token=${token}`);
}
} catch (error) {
console.log("Error:", error);
throw error;
@ -473,7 +475,10 @@ export async function updateUser(user_id: string, user: changeUser) {
export async function resetPassword(user_id: string, user: resetPasswordType) {
try {
const res = await api.patch(`${BASE_URL_API}users/${user_id}/reset-password`, user);
const res = await api.patch(
`${BASE_URL_API}users/${user_id}/reset-password`,
user
);
if (res.status === 200) {
return res.data;
}

View file

@ -48,6 +48,8 @@ export type darkContextType = {
setDark: (newState: {}) => void;
stars: number;
setStars: (stars: number) => void;
gradientIndex: number;
setGradientIndex: (index: number) => void;
};
export type locationContextType = {