diff --git a/backend/server/api/configurables.py b/backend/server/api/configurables.py index 4beb7df..7cd450e 100644 --- a/backend/server/api/configurables.py +++ b/backend/server/api/configurables.py @@ -2,7 +2,7 @@ from typing import List from fastapi import APIRouter -from typing_extensions import Annotated, TypedDict +from typing_extensions import TypedDict from extraction.parsing import MAX_FILE_SIZE_MB, SUPPORTED_MIMETYPES from server.models import SUPPORTED_MODELS @@ -18,7 +18,7 @@ class ConfigurationResponse(TypedDict): """Response for configuration.""" available_models: List[str] - supported_mimetypes: List[str] + accepted_mimetypes: List[str] max_file_size_mb: int @@ -27,6 +27,6 @@ def get() -> ConfigurationResponse: """Endpoint to show server configuration.""" return { "available_models": sorted(SUPPORTED_MODELS), - "supported_mimetypes": SUPPORTED_MIMETYPES, + "accepted_mimetypes": SUPPORTED_MIMETYPES, "max_file_size_mb": MAX_FILE_SIZE_MB, } diff --git a/backend/tests/unit_tests/api/test_api_configurables.py b/backend/tests/unit_tests/api/test_api_configuration.py similarity index 94% rename from backend/tests/unit_tests/api/test_api_configurables.py rename to backend/tests/unit_tests/api/test_api_configuration.py index 7842292..3b1ab82 100644 --- a/backend/tests/unit_tests/api/test_api_configurables.py +++ b/backend/tests/unit_tests/api/test_api_configuration.py @@ -9,9 +9,9 @@ async def test_configuration_api() -> None: result = response.json() assert isinstance(result, dict) assert sorted(result) == [ + "accepted_mimetypes", "available_models", "max_file_size_mb", - "supported_mimetypes", ] models = result["available_models"] assert all(isinstance(model_name, str) for model_name in models) diff --git a/backend/tests/unit_tests/test_parsing.py b/backend/tests/unit_tests/test_parsing.py index a98c198..73402ac 100644 --- a/backend/tests/unit_tests/test_parsing.py +++ b/backend/tests/unit_tests/test_parsing.py @@ -10,7 +10,7 @@ from tests.unit_tests.fixtures import get_sample_paths -def test_list_of_supported_mimetypes() -> None: +def test_list_of_accepted_mimetypes() -> None: """This list should generally grow! Protecting against typos in mimetypes.""" assert SUPPORTED_MIMETYPES == [ # Two MS Word mimetypes are disabled for now diff --git a/frontend/app/components/Playground.tsx b/frontend/app/components/Playground.tsx index 8e7c14b..cbcc70c 100644 --- a/frontend/app/components/Playground.tsx +++ b/frontend/app/components/Playground.tsx @@ -1,21 +1,23 @@ "use client"; - import { Button, - Textarea, Heading, Tab, - Tabs, + Box, + Divider, + AbsoluteCenter, TabList, TabPanel, TabPanels, + Tabs, Text, + Textarea, } from "@chakra-ui/react"; import { useMutation } from "@tanstack/react-query"; import React from "react"; import SyntaxHighlighter from "react-syntax-highlighter"; import { docco } from "react-syntax-highlighter/dist/esm/styles/hljs"; -import { runExtraction } from "../utils/api"; +import { runExtraction, useConfiguration } from "../utils/api"; import { Extractor } from "./Extractor"; import { ResultsTable } from "./ResultsTable"; @@ -36,7 +38,10 @@ export const Playground = (props: PlaygroundProps) => { const { data, isPending, mutate } = useMutation({ mutationFn: runExtraction, }); + + const requestServerConfig = useConfiguration(); const [isDisabled, setIsDisabled] = React.useState(false); + const handleSubmit = (event: React.FormEvent) => { event.preventDefault(); @@ -93,13 +98,26 @@ export const Playground = (props: PlaygroundProps) => {
+ Upload Content
- -
OR
+ {requestServerConfig.isFetched && ( + + )} + + + + OR + +